Hello,
I am a (self-learned) python developer and I write a lot of python code
everyday. I try to do as much unit testing as possible. But I want to be better
at it, I want to write more test cases, specially that rely on database
insertions and reads and file IO. Here are my use-cases for testing.
How to test if things are going into the database properly or not?
(mysql/mongo). I want to be able to create a test database environment as
simple as possible. Create and delete the test environment before each
functional test case is run.
Sometimes I write code that read some data from some rabbitmq queue and do
certain things. How can I write end to end functional test that creates a test
rabbitmq environment (exchanges and queues) -> wait for sometime -> see if the
intended work has been done -> delete the test environment.
I want to be able to make sure that any new commit on my self hosted gitlab
server should first run all functional test cases first before accepting the
merge.
Since we use lot of docker here to deploy modules to productions, I want to
write functional test cases that test the whole system as a whole and see if
things are happening the way they are supposed to happen or not. This means
firing up lot of docker containers, lot of test databases with some data, and
run all the test cases from an end user point of view.
Can you suggest me the right python testing frameworks that I should be using?
Right now I am using unittest to write test cases and manual if/else statements
to run the functional test cases.
I try to create rabbitmq queues and bind them to rabbitmq exchanges using the
pika module. I then run the module using python -m moduleName and then sleep
for sometime. Then I kill the processs (subprocess) and then I see if the
intended consequences have happened or not. It's a pain in the ass to be doing
so many things for test cases. I clearly need to learn how to do things better.
Any suggestion/book/article/course/video will help me immensely in writing
better test cases.
Thanks for reading.
--
https://mail.python.org/mailman/listinfo/python-list