Creating a unittest TestRunner
eldiener at earthlink.net
Sat Sep 4 20:41:01 EDT 2004
I am interested in the ability to create a unit test TestRunner other than
the default TextTestRunner provided in unittest. While the documentation
"A test runner is an object that provides a single method, run(), which
accepts a TestCase or TestSuite object as a parameter, and returns a result
object. The class TestResult is provided for use as the result object.
PyUnit provide the TextTestRunner as an example test runner which reports
test results on the standard error stream by default. Alternate runners can
be implemented for other environments (such as graphical environments)
without any need to derive from a specific class."
I am having trouble imagining how an alternate TestRunner might work. Does
the normal action of a TestRunner merely instantiate a TestResult object
when its run() method is called and pass that to the instance of the
TestSuite, which is passed to it, run() method for the test suite to fill in
the result object as it runs ? Is there anything else that an alternate
TestRunner needs to do in the minimal case ?
The interactions between the TestRunner, TestSuite, and TestLoader are not
exactly spelled out in detail, although the documentation for the latter two
More information about the Python-list