|
1 /* |
|
2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "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". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Active Scheduler Test Module |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef ACTIVE_SCHEDULED_TEST_MODULE_BASE_H |
|
20 #define ACTIVE_SCHEDULED_TEST_MODULE_BASE_H |
|
21 |
|
22 // INCLUDES |
|
23 #if defined (_MSC_VER) && (_MSC_VER >= 1000) |
|
24 #pragma once |
|
25 #endif |
|
26 |
|
27 #include <StifLogger.h> |
|
28 #include <StifParser.h> |
|
29 #include <StifTestModule.h> |
|
30 #include "TestModuleConstants.h" |
|
31 #include "OutputPrinter.h" |
|
32 |
|
33 // MACROS |
|
34 // None |
|
35 |
|
36 // DATA TYPES |
|
37 // None |
|
38 |
|
39 // FUNCTION PROTOTYPES |
|
40 // None |
|
41 |
|
42 // FORWARD DECLARATIONS |
|
43 // None |
|
44 |
|
45 // CLASS DECLARATION |
|
46 |
|
47 |
|
48 class CActiveScheduledTestModuleBase : public CTestModuleBase |
|
49 { |
|
50 public: // Enumerations |
|
51 |
|
52 private: // Enumerations |
|
53 |
|
54 protected: // Constructors and destructor |
|
55 |
|
56 /** |
|
57 * Two-phased constructor. |
|
58 */ |
|
59 //static CActiveScheduledTestModuleBase* NewL(); |
|
60 CActiveScheduledTestModuleBase(TInt aMinTestCaseId, TInt aMaxTestCaseId, const TDesC &aTitleFormat); |
|
61 CActiveScheduledTestModuleBase(TInt aMinTestCaseId, TInt aMaxTestCaseId, const TDesC &aTitleFormat, const TDesC &aConsoleTraceDescription, const TDesC &aTracePrefix, TInt aPrintPriority=0); |
|
62 |
|
63 /** |
|
64 * Destructor. |
|
65 */ |
|
66 ~CActiveScheduledTestModuleBase(); |
|
67 |
|
68 public: // New functions |
|
69 |
|
70 public: // Functions from base classes |
|
71 |
|
72 /** |
|
73 * InitL is used to initialize the Test Module. The Test Modules |
|
74 * can use the configure file to read parameters for Test Module |
|
75 * initialization but they can also have their own configure file |
|
76 * or some other routine to initialize themselves. |
|
77 */ |
|
78 TInt InitL( TFileName& aIniFile, TBool aFirstTime ); |
|
79 |
|
80 /** |
|
81 * Test cases are inquired from the Test Module by calling GetTestCasesL. |
|
82 * Test cases are read from the config file specified by aConfigFile. |
|
83 * If the Test Module does not use config files for test case definition |
|
84 * it does not use aConfigFile parameter. Test cases are appended |
|
85 * to CArrayPtrFlat<RTestEngine::TTestCaseInfo> that is a list |
|
86 * consisting of several TTestCaseInfo objects. |
|
87 * TTestCaseInfo class defines individual test cases and, if needed, |
|
88 * a test set where the test case belongs to. TTestCaseInfo is |
|
89 * defined in Table 9. |
|
90 * The Test Framework will be the owner of the data in the |
|
91 * RPointerArray and it does the memory deallocation. |
|
92 */ |
|
93 TInt GetTestCasesL( const TFileName& aConfigFile , RPointerArray<TTestCaseInfo>& aTestCases ); |
|
94 |
|
95 /** |
|
96 * RunTestCaseL is used to run an individual test case specified |
|
97 * by aTestCase. Test cases that can be run may be requested from |
|
98 * Test Module by GetTestCasesL method before calling RunTestCaseL. |
|
99 * This method is synchronous and test case result is returned as |
|
100 * reference parameter aResult value. The function shall return |
|
101 * KErrNone if case is successfully started. |
|
102 * If test case is not available (i.e invalid configuration file or |
|
103 * or case number), then function shall return the error code (i.e |
|
104 * (KErrNotFound) |
|
105 */ |
|
106 virtual TInt RunTestCaseL( const TInt aCaseNumber , const TFileName& aConfig , TTestResult& aResult ); |
|
107 |
|
108 protected: // New functions |
|
109 virtual TInt RunTestCaseFunctionL(TInt id, CStifSectionParser *section, TTestResult &aResult) = 0; |
|
110 |
|
111 protected: // Functions from base classes |
|
112 HBufC8 *GetDescriptor8LC(const TFileName &aFileName); |
|
113 TTimeIntervalMicroSeconds32 GetTimeIntervalL(CStifSectionParser *aSection, const TDesC &aTag, TBool &aUsingDefault, const TTimeIntervalMicroSeconds32 &aDefaultInterval, TBool aContinue=EFalse); |
|
114 TTimeIntervalMicroSeconds GetTimeIntervalL(CStifSectionParser *aSection, const TDesC &aTag, TBool &aUsingDefault, const TTimeIntervalMicroSeconds &aDefaultInterval=TTimeIntervalMicroSeconds(-1) , TBool aContinue=EFalse); |
|
115 TInt GetIntL(CStifSectionParser *aSection, const TDesC &aTag, TBool &aUsingDefault, const TInt &aDefaultInt, TBool aContinue=EFalse) ; |
|
116 TBool IsDurationInRange(TInt aRepeatTimes, TTimeIntervalMicroSeconds aToneDuration, TTimeIntervalMicroSeconds aRepeatSilence, TTimeIntervalMicroSeconds aErrorRange , TTime aStartTime , TTime aEndTime ) ; |
|
117 void ConstructL(); |
|
118 |
|
119 private: |
|
120 void InitLoggerL( const TFileName& aLogPath , const TFileName& aLogFile ); |
|
121 void InitLoggerL(); |
|
122 |
|
123 //TTimeIntervalMicroSeconds GetDelayL(CStifSectionParser *aSection, const TDesC &aTag=KTagDelay); |
|
124 public: // Data |
|
125 // Constants |
|
126 |
|
127 private: |
|
128 CStifLogger *iLogger; |
|
129 protected: // Data |
|
130 const TDesC &iTitleFormat; |
|
131 COutputPrinter iOutputPrinter; |
|
132 private: // Data |
|
133 CActiveScheduler* iScheduler; |
|
134 TInt iMaxTestCaseId; |
|
135 TInt iMinTestCaseId; |
|
136 |
|
137 public: // Friend classes |
|
138 protected: // Friend classes |
|
139 private: // Friend classes |
|
140 }; |
|
141 |
|
142 #endif // ACTIVE_SCHEDULED_TEST_MODULE_BASE_H |