Header file and CPP file for creating a test suite

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

Header file

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

#ifndef __TEST_SUITE__
#define __TEST_SUITE__

#include "TEFUnit.h"

class CTestSuite : 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_SUITE__

CPP file

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

#include "CTestSuite.h"

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

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

void CTestSuite::TestOne()
/**
 * TestOne
 */
    {
    INFO_PRINTF1(_L("Running Suite:One"));
    }

void CTestSuite::TestTwo()
/**
 * TestTwo
 */
    {
    INFO_PRINTF1(_L("Running Suite:Two"));
    }

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