Update contrib.
2 * Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
4 * This component and the accompanying materials are made available
5 * under the terms of the License "Eclipse Public License v1.0"
6 * which accompanies this distribution, and is available
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
19 #ifndef __T_TESTHANDLER_H__
20 #define __T_TESTHANDLER_H__
27 class CTestHandlerSettings;
36 TBool AllTestsPassed();
37 void PrintL(Output& aOut);
45 * CTestHandler is the class which runs the tests, and outputs results
47 class CTestHandler : public CBase
51 * MTestSpec is the interface class, providing GetNextTest
52 * TTestHandlerSettings provides the command line switches
57 IMPORT_C static CTestHandler* NewLC(RFs& aFs, MTestSpec& aTestSpec,
58 CTestHandlerSettings& aSettings,
59 CConsoleBase* aConsole,
64 CTestHandler(RFs& aFs, MTestSpec& aTestSpec, CConsoleBase* aConsole,
66 void ConstructL(CTestHandlerSettings& aSettings);
69 // API for test programs
71 /// Run the test sequence
72 IMPORT_C void RunTestsL();
75 * Set the test runner to use. This object takes ownership. Passing NULL
76 * means use the default test runner.
78 IMPORT_C void SetTestRunnerL(CTestRunner *aTestRunner);
81 // API for test actions
83 /// Access to shared data
84 CBase* SharedData() const;
85 void SetSharedData(CBase* aData);
88 void SetHeapMark(TInt aAllocCount);
93 /// Get the count of tests run/failed
94 TTestSummary Summary();
97 /// The different possible locations a test can fail in.
98 enum TTestFailLocation
105 /// Get the human readable name for a fail location
106 const TDesC& GetFailLocationName(TTestFailLocation aLoc);
110 * Run one test. Called repeatedly by RunTestsL().
112 void RunTestL(CTestAction* aAction);
114 * Record a test failure.
116 void FailTestL(CTestAction* aAction, TTestFailLocation aLoc, TInt aErr);
118 * Add a test to the list of failed tests.
120 void AppendFailedTestL(TInt aIndex, const TDesC8& aName);
124 * This function prints the number of tests passed, failed, etc at the end of
127 void DisplaySummary();
131 * Used by the test handler itself and the iManager
136 * The settings that define the behaviour of the handler.
138 CTestHandlerSettings *iSettings;
140 CConsoleBase* iConsole;
143 CTestSetup* iTestSetup;
144 CActiveScheduler* iScheduler;
146 MTestSpec& iTestSpec;
152 * After completion of the series of tests, this array contains the numbers of
155 RArray<TInt> iFailedTests;
157 * After completion of the series of tests, this array contains the names of
160 RPointerArray<HBufC> iFailedTestNames;
162 * After completion of the series of tests, this array contains the names
163 * of tests that failed because of known defects */
165 RPointerArray<HBufC> iKnownDefects;
168 * Pointer to shared data. This is initially NULL. It can be accessed by
169 * any of the test actions. If it is not NULL when this class is destroyed,
174 /// Pointer to the current test runner. We own this.
175 CTestRunner* iTestRunner;
177 /// Pointer to the test runner to install when we've finished the current
178 /// test. We own this.
179 CTestRunner* iNextTestRunner;
181 /// The heap mark, used by heap mark actions