Recs.
Updated
Specs
Pros
Pro Part of the Python standard library
PyUnit has been a part of the Python standard library since version 2.1 as the unittest module. This makes it widely available to developers without the need to install additional modules since it's coming out of the box with Python.
Pro Flexible test case execution
The way tests are run is through:
if name == 'main':
unittest.main()
Then unittest.main()
builds a TestSuite
object that contains all the tests that have method names starting with "test", then a TextTestRunner
which then executes each method and prints the results.
But individual test cases can be executed simply by specifying their names on the terminal:
python unittest_program.py testProgram.testGetFeedPostingHost
The default output is usually pretty concise, but it can be more verbose simply by adding a -v
flag in the end when calling the test from the command line.
So unittest can be considered pretty flexible when it comes to test case execution.