Suppose you have an application where you need to run your unit tests. The directory structure looks something like this but honestly it doesn't matter as long as it is somewhere inside your code folder.
Once you have written you unit tests(In this w have written integration and system tests) as well the only thing remains is to test them from inside the container
Here we have a docker-compose file for building up the images and here we have two containers one for the database and other a flask rest api for crud operations using the database.
Our testing however note uses sqllite which is an in-memory db.
The way to run your tests from inside the docker container is actually quite simple and is just addition of one line
RUN python -m unittest discover
0 Comments