|
1 /* |
|
2 * Copyright (c) 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: This file contains the header file of the CStifTFwIf. |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef STIF_TFW_IF_H |
|
19 #define STIF_TFW_IF_H |
|
20 |
|
21 // INCLUDES |
|
22 #include <e32std.h> |
|
23 #include <e32base.h> |
|
24 #include <StifTestModule.h> |
|
25 #include <StifTestInterface.h> |
|
26 |
|
27 |
|
28 // CONSTANTS |
|
29 // None |
|
30 |
|
31 // MACROS |
|
32 // Hardcoded deviceid used if DevId function is not overridden |
|
33 const TUint16 KDefaultDevId = 0x0001; |
|
34 |
|
35 // DATA TYPES |
|
36 |
|
37 // FUNCTION PROTOTYPES |
|
38 // None |
|
39 |
|
40 // FORWARD DECLARATIONS |
|
41 class CStifTFw; |
|
42 |
|
43 // CLASS DECLARATION |
|
44 // Information of test case |
|
45 class CTestInfo |
|
46 :public CBase |
|
47 { |
|
48 public: |
|
49 IMPORT_C static CTestInfo* NewL(); |
|
50 ~CTestInfo(); |
|
51 |
|
52 public: |
|
53 const TDesC& ModuleName () const { return iModuleName; }; |
|
54 TInt SetModuleName ( const TDesC& aModuleName ); |
|
55 const TDesC& TestCaseTitle() const { return iTitle; }; |
|
56 TInt SetTestCaseTitle ( const TDesC& aTitle ); |
|
57 const TDesC& TestCaseFile() const { return iTestCaseFile; }; |
|
58 TInt SetTestCaseFile ( const TDesC& aTestCaseFile ); |
|
59 TInt TestCaseNum() const { return iCaseNumber; }; |
|
60 void SetTestCaseNumber ( TInt aTestCaseNumber ) |
|
61 { iCaseNumber = aTestCaseNumber; }; |
|
62 TInt Priority() const { return iPriority; }; |
|
63 void SetPriority ( TInt aPriority ) |
|
64 { iPriority = aPriority; }; |
|
65 TTimeIntervalMicroSeconds Timeout() const { return iTimeout; }; |
|
66 void SetTimeout ( const TTimeIntervalMicroSeconds& aTimeout ) |
|
67 { iTimeout = aTimeout; }; |
|
68 TInt ExpectedResult() const { return iExpectedResult; }; |
|
69 void CopyL( const CTestInfo& aTestInfo ); |
|
70 TBool operator==(const CTestInfo& aTestInfo) const; |
|
71 |
|
72 private: |
|
73 CTestInfo(); |
|
74 void ConstructL(); |
|
75 CTestInfo( const CTestInfo& /*aTestInfo*/ ){}; |
|
76 CTestInfo& operator= ( const CTestInfo& ); |
|
77 |
|
78 private: |
|
79 TInt iCaseNumber; |
|
80 TInt iExpectedResult; |
|
81 TTimeIntervalMicroSeconds iTimeout; |
|
82 TInt iPriority; |
|
83 TPtrC iModuleName; |
|
84 HBufC* iModuleNameBuf; |
|
85 TPtrC iTitle; |
|
86 HBufC* iTitleBuf; |
|
87 TPtrC iTestCaseFile; |
|
88 HBufC* iTestCaseFileBuf; |
|
89 |
|
90 }; |
|
91 |
|
92 // CLASS DECLARATION |
|
93 |
|
94 // CStifTFwIf is the main class of STIF Test Framework Interface |
|
95 class CStifTFwIf |
|
96 :public CBase |
|
97 { |
|
98 public: // Enumerations |
|
99 |
|
100 protected: // Enumerations |
|
101 |
|
102 private: // Enumerations |
|
103 |
|
104 public: // Constructors and destructor |
|
105 |
|
106 /** |
|
107 * Destructor. |
|
108 */ |
|
109 virtual IMPORT_C ~CStifTFwIf(); |
|
110 |
|
111 protected: // Functions that can be called from derived class |
|
112 |
|
113 /** |
|
114 * Used to open TestFramework. |
|
115 * |
|
116 * Returns Symbian OS error code. |
|
117 */ |
|
118 IMPORT_C TInt Open( TDesC& aTestFrameworkIni = (TDesC&) KNullDesC() ); |
|
119 |
|
120 /** |
|
121 * Used to close TestFramework. |
|
122 * |
|
123 * Returns Symbian OS error code. |
|
124 */ |
|
125 IMPORT_C TInt Close(); |
|
126 |
|
127 /** |
|
128 * Used to set attributes for test framework. |
|
129 * |
|
130 * Returns Symbian OS error code. |
|
131 */ |
|
132 IMPORT_C TInt SetAttribute( TAttribute aAttribute, |
|
133 const TDesC& aValue ); |
|
134 |
|
135 /** |
|
136 * Receive message from ATS. |
|
137 * |
|
138 * Returns Symbian OS error code. |
|
139 */ |
|
140 IMPORT_C TInt AtsReceive( const TDesC& aMessage ); |
|
141 |
|
142 /** |
|
143 * Used to add test module to test framework. |
|
144 * |
|
145 * Returns Symbian OS error code. |
|
146 */ |
|
147 IMPORT_C TInt AddTestModule( TDesC& aModuleName, |
|
148 TDesC& aIniFile = (TDesC&) KNullDesC() ); |
|
149 |
|
150 /** |
|
151 * Used to remove test module to test framework. |
|
152 * |
|
153 * Returns Symbian OS error code. |
|
154 */ |
|
155 IMPORT_C TInt RemoveTestModule( TDesC& aModuleName ); |
|
156 |
|
157 /** |
|
158 * Used to add test case file for test module. |
|
159 * |
|
160 * Returns Symbian OS error code. |
|
161 */ |
|
162 IMPORT_C TInt AddTestCaseFile( TDesC& aModuleName, |
|
163 TDesC& aCaseFile ); |
|
164 |
|
165 /** |
|
166 * Used to remove test case file from test module. |
|
167 * |
|
168 * Returns Symbian OS error code. |
|
169 */ |
|
170 IMPORT_C TInt RemoveTestCaseFile( TDesC& aModuleName, |
|
171 TDesC& aCaseFile ); |
|
172 |
|
173 /** |
|
174 * Get testcases from test modules. Returns test case information |
|
175 * in aTestinfo. |
|
176 * Test module name and test case file can be used to limit the |
|
177 * set of test cases returned. |
|
178 * |
|
179 * Returns Symbian OS error code. |
|
180 */ |
|
181 IMPORT_C TInt GetTestCases( RPointerArray<CTestInfo>& aTestInfo, |
|
182 TDesC& aTestModule = (TDesC&) KNullDesC(), |
|
183 TDesC& aTestCaseFile = (TDesC&) KNullDesC() ); |
|
184 |
|
185 /** |
|
186 * Start selected test case identified with CTestInfo. |
|
187 * Return TestId, which is handle used in subsequent |
|
188 * test case execution control. |
|
189 * |
|
190 * Returns Symbian OS error code. |
|
191 */ |
|
192 |
|
193 IMPORT_C TInt StartTestCase( TInt& aTestId, |
|
194 const CTestInfo& aTestInfo ); |
|
195 |
|
196 /** |
|
197 * Cancel test case execution. TestCompleted() will be called |
|
198 * with aTestExecutionResult set to KErrCancel. |
|
199 * |
|
200 * Returns Symbian OS error code. |
|
201 */ |
|
202 IMPORT_C TInt CancelTestCase( TInt aTestId ); |
|
203 |
|
204 /** |
|
205 * Pause test case execution. |
|
206 * |
|
207 * Returns Symbian OS error code. |
|
208 */ |
|
209 IMPORT_C TInt PauseTestCase( TInt aTestId ); |
|
210 |
|
211 /** |
|
212 * Resume test case execution. |
|
213 * |
|
214 * Returns Symbian OS error code. |
|
215 */ |
|
216 IMPORT_C TInt ResumeTestCase( TInt aTestId ); |
|
217 |
|
218 /** |
|
219 * C++ default constructor. |
|
220 */ |
|
221 IMPORT_C CStifTFwIf(); |
|
222 |
|
223 protected: // Functions that the derived class may implement. |
|
224 |
|
225 /** |
|
226 * Function is called when test execution is finished |
|
227 * with information of test case, result of test case execution |
|
228 * and test case result. |
|
229 */ |
|
230 virtual void TestCompleted( TInt aTestId, |
|
231 TInt aTestExecutionResult, |
|
232 TTestResult& aTestResult )=0; |
|
233 |
|
234 /** |
|
235 * Function is called when test case prints. |
|
236 */ |
|
237 virtual void Print( TInt /*aTestId*/, |
|
238 TTestProgress& /*iProgress*/ ){}; |
|
239 |
|
240 /** |
|
241 * Send message to ATS. |
|
242 */ |
|
243 virtual void AtsSend( const TDesC& /*aMessage*/ ){}; |
|
244 |
|
245 /** |
|
246 * Get device identifier, should be overridden to make them |
|
247 * unique among slaves. |
|
248 * Returns default value for every slave otherwise. |
|
249 */ |
|
250 virtual TUint16 DevId(){ return KDefaultDevId; }; |
|
251 |
|
252 /** |
|
253 * Reboot indication. |
|
254 * After this function returns, reboot is done |
|
255 * by test module or STIF TF. |
|
256 */ |
|
257 virtual void GoingToDoReset(){}; |
|
258 |
|
259 private: |
|
260 |
|
261 public: // Data |
|
262 |
|
263 protected: // Data |
|
264 |
|
265 private: // Data |
|
266 |
|
267 CStifTFw* iStifTFw; |
|
268 |
|
269 public: // Friend classes |
|
270 |
|
271 protected: // Friend classes |
|
272 |
|
273 private: // Friend classes |
|
274 friend class CStifTFw; |
|
275 }; |
|
276 |
|
277 #endif // STIF_TFW_IF_H |
|
278 |
|
279 // End of File |