In-Memory CSV Files For Automated Tests

Kwabena Asante
2 min readDec 11, 2020

--

In my line of work, we do build a lot of REST APIs for uploading and manipulating CSV files.
Our core stack is Python with Django Web framework, PostgreSQL database, Redis used as cache and RabbitMq as a message broker.

So what happened? With time I realized we didn’t have fast, reliable, independent and well isolated automated tests i.e. unit and end to end tests for these REST APIs.
I realized my colleagues were adding Sample CSV files in other to write automated tests for functionalities in these endpoints.
And to be able to run these tests in the CI/CD pipelines these CSV files were committed in to the version control system.

I felt this was wrong and our codebase was just getting bloated with assets which are not needed in our production environment.
Being a proactive Software Engineer I built a simple python library that allows you to generate in-memory CSV files to enhance writing of robust test cases.

The library is currently available on Pypi and also open for contributions on Github

But I still leave this open for your comments; whether to add Sample CSV files for your automated tests or use generated in-memory CSV files.
I will love to hear your opinion.

--

--

No responses yet