ADC Home > Reference Library > Reference > Tools > Xcode > CPlusTest Reference
|
TestCase |
Inherits from: | |
Declared In: |
Base class for test cases in CPlusTest.
Unit tests in CPlusTest are implemented by writing individual test methods and grouping them into test cases that use a common fixture. This fixture is common but not shared; one fixture is created and torn down around each invocation of a test method. There should be one instance of a test case subclass per test method in the subclass. This enables the tests to be made part of the "all tests" test suite automatically.
name |
Gets the name of the test.
public
virtual const std::string& name();
Gets the name of the test, which is derived at construction from the name of the invocation passed to the constructor. It is in the format "ClassName::testName". Subclasses should not need to override this method.
run |
Runs the test, recording the results.
public
virtual void run( TestRun& run);
run
Runs the test and record the success or any failure information in the passed TestRun. This will invoke the test's setUp and tearDown methods around the actual invocation of the test, and will use the invocation passed to the constructor to invoke the test.
setUp |
Sets up any necessary state before a test is run.
public
virtual void setUp();
Sets up any state needed by a test immediately before it is run. State used by a test should be set up here rather than in the test constructor so that it is only present when necessary. Subclasses may but do not need to invoke TestCase::setUp.
tearDown |
Tears down any state previously set up in setUp after a test has run.
public
virtual void tearDown();
Tears down any state needed by a test immediately after it has run. State used by a test should be torn down here rather than in the test destructor so that it is only present as long as necessary. Subclasses may but do not need to invoke TestCase::tearDown.
TestCase |
Principal constructor for the TestCase class (must be invoked by subclasses).
public
TestCase( TestInvocation *invocation);
invocation
The principal constructor for the TestCase class, which must be invoked by all subclasses. It derives the name of the test from the invocation it is passed. It also registers the test with the "all tests" test suite.
~TestCase |
Destructor for the TestCase class.
public
virtual ~TestCase();
Destructor for the TestCase class. It removes the test from the "all tests" test suite.
|