Defining the Test Suite Hierarchy
Each fixture requires a static member function that creates a suite and
adds all of the unit tests to it. A set of MACROs provided by the TEFUnit
framework simplifies this.
// For the top level suite this MACRO will be required to start
START_SUITE
// Each test fixture is a sub-suite of the top level suite so this MACRO will
// be required to start
SUB_SUITE
// To complete the suite creation this MACRO is required
END_SUITE
// To add a test case to the suite provide this MACRO with the name
// of the test case
ADD_TEST_STEP(name)
// To add an asynchronous test case to the suite provide this MACRO
// with the name of the test case
ADD_ASYNC_TEST_STEP(name)
// To add a sub-suite to the suite provide this MACRO with the name
// of the suite/fixture
ADD_TEST_SUITE(name)
Suite hierarchy visual example:
Suite hierarchy code example:
CTestSuite* CTestSuiteA::CreateSuiteL( const TDesC& aName )
{
SUB_SUITE;
ADD_TEST_SUITE( CtestSuiteB )
ADD_TEST_STEP( TestOne );
ADD_TEST_SUITE(CtestSuiteC )
ADD_TEST_STEP( TestTwo );
ADD_TEST_SUITE(CtestSuiteD )
END_SUITE;
}
The TEFUnit framework requires a global function to be implemented in
order to retrieve the top level suite information. To do this you need to
implement the following (in this example only one test suite has been used but
you can use many):
GLDEF_C CTestSuite* CreateTestSuiteL()
{
START_SUITE
ADD_TEST_SUITE( CtestSuiteA )
END_SUITE
}