The unittest
library generates the test output on a console window. You might want to generate a report of all the tests executed as evidence or to distribute test results to various stakeholders. Sending console logs to the stakeholder may not be a good idea. Stakeholders will need nicely formatted, summary reports with a drill-down access to the details. The unittest
library does not have an in-built way to generate nicely formatted reports. We can use the HTMLTestRunner
extension of unittest
written by Wai Yip Tung. You can find more about HTMLTestRunner
at https://pypi.python.org/pypi/HTMLTestRunner along with the download instructions.
We will use HTMLTestRunner
in our test to generate a nice-looking report. Let's modify the test suite file that we created earlier in the chapter and add HTMLTestRunner
support. We need to create an output file that will contain the actual report, configure...