Header file and CPP file for creating a test sub-suite

The following example demonstrates how to write a header file and CPP file for creating a test sub-suite of unit tests:

Header file

/*
 * @file CTestSubSuite.h
 *
 * Copyright (c) 2004 Symbian Ltd.  All rights reserved.
 */

#ifndef __TEST_SUB_SUITE__
#define __TEST_SUB_SUITE__

#include "TEFUnit.h"

class CTestSubSuite : public CTestFixture 
    {
public:
    // SetUp and TearDown code 
    virtual void SetupL();
    virtual void TearDownL();

    // Tests
    void TestOne();
    void TestTwo();

    // Create a suite of all the tests
    static CTestSuite* CreateSuiteL(const TDesC& aName);
    };

#endif // __TEST_SUB_SUITE__

CPP file

/**
 * @file CtestSubSuite.cpp
 *
 * Copyright (c) 2004 Symbian Ltd.  All rights reserved.
 */

#include "CtestSubSuite.h"

void CtestSubSuite::SetupL()
/**
 * SetupL
 */
    {
    }

void CtestSubSuite::TearDownL()
/**
 * TearDownL
 */
    {
    }

void CtestSubSuite::TestOne()
/**
 * TestOne
 */
    {
    INFO_PRINTF1(_L("Running SubSuite:One"));
    }

void CtestSuite::TestTwo()
/**
 * TestTwo
 */
    {
    INFO_PRINTF1(_L("Running SubSuite:Two"));
    }

CTestSuite* CtestSubSuite::CreateSuiteL( const TDesC& aName )
/**
 * CreateSuiteL
 *
 * @param aName – Suite name
 * @return – Suite
 */
    {
    SUB_SUITE;
    ADD_TEST_STEP( TestOne );
    ADD_TEST_STEP( TestTwo );
    END_SUITE;
    }