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