|
|
TestSuite |
| Inherits from: | |
| Declared In: |
Named collection of unit tests.
Test suites in CPlusTest are named collections of Tests (which can be both TestCases and other TestSuites). When a TestSuite is run, all of its component Tests are run. The order of Test execution within a TestSuite is undefined so you should not depend on it. There is a global TestSuite named "All" to which all instances of TestCase and TestSuite are added automatically; this can be accessed via the static TestSuite::allTests method. Generally, you will just want to create and use TestSuite instances rather than create subclasses. TestSuites do not currently create a fixture around execution of their Tests.
Adds a Test to the TestSuite, without taking ownership of it.
Gets a TestSuite named "All" containing all currently-instantiated TestCases and TestSuites.
Gets the name of the TestSuite.
Removes a Test from the TestSuite, without deleting it.
Runs all of the Tests in the TestSuite against the given TestRun.
Overridden from Test.
Overridden from Test.
Gets all of the Tests in this TestSuite.
Constructor for the TestSuite class.
Gets a Test in the TestSuite by name.
Destructor for the TestSuite class.
addTest |
Adds a Test to the TestSuite, without taking ownership of it.
testThe Test to add to the TestSuite.
Adds a Test to the TestSuite. The TestSuite does not take ownership of the Test; that is, it does not guarantee the Test will be deleted by the TestSuite's destructor or when the Test is removed from the TestSuite. This ensures it is safe to register global Tests with a TestSuite. No assumptions should be made regarding the order in which Tests are run.
allTests |
Gets a TestSuite named "All" containing all currently-instantiated TestCases and TestSuites.
public
static TestSuite& allTests();
Returns a TestSuite that will contain all currently-instanted TestCases and TestSuites.
Gets a TestSuite containing all currently-instantiated TestCases and TestSuites. By default whenever a TestCase or a TestSuite is instantiated, it adds itself to the "All" TestSuite. This can be used as a simple way to run all unit tests. Always use this accessor to get the "All" TestSuite; do not cache it.
name |
Gets the name of the TestSuite.
public
virtual const std::string& name();
Returns the name of the TestSuite.
Gets the name of the TestSuite.
removeTest |
Removes a Test from the TestSuite, without deleting it.
testThe Test to remove from the TestSuite, which must be present within the TestSuite.
Removes a Test from the TestSuite. Since the TestSuite never takes ownership of the Tests added to the TestSuite, removing a Test from a TestSuite does not result in the Test being deleted or its destructor being invoked. This ensures it is safe to register global Tests with a TestSuite.
run |
Runs all of the Tests in the TestSuite against the given TestRun.
runThe TestRun in which to record test progress, success, or failure.
Runs all of the Tests in the TestSuite against the given TestRun, and records their success or failure. The TestSuite will run all of its Tests regardless of whether they succeed. No assumptions should be made regarding the order in which Tests are run.
setUp |
Overridden from Test.
public
virtual void setUp();
tearDown |
Overridden from Test.
public
virtual void tearDown();
tests |
Gets all of the Tests in this TestSuite.
public
virtual std::list<Test*>& tests();
Returns all of the Tests in this TestSuite.
Gets all of the Tests in this TestSuite.
TestSuite |
Constructor for the TestSuite class.
public
TestSuite( const std::string& name);
nameThe name of this test suite. It may be human-readable. The name "All" is reserved by the testing framework.
Constructor for the TestSuite class. Configures the TestSuite to have the given name, and adds the TestSuite to the global TestSuite named "All" (accessed via TestSuite::allTests).
testWithName |
Gets a Test in the TestSuite by name.
public
virtual Test* testWithName( const std::string& name);
nameThe name of the Test to find in the TestSuite.
Returns the Test in the TestSuite with the given name, or NULL if no Test with the given name could be found.
Locates a Test in the TestSuite given the name of the Test, and returns a pointer to it. If the Test is not found, NULL is returned.
~TestSuite |
Destructor for the TestSuite class.
public
virtual ~TestSuite();
Destructor for the TestSuite class. Removes the TestSuite from the global TestSuite named "All" (accessed via TestSuite::allTests).
Last Updated: 2009-08-12