Go to the latest version of this document.

# ``twisted`.`trial`.`itrial`.`IReporter``

interface documentation

`class IReporter(zi.Interface): (source)`

Known implementations: `twisted.trial._dist.distreporter.DistReporter`, `twisted.trial.reporter.Reporter`, `twisted.trial.reporter.SubunitReporter`, `twisted.trial.reporter.TestResult`, `twisted.trial.reporter.TestResultDecorator`, `twisted.trial.reporter.UncleanWarningsReporterWrapper`, `twisted.plugins.twisted_trial._Reporter`, `twisted.trial.reporter._ExitWrapper`

View In Hierarchy

I report results from a run of a test suite.

Method | `addError` | Record that a test has raised an unexpected exception.
Method | `addExpectedFailure` | Record that the given test failed, and was expected to do so.
Method | `addFailure` | Record that a test has failed with the given failure.
Method | `addSkip` | Record that a test has been skipped for the given reason.
Method | `addSuccess` | Record that test passed.
Method | `addUnexpectedSuccess` | Record that the given test failed, and was expected to do so.
Method | `done` | Called when the test run is complete.
Method | `startTest` | Report the beginning of a run of a single test method.
Method | `stopTest` | Report the status of a single test method
Method | `wasSuccessful` | Return a boolean indicating whether all test results that were reported to this reporter were successful or not.
Attribute | `shouldStop` | A boolean indicating that this reporter would like the test run to stop.
Attribute | `testsRun` | The number of tests that seem to have been run according to this reporter.

def addError(test, error): (source)

Record that a test has raised an unexpected exception.

Parameters
test | The test that has raised an error.
error | The error that the test raised. It will either be a three-tuple in the style of `sys.exc_info()` or a `Failure` object.

def addExpectedFailure(test, failure, todo=None): (source)

Record that the given test failed, and was expected to do so.

In Twisted 15.5 and prior, `todo` was a mandatory parameter.

Parameters
test:`unittest.TestCase` | The test which this is about.
failure:`failure.Failure` | The error which this test failed with.
todo:`unittest.Todo` | The reason for the test's TODO status. If `None`, a generic reason is used.

def addFailure(test, failure): (source)

Record that a test has failed with the given failure.

Parameters
test | The test that has failed.
failure | The failure that the test failed with. It will either be a three-tuple in the style of `sys.exc_info()` or a `Failure` object.

def addSkip(test, reason): (source)

Record that a test has been skipped for the given reason.

Parameters
test | The test that has been skipped.
reason | An object that the test case has specified as the reason for skipping the test.

def addSuccess(test): (source)

Record that test passed.

def addUnexpectedSuccess(test, todo=None): (source)

Record that the given test failed, and was expected to do so.

In Twisted 15.5 and prior, `todo` was a mandatory parameter.

Parameters
test:`unittest.TestCase` | The test which this is about.
todo:`unittest.Todo` | The reason for the test's TODO status. If `None`, a generic reason is used.

def done(): (source)

Called when the test run is complete.

This gives the result object an opportunity to display a summary of information to the user. Once you have called `done` on an `IReporter` object, you should assume that the `IReporter` object is no longer usable.

def startTest(method): (source)

Report the beginning of a run of a single test method.

Parameters
method | an object that is adaptable to ITestMethod

def stopTest(method): (source)

Report the status of a single test method

Parameters
method | an object that is adaptable to ITestMethod

def wasSuccessful(): (source)

Return a boolean indicating whether all test results that were reported to this reporter were successful or not.

shouldStop = (source)

A boolean indicating that this reporter would like the test run to stop.

testsRun = (source)

The number of tests that seem to have been run according to this reporter.