Now, run the following command to create all the necessary tables in our test database and use the nose2
test running to execute all the tests we created. The test runner will execute all the methods for our InitialTests
class that start with the test_
prefix and will display the results.
Tip
The tests won't make changes to the database we have been using when working on the API. Remember that we configured the test_messages
database as our test database.
Remove the api.py
file we created in the previous chapter from the api
folder because we don't want the tests coverage to take into account this file. Go to the api
folder and run the following command within the same virtual environment that we have been using. We will use the -v
option to instruct nose2
to print test case names and statuses. The --with-coverage
option turns on test coverage reporting generation:
nose2 -v --with-coverage
The following lines show the sample output...