|
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 CTestEngine. |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef TEST_ENGINE_H |
|
19 #define TEST_ENGINE_H |
|
20 |
|
21 // INCLUDES |
|
22 #include <e32std.h> |
|
23 #include <e32base.h> |
|
24 #include <StifLogger.h> |
|
25 #include <StifParser.h> |
|
26 #include <stifinternal/TestServerClient.h> |
|
27 #include "TestEngineClient.h" |
|
28 #include "TestEngineEvent.h" |
|
29 #include "STIFTestFrameworkSettings.h" |
|
30 #include "SettingServerClient.h" |
|
31 #include "STIFMeasurement.h" |
|
32 #include "TestModuleInfo.h" |
|
33 |
|
34 // CONSTANTS |
|
35 // Heap sizes needed for creating server thread. |
|
36 const TUint KTestEngineMinHeapSize = 0x10000; |
|
37 const TUint KTestEngineMaxHeapSize = 0x100000; |
|
38 |
|
39 // MACROS |
|
40 // None |
|
41 |
|
42 // DATA TYPES |
|
43 |
|
44 // Panic reasons |
|
45 enum TTestEnginePanic |
|
46 { |
|
47 EBadRequest, |
|
48 EBadDescriptor, |
|
49 EMainSchedulerError, |
|
50 ESvrCreateServer, |
|
51 ECreateTrapCleanup, |
|
52 EBadSubsessionHandle, |
|
53 ENoStartupInformation, |
|
54 EInvalidModuleName, |
|
55 EReqPending, |
|
56 EDoCancelDisorder, |
|
57 ECancelAsyncIPCError, |
|
58 EEventPanic |
|
59 }; |
|
60 |
|
61 // Struct to Test report settings |
|
62 class TTestReportSettings |
|
63 { |
|
64 public: |
|
65 |
|
66 TTestReportSettings(){ iCreateTestReport = ETrue; |
|
67 iPath = NULL; |
|
68 iName = NULL; |
|
69 iFormat = CStifLogger::ETxt; |
|
70 iOutput = CStifLogger::EFile; |
|
71 iOverwrite = ETrue; |
|
72 iXML = EFalse; |
|
73 } |
|
74 |
|
75 ~TTestReportSettings(){ delete iPath; delete iName; } |
|
76 |
|
77 public: |
|
78 |
|
79 TBool iCreateTestReport; // Test report creation mode |
|
80 HBufC* iPath; // Test report path |
|
81 HBufC* iName; // Test report name |
|
82 CStifLogger::TLoggerType iFormat; // Test report file type |
|
83 CStifLogger::TOutput iOutput; // Test report output |
|
84 TBool iOverwrite; // Test report overwrite |
|
85 TBool iXML; // Test report in xml format |
|
86 |
|
87 }; |
|
88 |
|
89 class CRebootParams |
|
90 :public CBase |
|
91 { |
|
92 public: // Constructors and destructor |
|
93 |
|
94 /** |
|
95 * NewL is two-phased constructor. |
|
96 */ |
|
97 static CRebootParams* NewL(); |
|
98 |
|
99 /** |
|
100 * Destructor of CTestEngineServer. |
|
101 */ |
|
102 ~CRebootParams(); |
|
103 |
|
104 // Setters |
|
105 void SetTestModuleNameL( const TDesC& aName ); |
|
106 void SetTestCaseFileNameL( const TDesC& aName ); |
|
107 void SetTestCaseTitleL( const TDesC& aName ); |
|
108 void SetTestCaseStateL( const TDesC& aName ); |
|
109 |
|
110 |
|
111 private: // New functions |
|
112 |
|
113 /** |
|
114 * C++ default constructor. |
|
115 */ |
|
116 CRebootParams(); |
|
117 |
|
118 /** |
|
119 * By default Symbian OS constructor is private. |
|
120 */ |
|
121 void ConstructL(); |
|
122 |
|
123 public: // Data |
|
124 TInt iCaseNumber; |
|
125 TInt iStateCode; |
|
126 |
|
127 TPtrC iTestModule; |
|
128 TPtrC iTestCaseFile; |
|
129 TPtrC iTestCaseTitle; |
|
130 TPtrC iStateName; |
|
131 |
|
132 private: // Data |
|
133 HBufC* iTestModuleBuf; |
|
134 HBufC* iTestCaseFileBuf; |
|
135 HBufC* iTestCaseTitleBuf; |
|
136 HBufC* iStateNameBuf; |
|
137 |
|
138 }; |
|
139 |
|
140 // FUNCTION PROTOTYPES |
|
141 // None |
|
142 |
|
143 // FORWARD DECLARATIONS |
|
144 class CTestModuleController; |
|
145 class CTestReport; |
|
146 |
|
147 // CLASS DECLARATION |
|
148 |
|
149 // DESCRIPTION |
|
150 // CTestEngineServer is a server class. |
|
151 // Contains an object container index which provides subsessions with object |
|
152 // containers. |
|
153 |
|
154 class CTestEngineServer |
|
155 : public CServer2 |
|
156 { |
|
157 public: // Enumerations |
|
158 enum { ETestEngineServerPriority = CActive::EPriorityHigh }; |
|
159 |
|
160 private: // Enumerations |
|
161 |
|
162 public: // Constructors and destructor |
|
163 |
|
164 /** |
|
165 * NewL is two-phased constructor. |
|
166 */ |
|
167 static CTestEngineServer* NewL(); |
|
168 |
|
169 /** |
|
170 * Destructor of CTestEngineServer. |
|
171 */ |
|
172 ~CTestEngineServer(); |
|
173 |
|
174 public: // New functions |
|
175 |
|
176 /** |
|
177 * ThreadFunction is used to create new thread. |
|
178 */ |
|
179 static TInt ThreadFunction( TAny* aStarted ); |
|
180 |
|
181 /** |
|
182 * Return object container, guaranteed to produce object containers with |
|
183 * unique ids within the server. |
|
184 */ |
|
185 CObjectCon* NewContainerL(); |
|
186 |
|
187 /** |
|
188 * Delete container. |
|
189 */ |
|
190 void DeleteContainer( CObjectCon* aContainer ); |
|
191 |
|
192 /** |
|
193 * Inform Server that session is closed. |
|
194 */ |
|
195 void SessionClosed(); |
|
196 |
|
197 /** |
|
198 * PanicServer panics the CTestEngineServer |
|
199 */ |
|
200 static void PanicServer( TTestEnginePanic aPanic ); |
|
201 |
|
202 /** |
|
203 * Return the pointer to iLogger |
|
204 */ |
|
205 CStifLogger* Logger(); |
|
206 |
|
207 public: // Functions from base classes |
|
208 |
|
209 /** |
|
210 * NewSessionL creates new CTestEngineServer session. |
|
211 */ |
|
212 CSession2* NewSessionL( const TVersion &aVersion, |
|
213 const RMessage2& aMessage ) const; |
|
214 |
|
215 protected: // New functions |
|
216 |
|
217 protected: // Functions from base classes |
|
218 |
|
219 private: // New functions |
|
220 |
|
221 /** |
|
222 * C++ default constructor. |
|
223 */ |
|
224 CTestEngineServer(); |
|
225 |
|
226 /** |
|
227 * By default Symbian OS constructor is private. |
|
228 */ |
|
229 void ConstructL(); |
|
230 |
|
231 |
|
232 public: // Data |
|
233 // Test report settings |
|
234 TTestReportSettings iTestReportSettings; |
|
235 |
|
236 // Logger overwrite settings |
|
237 TLoggerSettings iLoggerSettings; |
|
238 |
|
239 protected: // Data |
|
240 |
|
241 private: // Data |
|
242 // The server has an object container index which |
|
243 // creates an object container for each session |
|
244 CObjectConIx* iContainerIndex; |
|
245 |
|
246 // Logger instance |
|
247 CStifLogger* iLogger; |
|
248 |
|
249 // Container count |
|
250 TInt iSessionCount; |
|
251 |
|
252 public: // Friend classes |
|
253 |
|
254 protected: // Friend classes |
|
255 |
|
256 private: // Friend classes |
|
257 |
|
258 }; |
|
259 |
|
260 // DESCRIPTION |
|
261 // Class used to store version information of test module. |
|
262 // iTestModuleName field keeps name of test module dll |
|
263 // iVersion keeps version of test module dll |
|
264 |
|
265 struct TTestModuleVersionInfo |
|
266 { |
|
267 TFileName iTestModuleName; |
|
268 TInt iMajor; |
|
269 TInt iMinor; |
|
270 TInt iBuild; |
|
271 }; |
|
272 |
|
273 // DESCRIPTION |
|
274 // CTestEngine is a session class. |
|
275 // Session for the CTestEngineServer server, to a single client-side session |
|
276 // a session may own any number of CCounter objects |
|
277 |
|
278 class CTestCase; |
|
279 class CTestEventController; |
|
280 class CTestEngine |
|
281 : public CSession2 |
|
282 { |
|
283 public: // Enumerations |
|
284 |
|
285 private: // Enumerations |
|
286 |
|
287 public: // Constructors and destructor |
|
288 |
|
289 /** |
|
290 * NewL is two-phased constructor. |
|
291 */ |
|
292 static CTestEngine* NewL( CTestEngineServer* aServer ); |
|
293 |
|
294 /** |
|
295 * Leave with notify |
|
296 */ |
|
297 void LeaveWithNotifyL( TInt aCode, const TDesC& aText ); |
|
298 |
|
299 /** |
|
300 * If error leave with notify |
|
301 */ |
|
302 void LeaveIfErrorWithNotify( TInt aCode, const TDesC& aText ); |
|
303 |
|
304 /** |
|
305 * Leave with notify |
|
306 */ |
|
307 void LeaveWithNotifyL( TInt aCode ); |
|
308 |
|
309 /** |
|
310 * If error leave with notify |
|
311 */ |
|
312 void LeaveIfErrorWithNotify( TInt aCode ); |
|
313 |
|
314 /** |
|
315 * Close the session to CTestEngineServer. |
|
316 */ |
|
317 void CloseSession(); |
|
318 |
|
319 public: // New functions |
|
320 |
|
321 /** |
|
322 * PanicClient panics the user of CTestEngine ( RTestEngine user ) |
|
323 */ |
|
324 void PanicClient( TTestEnginePanic aPanic, const RMessage2& aMessage ) const; |
|
325 |
|
326 /** |
|
327 * NumResources is used to provide reserver resources to client. |
|
328 */ |
|
329 void NumResources( const RMessage2& aMessage ); |
|
330 |
|
331 /** |
|
332 * Return the number of resources owned by the session. |
|
333 * Required by CSession if derived class implements resource |
|
334 * mark-start and mark-end protocol. |
|
335 */ |
|
336 TInt CountResources(); |
|
337 |
|
338 /** |
|
339 * Callback to inform that enumeration of test cases is completed |
|
340 */ |
|
341 void EnumerationCompleted( TInt aCount, TInt aError = KErrNone ); |
|
342 |
|
343 |
|
344 /** |
|
345 * Callback to check state event status. |
|
346 */ |
|
347 TBool IsStateEventAndSet( const TName& aEventName ); |
|
348 |
|
349 /** |
|
350 * Callback to control events. |
|
351 */ |
|
352 CTestEventController* CtlEventL( const TEventIf& aEvent, |
|
353 TRequestStatus& aStatus ); |
|
354 |
|
355 /** |
|
356 * Return the pointer to CStifLogger owned by CTestEngineServer |
|
357 */ |
|
358 CStifLogger* Logger(); |
|
359 |
|
360 /** |
|
361 * Return testcases. |
|
362 */ |
|
363 RPointerArray<CTestCase>& TestCaseArray(){ return iTestCaseArray; } |
|
364 |
|
365 /** |
|
366 * Return client events. |
|
367 */ |
|
368 RPointerArray<TEventMsg>& ClientEvents(){ return iClientEvents; } |
|
369 |
|
370 /** |
|
371 * ErrorPrint print errors. This version is used to print engine own |
|
372 * errors. |
|
373 */ |
|
374 void ErrorPrint( const TInt aPriority, |
|
375 TPtrC aError ); |
|
376 |
|
377 /** |
|
378 * ErrorPrint print errors. This version is used to forward errors. |
|
379 */ |
|
380 void ErrorPrint( TErrorNotificationPckg aError ); |
|
381 |
|
382 /** |
|
383 * Write the Reboot related information to file. |
|
384 */ |
|
385 TInt WriteRebootParams( TTestInfo& aTestInfo, |
|
386 TInt& aCode, TDesC& aName ); |
|
387 |
|
388 /** |
|
389 * Read the Reboot related information from the file. |
|
390 */ |
|
391 TInt ReadRebootParams( TTestInfo& aTestInfo, |
|
392 TDes& aStateDes, |
|
393 TInt& aState ); |
|
394 |
|
395 /** |
|
396 * Pause all test case(s) which are/is running. |
|
397 */ |
|
398 void PauseAllTestCases(); |
|
399 |
|
400 /** |
|
401 * Flush ATS logger buffers. |
|
402 */ |
|
403 void FlushAtsLogger(); |
|
404 |
|
405 /** |
|
406 * Get device reset module's DLL name. |
|
407 */ |
|
408 TPtrC GetDeviceResetDllName(); |
|
409 |
|
410 /** |
|
411 * Get measurements related information. Returns is measurement disable. |
|
412 */ |
|
413 TInt StifMeasurement(); |
|
414 |
|
415 /** |
|
416 * For Recovering from serious testmodulecrash situations (KErrserverTerminated (-15)) |
|
417 * Clones TestModuleController |
|
418 */ |
|
419 void TestModuleCrash( CTestModuleController* aTestModuleController ); |
|
420 |
|
421 /** |
|
422 * Executes command received from test case. |
|
423 * It was created to allow test case to kill itself. |
|
424 */ |
|
425 void ExecuteCommandL(TCommand aCommand, TDesC8& aParamsPckg); |
|
426 |
|
427 /** |
|
428 * Returns new index for test module controller. |
|
429 * This number is appended to module controller name. |
|
430 * This method is used when option to run every test case in separate |
|
431 * process is set to on. |
|
432 */ |
|
433 TInt GetIndexForNewTestModuleController(void); |
|
434 |
|
435 /** |
|
436 * Return free module controller specified by given parameter. |
|
437 * If it can't be found, new one will be created. |
|
438 */ |
|
439 CTestModuleController* GetFreeOrCreateModuleControllerL(TTestInfo& aTestInfo, |
|
440 CTestModuleController** aRealModuleController); |
|
441 |
|
442 public: // Functions from base classes |
|
443 |
|
444 /** |
|
445 * ServiceL handles the messages to CTestEngineServer |
|
446 */ |
|
447 virtual void ServiceL( const RMessage2& aMessage ); |
|
448 |
|
449 protected: // New functions |
|
450 |
|
451 protected: // Functions from base classes |
|
452 |
|
453 private: // New functions |
|
454 |
|
455 /** |
|
456 * C++ default constructor. |
|
457 */ |
|
458 CTestEngine(); |
|
459 |
|
460 /** |
|
461 * By default Symbian OS constructor is private. |
|
462 */ |
|
463 void ConstructL( CTestEngineServer* aServer ); |
|
464 |
|
465 /** |
|
466 * DispatchMessageL handles the messages to CTestEngineServer |
|
467 */ |
|
468 void DispatchMessageL( const RMessage2& aMessage ); |
|
469 |
|
470 /** |
|
471 * Get module controller by name |
|
472 */ |
|
473 CTestModuleController* ModuleControllerByName( |
|
474 const TName& aModuleName ); |
|
475 |
|
476 /** |
|
477 * Initialize test report and logger's overwrite variables |
|
478 */ |
|
479 void InitTestReportAndLoggerVarL(); |
|
480 |
|
481 /** |
|
482 * Initialize the Test Engine. |
|
483 */ |
|
484 void InitEngineL( const RMessage2& aMessage ); |
|
485 |
|
486 /** |
|
487 * Parse Test Engine defaults from STIF initialization |
|
488 * file. |
|
489 */ |
|
490 void ReadEngineDefaultsL( CStifParser* aParser, |
|
491 CSTIFTestFrameworkSettings* aSettings ); |
|
492 |
|
493 /** |
|
494 * Set parsed logger's settings to TestEngine side. |
|
495 */ |
|
496 void SetLoggerSettings( TLoggerSettings& aLoggerSettings ); |
|
497 |
|
498 /** |
|
499 * Parse Test modules and module information from STIFTestFramework |
|
500 * initialization file. |
|
501 */ |
|
502 void ReadTestModulesL( CStifParser* aParser ); |
|
503 |
|
504 /** |
|
505 * |
|
506 */ |
|
507 void TestModuleConfigFileL( CTestModuleController* aModule, |
|
508 CStifSectionParser* aSectionParser, |
|
509 TDesC& aTag ); |
|
510 |
|
511 /** |
|
512 * Sets attributes to Test Framework |
|
513 */ |
|
514 void SetAttributeL( const RMessage2& aMessage ); |
|
515 |
|
516 /** |
|
517 * Adds new Test Module |
|
518 */ |
|
519 void AddTestModuleL( const RMessage2& aMessage ); |
|
520 |
|
521 /** |
|
522 * Removes Test Module |
|
523 */ |
|
524 TInt RemoveTestModuleL( const RMessage2& aMessage ); |
|
525 |
|
526 /** |
|
527 * Close Test Engine |
|
528 */ |
|
529 void CloseTestEngineL( TUint aHandle ); |
|
530 |
|
531 /** |
|
532 * Adds new config file to Test Module |
|
533 */ |
|
534 void AddConfigFileL( const RMessage2& aMessage ); |
|
535 |
|
536 /** |
|
537 * Removes config file from test module |
|
538 */ |
|
539 void RemoveConfigFileL( const RMessage2& aMessage ); |
|
540 |
|
541 /** |
|
542 * Enumerates test cases |
|
543 */ |
|
544 void EnumerateTestCasesL( const RMessage2& aMessage ); |
|
545 |
|
546 /** |
|
547 * Get test cases |
|
548 */ |
|
549 void GetTestCasesL( const RMessage2& aMessage ); |
|
550 |
|
551 /** |
|
552 * Cancel outstanding asynchronous request |
|
553 */ |
|
554 void CancelAsyncRequest( const RMessage2& aMessage ); |
|
555 |
|
556 /** |
|
557 * Event system control. |
|
558 */ |
|
559 void EventControlL( const RMessage2& aMessage ); |
|
560 |
|
561 /** |
|
562 * Update state event list. |
|
563 */ |
|
564 void UpdateEventL( const TEventIf& aEvent ); |
|
565 |
|
566 /** |
|
567 * Handles error notifications |
|
568 */ |
|
569 void HandleErrorNotificationL( const RMessage2& iMessage ); |
|
570 |
|
571 /** |
|
572 * Get Logger's overwrite parameters |
|
573 */ |
|
574 void LoggerSettings( const RMessage2& iMessage ); |
|
575 |
|
576 /** |
|
577 * Close logger settings |
|
578 */ |
|
579 void CloseLoggerSettings(); |
|
580 |
|
581 /** |
|
582 * Process error queue. |
|
583 */ |
|
584 void ProcessErrorQueue(); |
|
585 |
|
586 /** |
|
587 * Resolve the correct CTestCase object |
|
588 */ |
|
589 CTestCase* TestCaseByHandle( TUint aHandle, const RMessage2& aMessage ); |
|
590 |
|
591 /** |
|
592 * Create CTestCase subsession. |
|
593 */ |
|
594 void NewTestCaseL( const RMessage2& aMessage ); |
|
595 |
|
596 /** |
|
597 * Destroy the created CTestCase subsession. |
|
598 * Cannot fail - can panic client. |
|
599 */ |
|
600 void DeleteTestCase( TUint aHandle ); |
|
601 |
|
602 /** |
|
603 * Parse the Reboot related information from the file. |
|
604 */ |
|
605 TInt ParseRebootParamsL(); |
|
606 |
|
607 /** |
|
608 * Set measurements related information, enable measurement. |
|
609 */ |
|
610 TInt EnableStifMeasurement( const TDesC& aInfoType ); |
|
611 |
|
612 /** |
|
613 * Set measurements related information, disable measurement. |
|
614 */ |
|
615 TInt DisableStifMeasurement( const TDesC& aInfoType ); |
|
616 |
|
617 /** |
|
618 * Parse and search for module info and fill list of modules. |
|
619 */ |
|
620 void ParseTestModulesL(CStifParser* aParser, CTestModuleList* aModuleList, const TDesC& aSectionStart, const TDesC& aSectionEnd); |
|
621 |
|
622 /** |
|
623 * Add test case info to test report. |
|
624 */ |
|
625 TInt AddTestCaseToTestReport(const RMessage2& aMessage); |
|
626 |
|
627 public: // Data |
|
628 |
|
629 protected: // Data |
|
630 |
|
631 private: // Data |
|
632 |
|
633 // Test module array |
|
634 RPointerArray<CTestModuleController> iModules; |
|
635 |
|
636 // Object container for this session |
|
637 CObjectCon* iContainer; |
|
638 |
|
639 // Object index which stores objects (CTestCase instances) |
|
640 // for this session |
|
641 CObjectIx* iTestCases; |
|
642 |
|
643 // Object index which stores objects (CTestEngineSubSession instances) |
|
644 // for this session |
|
645 CObjectIx* iTestEngineSubSessions; |
|
646 |
|
647 // Array of CTestCase instances |
|
648 RPointerArray<CTestCase> iTestCaseArray; |
|
649 |
|
650 // Pointer to owning server |
|
651 CTestEngineServer* iTestEngineServer; |
|
652 |
|
653 // Test Report |
|
654 CTestReport* iTestReport; |
|
655 // Test Report Mode |
|
656 TUint iReportMode; |
|
657 // Test Report Output Type |
|
658 TUint iReportOutput; |
|
659 |
|
660 // Device reset module's DLL name(Reboot) |
|
661 HBufC* iDeviceResetDllName; |
|
662 |
|
663 // Total number of resources allocated |
|
664 TInt iResourceCount; |
|
665 |
|
666 // Test Engine's initialization file |
|
667 HBufC* iIniFile; |
|
668 |
|
669 // RMessage for ongoing operation |
|
670 RMessage2 iEnumerationMessage; |
|
671 |
|
672 // Test case count used in EnumerateTestCases |
|
673 TInt iCaseCount; |
|
674 // Error code used in EnumerateTestCases |
|
675 TInt iEnumError; |
|
676 |
|
677 // Tell if message can be completed |
|
678 TBool iComplete; |
|
679 |
|
680 // Error code for complete of message |
|
681 TInt iReturn; |
|
682 |
|
683 // State event Array |
|
684 RPointerArray<HBufC> iStateEvents; |
|
685 |
|
686 // Client event Array |
|
687 RPointerArray<TEventMsg> iClientEvents; |
|
688 |
|
689 // Number of enumerated test modules currently |
|
690 TInt iEnumerateModuleCount; |
|
691 |
|
692 // RMessage for error notifications |
|
693 TBool iErrorMessageAvailable; |
|
694 RMessage2 iErrorMessage; |
|
695 RArray<TErrorNotification> iErrorQueue; |
|
696 |
|
697 // Reboot path definition |
|
698 HBufC* iRebootPath; |
|
699 // Reboot file name definition |
|
700 HBufC* iRebootFilename; |
|
701 // Reboot default path definition |
|
702 TPtrC iRebootDefaultPath; |
|
703 // Reboot default file name definition |
|
704 TPtrC iRebootDefaultFilename; |
|
705 |
|
706 // Handle to Setting server. |
|
707 RSettingServer iSettingServer; |
|
708 |
|
709 CRebootParams* iRebootParams; |
|
710 TBool iIsTestReportGenerated; |
|
711 |
|
712 // For indication is measurement disable |
|
713 TInt iDisableMeasurement; |
|
714 |
|
715 // Default timeout value. 0 - no timeout value |
|
716 TInt64 iDefaultTimeout; |
|
717 |
|
718 // Counter for created TestModuleControllers |
|
719 TInt iIndexTestModuleControllers; |
|
720 |
|
721 // Is this UI testing? |
|
722 // If yes, then Test Engine works in a specific way. |
|
723 // It creates new process for every test scripter's test case |
|
724 // and deletes it after test case has finished. |
|
725 TBool iUITestingSupport; |
|
726 |
|
727 // Should every test case be executed in separate process? |
|
728 // This option is similar to iUITestingSupport, however |
|
729 // it does not delete the process after test case is finished. |
|
730 TBool iSeparateProcesses; |
|
731 |
|
732 //RPointerArray of versions of test modules |
|
733 RPointerArray<TTestModuleVersionInfo> iTestModulesVersionInfo; |
|
734 |
|
735 public: // Friend classes |
|
736 |
|
737 protected: // Friend classes |
|
738 |
|
739 private: // Friend classes |
|
740 |
|
741 }; |
|
742 |
|
743 // DESCRIPTION |
|
744 // CTestEngineSubSession represents a subsession object in the CTestEngineServer. |
|
745 // A session may own any number of CTestEngineSubSession objects |
|
746 |
|
747 class CTestEngineSubSession |
|
748 : public CObject |
|
749 { |
|
750 public: // Enumerations |
|
751 |
|
752 private: // Enumerations |
|
753 |
|
754 public: // Constructors and destructor |
|
755 |
|
756 /** |
|
757 * NewL is two-phased constructor. |
|
758 */ |
|
759 static CTestEngineSubSession* NewL( CTestEngine* aEngine ); |
|
760 |
|
761 /** |
|
762 * Destructor of CTestCase. |
|
763 */ |
|
764 ~CTestEngineSubSession(); |
|
765 |
|
766 public: // New functions |
|
767 |
|
768 public: // Functions from base classes |
|
769 |
|
770 protected: // New functions |
|
771 |
|
772 protected: // Functions from base classes |
|
773 |
|
774 private: // New functions |
|
775 |
|
776 /** |
|
777 * C++ default constructor. |
|
778 */ |
|
779 CTestEngineSubSession( CTestEngine* aEngine); |
|
780 |
|
781 /** |
|
782 * By default Symbian OS constructor is private. |
|
783 */ |
|
784 void ConstructL(); |
|
785 public: // Data |
|
786 |
|
787 protected: // Data |
|
788 |
|
789 // Session owning us |
|
790 CTestEngine* iTestEngine; |
|
791 |
|
792 private: // Data |
|
793 |
|
794 public: // Friend classes |
|
795 |
|
796 protected: // Friend classes |
|
797 |
|
798 private: // Friend classes |
|
799 }; |
|
800 |
|
801 |
|
802 // DESCRIPTION |
|
803 // CTestCase represents a subsession object in the CTestEngineServer. |
|
804 // A session may own any number of CTestCase objects |
|
805 |
|
806 class CTestProgressNotifier; |
|
807 class CTestCaseController; |
|
808 class CTestEventNotifier; |
|
809 class CTestRemoteCmdNotifier; |
|
810 class CTestCommandNotifier; |
|
811 class CTestCase |
|
812 : public CObject |
|
813 { |
|
814 public: // Enumerations |
|
815 |
|
816 private: // Enumerations |
|
817 |
|
818 public: // Constructors and destructor |
|
819 |
|
820 /** |
|
821 * NewL is two-phased constructor. |
|
822 */ |
|
823 static CTestCase* NewL( CTestEngine* aEngine, |
|
824 CTestModuleController* aModuleController, |
|
825 CTestReport* aTestReport, |
|
826 TTestInfo& aTestInfo, |
|
827 CTestModuleController* aRealModuleController); |
|
828 |
|
829 /** |
|
830 * Destructor of CTestCase. |
|
831 */ |
|
832 ~CTestCase(); |
|
833 |
|
834 /** |
|
835 * Close Test Case. |
|
836 */ |
|
837 void CloseTestCase(); |
|
838 |
|
839 public: // New functions |
|
840 |
|
841 /** |
|
842 * Run test case. |
|
843 */ |
|
844 void RunTestCaseL( const RMessage2& aMessage ); |
|
845 |
|
846 /** |
|
847 * Suspend the test case execution. |
|
848 */ |
|
849 TInt Pause(); |
|
850 |
|
851 /** |
|
852 * Resume the suspended test case execution. |
|
853 */ |
|
854 TInt Resume(); |
|
855 |
|
856 /** |
|
857 * Notify progress from Test Module. |
|
858 */ |
|
859 void NotifyProgressL( const RMessage2& aMessage ); |
|
860 |
|
861 /** |
|
862 * Notify remote commands from Test Module. |
|
863 */ |
|
864 void NotifyRemoteTypeL( const RMessage2& aMessage ); |
|
865 |
|
866 /** |
|
867 * Notify remote commands from Test Module. |
|
868 */ |
|
869 void NotifyRemoteMsgL( const RMessage2& aMessage ); |
|
870 |
|
871 /** |
|
872 * Cancel outstanding asynchronous request. |
|
873 */ |
|
874 void CancelAsyncRequest( const RMessage2& aMessage ); |
|
875 |
|
876 /** |
|
877 * Return the name of Test Module. |
|
878 */ |
|
879 const TDesC& ModuleName(); |
|
880 |
|
881 /** |
|
882 * For event control. |
|
883 */ |
|
884 void CtlEvent( const TEventIf& aEvent, TRequestStatus& aStatus ); |
|
885 |
|
886 /** |
|
887 * Check if CtlEvent should be called |
|
888 */ |
|
889 TBool CheckCtlEvent( const TEventIf& aEvent ); |
|
890 |
|
891 /** |
|
892 * Executes command received from test case. |
|
893 */ |
|
894 void ExecuteCommandL(TCommand aCommand, TDesC8& aParamsPckg); |
|
895 |
|
896 /** |
|
897 * Return module controller and real module controller. |
|
898 */ |
|
899 CTestModuleController* GetModuleControllers(CTestModuleController** aRealModuleController); |
|
900 |
|
901 /** |
|
902 * Set new module controller for test case (only in case when original controller crashed). |
|
903 */ |
|
904 void ResetModuleController(CTestModuleController* aModuleController); |
|
905 |
|
906 /** |
|
907 * Set new real module controller for test case (only in case when original controller crashed). |
|
908 */ |
|
909 void ResetRealModuleController(CTestModuleController* aRealModuleController); |
|
910 |
|
911 public: // Functions from base classes |
|
912 |
|
913 protected: // New functions |
|
914 |
|
915 protected: // Functions from base classes |
|
916 |
|
917 private: // New functions |
|
918 |
|
919 /** |
|
920 * C++ default constructor. |
|
921 */ |
|
922 CTestCase( CTestEngine* aEngine, |
|
923 CTestModuleController* aModuleController, |
|
924 TTestInfo& aTestInfo, |
|
925 CTestModuleController* aRealModuleController); |
|
926 |
|
927 /** |
|
928 * By default Symbian OS constructor is private. |
|
929 */ |
|
930 void ConstructL( CTestReport* aTestReport, TTestInfo& aTestInfo ); |
|
931 |
|
932 /** |
|
933 * Return the pointer to CStifLogger owned by CTestEngineServer |
|
934 */ |
|
935 CStifLogger* Logger(); |
|
936 |
|
937 public: // Data |
|
938 |
|
939 protected: // Data |
|
940 |
|
941 // Session owning us |
|
942 CTestEngine* iTestEngine; |
|
943 |
|
944 private: // Data |
|
945 |
|
946 // Test Module |
|
947 CTestModuleController* iTestModule; |
|
948 |
|
949 // Test case controller |
|
950 CTestCaseController* iTestCaseController; |
|
951 |
|
952 // Notifier for print |
|
953 CTestProgressNotifier* iTestCasePrint; |
|
954 |
|
955 // Notifier for event |
|
956 CTestEventNotifier* iTestCaseEvent; |
|
957 |
|
958 // Notifier for remote commands |
|
959 CTestRemoteCmdNotifier* iTestCaseRemoteCmd; |
|
960 |
|
961 // Handle to RTestServer |
|
962 RTestServer iTestServer; |
|
963 |
|
964 // Handle to RTestExecution |
|
965 RTestExecution iTestExecution; |
|
966 |
|
967 // Notifier for commands |
|
968 CTestCommandNotifier* iTestCaseCommand; |
|
969 |
|
970 // Real Test Module (when test module controller is testscripter) |
|
971 CTestModuleController* iRealModuleController; |
|
972 |
|
973 public: // Friend classes |
|
974 |
|
975 protected: // Friend classes |
|
976 |
|
977 private: // Friend classes |
|
978 |
|
979 }; |
|
980 |
|
981 #endif // TEST_ENGINE_H |
|
982 |
|
983 // End of File |