CTestModuleIf Class Reference

class CTestModuleIf : public CBase

Inherits from

Public Member Functions
TInt AddInterferenceThread ( RThread )
IMPORT_C TInt CancelEvent ( TEventIf &, TRequestStatus *)
IMPORT_C TInt CheckAllowResult ( TInt )
TInt Command ( TCommand , const TDesC8 &)
IMPORT_C TInt Event ( TEventIf &)
IMPORT_C void Event ( TEventIf &, TRequestStatus &)
IMPORT_C TInt GetMeasurementOptions ( TInt &)
IMPORT_C TInt GetStoredState ( TInt &, TName &)
IMPORT_C const TDesC & GetTestCaseArguments ()
IMPORT_C void GetTestCaseTitleL ( TDes &)
IMPORT_C CUiEnvProxy * GetUiEnvProxy ()
TInt HandleMeasurementProcess ( CSTIFTestMeasurement::TStifMeasurementStruct )
IMPORT_C CTestModuleIf * NewL ( CTestThreadContainer *, CTestModuleBase *)
IMPORT_C void Printf (const TInt , const TDesC &, TRefByValue < const TDesC >, ...)
IMPORT_C TInt Reboot ( TInt )
IMPORT_C void RemoteReceive ( TDes &, TRequestStatus &)
IMPORT_C void RemoteReceiveCancel ()
IMPORT_C TInt RemoteSend (const TDesC &)
TInt RemoveInterferenceThread ( RThread )
IMPORT_C TInt ResetAllowResult ()
IMPORT_C TInt SendTestModuleVersion ( TVersion , TFileName )
IMPORT_C TInt SendTestModuleVersion ( TVersion &, const TDesC &, TBool )
IMPORT_C TInt SetAllowResult ( TInt )
IMPORT_C TInt SetBehavior ( TTestBehavior , TAny *)
IMPORT_C void SetExitReason (const CTestModuleIf::TExitReason , const TInt )
IMPORT_C TInt StifMacroError ( TInt , const TText8 *, const char *, TInt , TInt , TInt , TInt , TInt , TInt , TInt )
IMPORT_C TInt StopExecution ( TStopExecutionType , TInt )
IMPORT_C TInt StoreState ( TInt , TName &)
IMPORT_C TBool UITesting ()
Private Member Functions
CTestModuleIf ( CTestThreadContainer *)
~CTestModuleIf ()
void ConstructL ( CTestModuleBase *)
TBool IsServerAlive ()
Inherited Functions
CBase::CBase()
CBase::Delete(CBase *)
CBase::Extension_(TUint,TAny *&,TAny *)
CBase::operator new(TUint)
CBase::operator new(TUint,TAny *)
CBase::operator new(TUint,TLeave)
CBase::operator new(TUint,TLeave,TUint)
CBase::operator new(TUint,TUint)
CBase::~CBase()
Public Member Enumerations
enum TExitReason { ENormal , EPanic , EException }
enum TRebootType {
EDefaultReset  = 0, EKernelReset , EDeviceReset0  = 100, EDeviceReset1 , EDeviceReset2 , EDeviceReset3 , EDeviceReset4 , EDeviceReset5
}
enum TTestBehavior { ETestLeaksMem  = 0x00000001, ETestLeaksRequests  = 0x00000002, ETestLeaksHandles  = 0x00000004, EOOMDisableLeakChecks  = 0x00000008 }
Private Attributes
TInt iAllowTestCaseResultsCount
TBool iIsRebootReady
TInt iStoreStateCounter
TInt iTestCaseResults
CTestThreadContainer * iTestExecution

Constructor & Destructor Documentation

CTestModuleIf(CTestThreadContainer *)

CTestModuleIf ( CTestThreadContainer * aTestExecution ) [private]

C++ default constructor.

Parameters

CTestThreadContainer * aTestExecution

~CTestModuleIf()

~CTestModuleIf ( ) [private]

Destructor is also private. ONLY friend CTestModuleBase can delete CTestModuleIf .

Member Functions Documentation

AddInterferenceThread(RThread)

TInt AddInterferenceThread ( RThread aSTIFTestInterference )

Add thread handle to Array. Via array can handle test interference thread's kill in panic etc. cases

Parameters

RThread aSTIFTestInterference

CancelEvent(TEventIf &, TRequestStatus *)

IMPORT_C TInt CancelEvent ( TEventIf & aEvent,
TRequestStatus * aStatus
)

Cancel asynchronous event command.

Parameters

TEventIf & aEvent
TRequestStatus * aStatus

CheckAllowResult(TInt)

IMPORT_C TInt CheckAllowResult ( TInt aResult )

This is mainly used by STIF's TAL-TA5L macros internally. Check is macros result allowed result.

Parameters

TInt aResult

Command(TCommand, const TDesC8 &)

TInt Command ( TCommand aCommand,
const TDesC8 & aParamsPckg
)

Command function is used to send command to test engine. It was created to provide possibility to kill test case by itself.

Parameters

TCommand aCommand
const TDesC8 & aParamsPckg

ConstructL(CTestModuleBase *)

void ConstructL ( CTestModuleBase * aTestModule ) [private]

By default Symbian OS constructor is private.

Parameters

CTestModuleBase * aTestModule

Event(TEventIf &)

IMPORT_C TInt Event ( TEventIf & aEvent )

Event function is used to control and use the event system. TEvent &aEvent encapsulates the request type and the event name, see StifTestEventInterface.h for more information. This method is implemented in Test Module Server and the Test Module can call it to control the event system.

Parameters

TEventIf & aEvent

Event(TEventIf &, TRequestStatus &)

IMPORT_C void Event ( TEventIf & aEvent,
TRequestStatus & aStatus
)

Asynchronous overload function for the previous. Only one asynchronous Event call can be active concurrently. Second concurrent call will block until first one is completed.

Parameters

TEventIf & aEvent
TRequestStatus & aStatus

GetMeasurementOptions(TInt &)

IMPORT_C TInt GetMeasurementOptions ( TInt & aOptions )

Get measurement option(s) given from initialization file etc.

Parameters

TInt & aOptions

GetStoredState(TInt &, TName &)

IMPORT_C TInt GetStoredState ( TInt & aCode,
TName & aName
)

Get state after reboot (stored with StoreState).

Parameters

TInt & aCode
TName & aName

GetTestCaseArguments()

IMPORT_C const TDesC & GetTestCaseArguments ( ) const

Get test case execution arguments

GetTestCaseTitleL(TDes &)

IMPORT_C void GetTestCaseTitleL ( TDes & aTestCaseTitle )

GetTestCaseTitleL function is used to obtain test case title.

Parameters

TDes & aTestCaseTitle

GetUiEnvProxy()

IMPORT_C CUiEnvProxy * GetUiEnvProxy ( )

Gets UIEnvProxy

HandleMeasurementProcess(CSTIFTestMeasurement::TStifMeasurementStruct)

TInt HandleMeasurementProcess ( CSTIFTestMeasurement::TStifMeasurementStruct aSTIFMeasurementInfo )

With this can be stored information about test measurement to TestServer space.

Parameters

CSTIFTestMeasurement::TStifMeasurementStruct aSTIFMeasurementInfo

IsServerAlive()

TBool IsServerAlive ( ) [private]

Check that server is alive.

NewL(CTestThreadContainer *, CTestModuleBase *)

IMPORT_C CTestModuleIf * NewL ( CTestThreadContainer * aExecutionSession,
CTestModuleBase * aTestModule
) [static]

Two-phased constructor.

Parameters

CTestThreadContainer * aExecutionSession
CTestModuleBase * aTestModule

Printf(const TInt, const TDesC &, TRefByValue< const TDesC >, ...)

IMPORT_C void Printf ( const TInt aPriority,
const TDesC & aDefinition,
TRefByValue < const TDesC > aFmt,
...
)

Printf is used to provide different information up to the UI that can be then printed e.g. to the Console Screen. The definition of data to be printed is copied to aDefinition. The aPriority tells how important information is returned. The priority can be used in the UI to decide if the information received from the Test Module will be discarded or not in the different performance situations. The priority is also used in the Test Module server and in the Test Engine to queue the Printf responses. This method is implemented in Test Module Server and the Test Module can call it to provide printable information to the UI.

Parameters

const TInt aPriority
const TDesC & aDefinition
TRefByValue < const TDesC > aFmt
...

Reboot(TInt)

IMPORT_C TInt Reboot ( TInt aType = EDefaultReset )

Reboot device, StoreState MUST have been called.

Parameters

TInt aType = EDefaultReset

RemoteReceive(TDes &, TRequestStatus &)

IMPORT_C void RemoteReceive ( TDes & aRemoteMsg,
TRequestStatus & aStatus
)

RemoteReceive function is used receive remote control protocol messages.

Parameters

TDes & aRemoteMsg
TRequestStatus & aStatus

RemoteReceiveCancel()

IMPORT_C void RemoteReceiveCancel ( )

RemoteReceiveCancel function is used cancel pending RemoteReceive.

RemoteSend(const TDesC &)

IMPORT_C TInt RemoteSend ( const TDesC & aRemoteMsg )

RemoteSend function is used send remote control protocol messages.

Parameters

const TDesC & aRemoteMsg

RemoveInterferenceThread(RThread)

TInt RemoveInterferenceThread ( RThread aSTIFTestInterference )

Remove thread handle from Array.Test interference thread is stopped and killed successfully

Parameters

RThread aSTIFTestInterference

ResetAllowResult()

IMPORT_C TInt ResetAllowResult ( )

Use with TAL, TA1L, TA2L, TA3L, TA4L and TA5L macros to reset allowed results. Reset allow result(s) given with SetAllowResult. In TestScripter cases this will be called automatically by STIF. Normal and Hardcoded cases this should be called by user.

SendTestModuleVersion(TVersion, TFileName)

IMPORT_C TInt SendTestModuleVersion ( TVersion aVersion,
TFileName aModuleName
)

SendTestModuleVersion method is used to pass version of test module to test engine

Parameters

TVersion aVersion
TFileName aModuleName

SendTestModuleVersion(TVersion &, const TDesC &, TBool)

IMPORT_C TInt SendTestModuleVersion ( TVersion & aVersion,
const TDesC & aModuleName,
TBool aNewVersion
)

SendTestModuleVersion method is used to pass version of test module to test engine. This version with 3 parameters were added because version with 2 parameters has arguments passed by value which is incorrect. So the third argument was added only to overload the method and enable test modules using "old" version (with 2 parameters) to work. Only this version (with three parameters) should be used.

Parameters

TVersion & aVersion
const TDesC & aModuleName
TBool aNewVersion

SetAllowResult(TInt)

IMPORT_C TInt SetAllowResult ( TInt aResult )

Use with TAL, TA1L, TA2L, TA3L, TA4L and TA5L macros to allow results. Set test case allow result given by user. In TestScripter cases allow result can set by 'allownextresult' or 'allowerrorcodes' keywords. In Normal and Hardcoded test modules allow result can be set with this method, reset should be done with ResetAllowResult method.

Parameters

TInt aResult

SetBehavior(TTestBehavior, TAny *)

IMPORT_C TInt SetBehavior ( TTestBehavior aType,
TAny * aPtr = NULL
)

Set test case behavior, e.g. allow memory leak, handle leak etc.

Parameters

TTestBehavior aType
TAny * aPtr = NULL

SetExitReason(const CTestModuleIf::TExitReason, const TInt)

IMPORT_C void SetExitReason ( const CTestModuleIf::TExitReason aExitReason,
const TInt aExitCode
)

SetExitReason function is used to set different crash reasons to acceptable test case result. Only one exit reason can be set at time. When function is called again, previous exit reason is removed and new one is set to acceptable exit reason.

Function is typically used to accept test case panics as "passed" test cases.

Test case that panics or gets exception is set to passed if aExitReason parameter matches with exit reason and aExitCode matches with panic code or exception type.

Parameters

const CTestModuleIf::TExitReason aExitReason
const TInt aExitCode

StifMacroError(TInt, const TText8 *, const char *, TInt, TInt, TInt, TInt, TInt, TInt, TInt)

IMPORT_C TInt StifMacroError ( TInt aMacroType,
const TText8 * aFile,
const char * aFunction,
TInt aLine,
TInt aResult = 0,
TInt aExpected1 = 0,
TInt aExpected2 = 0,
TInt aExpected3 = 0,
TInt aExpected4 = 0,
TInt aExpected5 = 0
)

This can be called from test module but it is recommended to use TL, T1L, T2L or T3L macro instead of this method. For more information see macro definitions above on this file.

Parameters

TInt aMacroType
const TText8 * aFile
const char * aFunction
TInt aLine
TInt aResult = 0
TInt aExpected1 = 0
TInt aExpected2 = 0
TInt aExpected3 = 0
TInt aExpected4 = 0
TInt aExpected5 = 0

StopExecution(TStopExecutionType, TInt)

IMPORT_C TInt StopExecution ( TStopExecutionType aType,
TInt aCode =  KErrNone
)

StopExecution function is used to stop the execution of test case.

Parameters

TStopExecutionType aType
TInt aCode =  KErrNone

StoreState(TInt, TName &)

IMPORT_C TInt StoreState ( TInt aCode,
TName & aName
)

Store state before reboot. MUST be called before calling Reboot() .

Parameters

TInt aCode
TName & aName

UITesting()

IMPORT_C TBool UITesting ( )

Checks if testserver supports UI testing

Member Enumerations Documentation

Enum TExitReason

Enumerators

ENormal
EPanic
EException

Enum TRebootType

Enumerators

EDefaultReset = 0
EKernelReset
EDeviceReset0 = 100
EDeviceReset1
EDeviceReset2
EDeviceReset3
EDeviceReset4
EDeviceReset5

Enum TTestBehavior

Enumerators

ETestLeaksMem = 0x00000001
ETestLeaksRequests = 0x00000002
ETestLeaksHandles = 0x00000004
EOOMDisableLeakChecks = 0x00000008

Member Data Documentation

TInt iAllowTestCaseResultsCount

TInt iAllowTestCaseResultsCount [private]

TBool iIsRebootReady

TBool iIsRebootReady [private]

TInt iStoreStateCounter

TInt iStoreStateCounter [private]

TInt iTestCaseResults

TInt iTestCaseResults [private]

CTestThreadContainer * iTestExecution

CTestThreadContainer * iTestExecution [private]