Make All Tests Pass
Learn to make all tests pass in test-driven development.
We'll cover the following
In this step, we rerun the tests, including older ones, and make sure they pass. Therefore, we must make sure that the feature being added doesn’t make the previous test fail, thereby breaking past functionality.
How does it work?
Here, we basically redo the action we performed in step two. However, this time, we shouldn’t get any failed tests if the actual code we write was well implemented:
$ python manage.py test
We can also run it using Docker in the following way:
$ docker-compose exec web python manage.py test
Since the tests must pass because the feature is now implemented, the output would be something similar to this:
..
----------------------------------------------------------------------
Ran 4 tests in 0.026s
OK
Destroying test database for alias 'default'...
Because the tests were successful, we get an output of OK.
Working example
Here’s a working example.
Get hands-on with 1400+ tech skills courses.