Testing is one of the pillars of any software during development, and later during maintenance and expansion too. Especially in the case of web applications where the application will handle high traffic and be scrutinized by a large number of end users at all times, testing becomes pretty important, as the user feedback determines the fate of the application. In this recipe, we will see how to start with test writing and also see more complex tests in the recipes to follow.
We will start with the creation of a new test file named app_tests.py
at the root application level, that is, alongside the my_app
folder.
The unittest2
Python library also needs to be installed using the following command:
$ pip install unittest2