Creating a unittest TestRunner

E

Edward Diener

I am interested in the ability to create a unit test TestRunner other than
the default TextTestRunner provided in unittest. While the documentation
explains:

"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
is adequate.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top