|
1 /* |
|
2 * Copyright (c) 2005-2009 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef TEFTESTMODULE_H |
|
19 #define TEFTESTMODULE_H |
|
20 |
|
21 // INCLUDES |
|
22 #include "stiftestmodule.h" |
|
23 #include <stiflogger.h> |
|
24 #include <normalhardcodedassert.h> |
|
25 |
|
26 // CONSTANTS |
|
27 //const ?type ?constant_var = ?constant; |
|
28 |
|
29 // MACROS |
|
30 //#define ?macro ?macro_def |
|
31 #define TEST_MODULE_VERSION_MAJOR 0 |
|
32 #define TEST_MODULE_VERSION_MINOR 0 |
|
33 #define TEST_MODULE_VERSION_BUILD 0 |
|
34 |
|
35 // Logging path |
|
36 _LIT( KTEFTestModuleLogPath, "\\logs\\testframework\\TEFTestModule\\" ); |
|
37 // Log file |
|
38 _LIT( KTEFTestModuleLogFile, "TEFTestModule.txt" ); |
|
39 _LIT( KTEFTestModuleLogFileWithTitle, "TEFTestModule_[%S].txt" ); |
|
40 |
|
41 typedef TBuf<200> TScriptName; |
|
42 typedef TBuf<200> TTcsName; |
|
43 |
|
44 // DATA TYPES |
|
45 //enum ?declaration |
|
46 //typedef ?declaration |
|
47 //extern ?data_type; |
|
48 |
|
49 // FUNCTION PROTOTYPES |
|
50 //?type ?function_name(?arg_list); |
|
51 |
|
52 // FORWARD DECLARATIONS |
|
53 //class ?FORWARD_CLASSNAME; |
|
54 |
|
55 // CLASS DECLARATION |
|
56 |
|
57 /** |
|
58 * This a TEFTestModule class. |
|
59 * ?other_description_lines |
|
60 * |
|
61 * @lib ?library |
|
62 * @since ?Series60_version |
|
63 */ |
|
64 NONSHARABLE_CLASS(CTEFTestModule) : public CTestModuleBase |
|
65 { |
|
66 public: // Constructors and destructor |
|
67 |
|
68 /** |
|
69 * Two-phased constructor. |
|
70 */ |
|
71 static CTEFTestModule* NewL(); |
|
72 |
|
73 /** |
|
74 * Destructor. |
|
75 */ |
|
76 virtual ~CTEFTestModule(); |
|
77 |
|
78 public: // New functions |
|
79 |
|
80 /** |
|
81 * ?member_description. |
|
82 * @since ?Series60_version |
|
83 * @param ?arg1 ?description |
|
84 * @return ?description |
|
85 */ |
|
86 //?type ?member_function( ?type ?arg1 ); |
|
87 |
|
88 public: // Functions from base classes |
|
89 |
|
90 /** |
|
91 * From CTestModuleBase InitL is used to initialize the TEFTestModule. |
|
92 * It is called once for every instance of TEFTestModule after |
|
93 * its creation. |
|
94 * @since ?Series60_version |
|
95 * @param aIniFile Initialization file for the test module (optional) |
|
96 * @param aFirstTime Flag is true when InitL is executed for first |
|
97 * created instance of TEFTestModule. |
|
98 * @return Symbian OS error code |
|
99 */ |
|
100 TInt InitL( TFileName& aIniFile, TBool aFirstTime ); |
|
101 |
|
102 /** |
|
103 * From CTestModuleBase GetTestCasesL is used to inquiry test cases |
|
104 * from TEFTestModule. |
|
105 * @since ?Series60_version |
|
106 * @param aTestCaseFile Test case file (optional) |
|
107 * @param aTestCases Array of TestCases returned to test framework |
|
108 * @return Symbian OS error code |
|
109 */ |
|
110 TInt GetTestCasesL( const TFileName& aTestCaseFile, |
|
111 RPointerArray<TTestCaseInfo>& aTestCases ); |
|
112 |
|
113 /** |
|
114 * From CTestModuleBase RunTestCaseL is used to run an individual |
|
115 * test case. |
|
116 * @since ?Series60_version |
|
117 * @param aCaseNumber Test case number |
|
118 * @param aTestCaseFile Test case file (optional) |
|
119 * @param aResult Test case result returned to test framework (PASS/FAIL) |
|
120 * @return Symbian OS error code (test case execution error, which is |
|
121 * not reported in aResult parameter as test case failure). |
|
122 */ |
|
123 TInt RunTestCaseL( const TInt aCaseNumber, |
|
124 const TFileName& aTestCaseFile, |
|
125 TTestResult& aResult ); |
|
126 |
|
127 /** |
|
128 * From CTestModuleBase; OOMTestQueryL is used to specify is particular |
|
129 * test case going to be executed using OOM conditions |
|
130 * @param aTestCaseFile Test case file (optional) |
|
131 * @param aCaseNumber Test case number (optional) |
|
132 * @param aFailureType OOM failure type (optional) |
|
133 * @param aFirstMemFailure The first heap memory allocation failure value (optional) |
|
134 * @param aLastMemFailure The last heap memory allocation failure value (optional) |
|
135 * @return TBool |
|
136 */ |
|
137 virtual TBool OOMTestQueryL( const TFileName& /* aTestCaseFile */, |
|
138 const TInt /* aCaseNumber */, |
|
139 TOOMFailureType& /* aFailureType */, |
|
140 TInt& /* aFirstMemFailure */, |
|
141 TInt& /* aLastMemFailure */ ); |
|
142 |
|
143 /** |
|
144 * From CTestModuleBase; User may add implementation for OOM test |
|
145 * environment initialization. Usually no implementation is required. |
|
146 * @param aTestCaseFile Test case file (optional) |
|
147 * @param aCaseNumber Test case number (optional) |
|
148 * @return None |
|
149 */ |
|
150 virtual void OOMTestInitializeL( const TFileName& /* aTestCaseFile */, |
|
151 const TInt /* aCaseNumber */ ); |
|
152 |
|
153 /** |
|
154 * From CTestModuleBase; OOMHandleWarningL. User may add implementation |
|
155 * for OOM test warning handling. Usually no implementation is required. |
|
156 * @param aTestCaseFile Test case file (optional) |
|
157 * @param aCaseNumber Test case number (optional) |
|
158 * @param aFailNextValue FailNextValue for OOM test execution (optional) |
|
159 * @return None |
|
160 */ |
|
161 virtual void OOMHandleWarningL( const TFileName& /* aTestCaseFile */, |
|
162 const TInt /* aCaseNumber */, |
|
163 TInt& /* aFailNextValue */); |
|
164 |
|
165 /** |
|
166 * From CTestModuleBase; OOMTestFinalizeL may be used to finalize OOM |
|
167 * test environment. Usually no implementation is required. |
|
168 * @param aTestCaseFile Test case file (optional) |
|
169 * @param aCaseNumber Test case number (optional) |
|
170 * @return None |
|
171 */ |
|
172 virtual void OOMTestFinalizeL( const TFileName& /* aTestCaseFile */, |
|
173 const TInt /* aCaseNumber */ ); |
|
174 |
|
175 /** |
|
176 * Method used to log version of test module |
|
177 */ |
|
178 void SendTestModuleVersion(); |
|
179 |
|
180 /** |
|
181 * Get stack size set by user, in TestFramework.ini |
|
182 */ |
|
183 static TInt ParseStackSizeL(TInt& aStackSize); |
|
184 |
|
185 |
|
186 protected: // New functions |
|
187 |
|
188 /** |
|
189 * ?member_description. |
|
190 * @since ?Series60_version |
|
191 * @param ?arg1 ?description |
|
192 * @return ?description |
|
193 */ |
|
194 //?type ?member_function( ?type ?arg1 ); |
|
195 |
|
196 protected: // Functions from base classes |
|
197 |
|
198 /** |
|
199 * From ?base_class ?member_description |
|
200 */ |
|
201 //?type ?member_function(); |
|
202 |
|
203 private: |
|
204 |
|
205 /** |
|
206 * C++ default constructor. |
|
207 */ |
|
208 CTEFTestModule(); |
|
209 |
|
210 /** |
|
211 * By default Symbian 2nd phase constructor is private. |
|
212 */ |
|
213 void ConstructL(); |
|
214 |
|
215 /** |
|
216 * Read the Cfg File data into a heap buffer |
|
217 * And populate the arrays of selective test case IDs and |
|
218 * Ranges to be used by the state machine |
|
219 * NOTE: we do not support nested cfgs... |
|
220 */ |
|
221 void CreateTitleLoggerL(void); |
|
222 |
|
223 /** |
|
224 * Check for logger settings and delete title logger. |
|
225 */ |
|
226 void DeleteTitleLogger(void); |
|
227 |
|
228 // Prohibit copy constructor if not deriving from CBase. |
|
229 // ?classname( const ?classname& ); |
|
230 // Prohibit assigment operator if not deriving from CBase. |
|
231 // ?classname& operator=( const ?classname& ); |
|
232 |
|
233 /** |
|
234 * Load and wait to start, only used under Non-Lite version. |
|
235 */ |
|
236 |
|
237 #if !(defined TEF_LITE) |
|
238 void StartSystemL(void); |
|
239 #endif |
|
240 |
|
241 |
|
242 /** |
|
243 * Initialization. |
|
244 */ |
|
245 void TEFInitialize(void); |
|
246 |
|
247 /** |
|
248 * Parse configuration file to get config information and script list. |
|
249 */ |
|
250 TInt ParseTEFTestCfgFileL(const TFileName& aConfigFile, RPointerArray<TTestCaseInfo>& aTestCases); |
|
251 |
|
252 /** |
|
253 * Execute sigle script. |
|
254 */ |
|
255 TInt RunScriptL(CActiveScheduler* aScheduler, const TScriptName& aScriptFilePath, const TTcsName& aTcsData); |
|
256 |
|
257 /** |
|
258 * Read Testexecute.ini to get configuration, otherwise use a default config. |
|
259 */ |
|
260 void CreateCfgDataFromFileL(TPtrC& aCfgFilePath, RArray<TRange>& aSelectiveCaseRange, TDesC*& aSelTestCfgFileData); |
|
261 |
|
262 /** |
|
263 * Get elements from configuration file. |
|
264 */ |
|
265 void DistinguishElement(const TPtrC& aElement, RArray<TRange>& aSelectiveCaseRange); |
|
266 |
|
267 |
|
268 /** |
|
269 * Parse TcsData from configration file to select test case flag. Get cases Included or Excluded. |
|
270 */ |
|
271 void ParseTcsDataForSelectiveTestingOptions( const TTcsName& aTcsData, |
|
272 CTestExecuteIniData& aParseTestExecuteIni, |
|
273 RArray<TRange>& aSelectiveCaseRange, |
|
274 TDesC*& aSelTestCfgFileData ); |
|
275 |
|
276 |
|
277 /** |
|
278 * Add script full name(c:/xx/xxx.script) to iScriptFileNames, add cases based on script. |
|
279 */ |
|
280 TInt MatchScriptsToCasesL(const TScriptName& aSscriptFile, TInt aScriptCount, RPointerArray<TTestCaseInfo>& aTestCases); |
|
281 |
|
282 |
|
283 public: // Data |
|
284 // ?one_line_short_description_of_data |
|
285 //?data_declaration; |
|
286 |
|
287 protected: // Data |
|
288 // ?one_line_short_description_of_data |
|
289 //?data_declaration; |
|
290 |
|
291 private: // Data |
|
292 // ?one_line_short_description_of_data |
|
293 //?data_declaration; |
|
294 |
|
295 CStifLogger * iLog; |
|
296 |
|
297 // Standard logger |
|
298 CStifLogger *iStdLog; |
|
299 |
|
300 // Logger for currently running test case |
|
301 CStifLogger *iTCLog; |
|
302 |
|
303 // Flag saying if test case title should be added to log file name |
|
304 TBool iAddTestCaseTitleToLogName; |
|
305 |
|
306 // Flag saying if test module version was already sent |
|
307 TBool iVersionLogged; |
|
308 |
|
309 // Reserved pointer for future extension |
|
310 //TAny* iReserved; |
|
311 |
|
312 //For iCfg_tcs |
|
313 enum TCfgTcs |
|
314 { |
|
315 EInclude, |
|
316 EExclude, |
|
317 EOFF |
|
318 }; |
|
319 |
|
320 //For Tcs in configration file |
|
321 TCfgTcs iCfg_tcs; |
|
322 |
|
323 //For Debug in configration file |
|
324 TBool iCfg_Debug; |
|
325 |
|
326 //For SeparateLog in configration file |
|
327 TBool iCfg_SeparateLog; |
|
328 |
|
329 //For Pipe in configration file |
|
330 TName iCfg_Pipe; |
|
331 |
|
332 //Store script full name(with path), such as c:/xxxx/xxxx.script |
|
333 //This array's sequence is same as test cases. |
|
334 RPointerArray<TScriptName> iArray_ScriptFilePaths; |
|
335 |
|
336 //Store TcsData in configration file, TcsData is paired with Script. |
|
337 RPointerArray<TTcsName> iArray_Cfg_TcsData; |
|
338 |
|
339 //System drive name |
|
340 TDriveName iDefaultSysDrive; |
|
341 |
|
342 public: // Friend classes |
|
343 //?friend_class_declaration; |
|
344 protected: // Friend classes |
|
345 //?friend_class_declaration; |
|
346 private: // Friend classes |
|
347 //?friend_class_declaration; |
|
348 |
|
349 }; |
|
350 |
|
351 #endif // TEFTESTMODULE_H |
|
352 |
|
353 // End of File |