TestRun

Declared In:

Overview

Class that represents the execution of one or more unit tests.

Discussion

A TestRun represents the execution of one or more unit tests, and records success and failure information about those tests. It can have any number of TestObservers attached, which it also informs of test progress for the purposes of logging and reporting.



Functions

addObserver

Adds a TestObserver to a TestRun.

failedTest

Informs the TestRun that the given Test has failed.

failureCount

Gets the number of Tests that failed.

removeObserver

Removes a TestObserver from a TestRun.

runCount

Gets the number of Tests run.

startedTest

Informs the TestRun that the given Test has started.

startedTestSuite

Informs the TestRun that the given TestSuite has started.

stoppedTest

Informs the TestRun that the given Test has completed. A Test either completes or fails, never both.

stoppedTestSuite

Informs the TestRun that the given TestSuite has completed.

TestRun

Constructor for the TestRun class.

~TestRun

Destructor for the TestRun class.


addObserver


Adds a TestObserver to a TestRun.

public

virtual void addObserver( TestObserver *observer);
Parameters
observer

The TestObserver to notify of events.

Discussion

Adds a TestObserver that will be notified of various events during execution of Tests. These events include Test start, Test completion, Test failure, TestSuite start, and TestSuite completion. You should not rely on order of notification of observers.


failedTest


Informs the TestRun that the given Test has failed.

public

virtual void failedTest( Test& test, const TestFailure& failure);
Parameters
test

The Test that failed execution.

testFailure

Information about the failure of the Test.

Discussion

Informs the TestRun that the given Test has failed. The TestRun increments its failure count and passes this information to any observers. A Test either completes or fails, never both.


failureCount


Gets the number of Tests that failed.

public

virtual unsigned int failureCount();
Return Value

Returns the number of Tests that failed so far.

Discussion

Gets the number of Tests that failed in the current run. TestSuites are not counted. This can be called at any time, it isn't necessary to wait until all test execution has completed.


removeObserver


Removes a TestObserver from a TestRun.

public

virtual void removeObserver( TestObserver *observer);
Parameters
observer

The TestObserver to stop notifying of events.

Discussion

Removes a TestObserver from a TestRun so it will no longer be notified of events occurring during the run.


runCount


Gets the number of Tests run.

public

virtual unsigned int runCount();
Return Value

Returns the number of Tests run so far, regardless of their success.

Discussion

Gets the number of Tests run, regardless of whether they were successful. TestSuites are not counted. This can be called at any time, it isn't necessary to wait until all test execution has completed.


startedTest


Informs the TestRun that the given Test has started.

public

virtual void startedTest( Test& test);
Parameters
test

The Test that started execution.

Discussion

Informs the TestRun that the given Test has started. The TestRun increments its run count and passes this information to any observers.


startedTestSuite


Informs the TestRun that the given TestSuite has started.

public

virtual void startedTestSuite( TestSuite& testSuite);
Parameters
testSuite

The TestSuite that started execution.

Discussion

Informs the TestRun that the given TestSuite has started. The TestRun passes this information to any observers.


stoppedTest


Informs the TestRun that the given Test has completed. A Test either completes or fails, never both.

public

virtual void stoppedTest( Test& test);
Parameters
test

The Test that completed execution.

Discussion

Informs the TestRun that the given Test has completed. The TestRun passes this information to any observers. A Test either completes or fails, never both.


stoppedTestSuite


Informs the TestRun that the given TestSuite has completed.

public

virtual void stoppedTestSuite( TestSuite& testSuite);
Parameters
testSuite

The TestSuite that started execution.

Discussion

Informs the TestRun that the given TestSuite has completed. A TestSuite always completes execution. The TestRun passes this information to any observers.


TestRun


Constructor for the TestRun class.

public

TestRun();
Discussion

Constructor for the TestRun class. Initializes the TestRun to a run and failure count of zero, and to have no observers.


~TestRun


Destructor for the TestRun class.

public

virtual ~TestRun();
Discussion

Destructor for the TestRun class.

Did this document help you? Yes It's good, but... Not helpful...

 

Last Updated: 2009-08-12