[methodName]) |
Each instance of TestCase will run a single test method: the method named methodName. If you remember, we had an earlier example that went something like this:
def suite(): suite = unittest.TestSuite() suite.addTest(WidgetTestCase('testDefaultSize')) suite.addTest(WidgetTestCase('testResize')) return suite
Here, we create two instances of WidgetTestCase, each of which runs a single test.
methodName defaults to 'runTest'
.
testFunc[, setUp[, tearDown[, description]]]) |
[tests]) |
If tests is given, it must be an iterable of individual test cases or other test suites that will be used to build the suite initially. Additional methods are provided to add test cases and suites to the collection later on.
) |
) |
[stream[, descriptions[, verbosity]]]) |
[module[, defaultTest[, argv[, testRunner[, testLoader]]]]]) |
if __name__ == '__main__': unittest.main()
In some cases, the existing tests may have been written using the doctest module. If so, that module provides a DocTestSuite class that can automatically build unittest.TestSuite instances from the existing doctest-based tests. New in version 2.3.
See About this document... for information on suggesting changes.