CTestModuleIf Class Reference

class CTestModuleIf : public CBase

Inherits from

Public Member Functions
TInt AddInterferenceThread(RThread)
IMPORT_C TIntCancelEvent(TEventIf &, TRequestStatus *)
IMPORT_C TIntCheckAllowResult(TInt)
TInt Command(TCommand, const TDesC8 &)
IMPORT_C TIntEvent(TEventIf &)
IMPORT_C voidEvent(TEventIf &, TRequestStatus &)
IMPORT_C TIntGetMeasurementOptions(TInt &)
IMPORT_C TIntGetStoredState(TInt &, TName &)
IMPORT_C const TDesC &GetTestCaseArguments()
IMPORT_C voidGetTestCaseTitleL(TDes &)
IMPORT_C CUiEnvProxy *GetUiEnvProxy()
TInt HandleMeasurementProcess(CSTIFTestMeasurement::TStifMeasurementStruct)
IMPORT_C CTestModuleIf *NewL(CTestThreadContainer *, CTestModuleBase *)
IMPORT_C voidPrintf(const TInt, const TDesC &, TRefByValue< const TDesC >, ...)
IMPORT_C TIntReboot(TInt)
IMPORT_C voidRemoteReceive(TDes &, TRequestStatus &)
IMPORT_C voidRemoteReceiveCancel()
IMPORT_C TIntRemoteSend(const TDesC &)
TInt RemoveInterferenceThread(RThread)
IMPORT_C TIntResetAllowResult()
IMPORT_C TIntSendTestModuleVersion(TVersion, TFileName)
IMPORT_C TIntSendTestModuleVersion(TVersion &, const TDesC &, TBool)
IMPORT_C TIntSetAllowResult(TInt)
IMPORT_C TIntSetBehavior(TTestBehavior, TAny *)
IMPORT_C voidSetExitReason(const CTestModuleIf::TExitReason, const TInt)
IMPORT_C TIntStifMacroError(TInt, const TText8 *, const char *, TInt, TInt, TInt, TInt, TInt, TInt, TInt)
IMPORT_C TIntStopExecution(TStopExecutionType, TInt)
IMPORT_C TIntStoreState(TInt, TName &)
IMPORT_C TBoolUITesting()
Private Member Functions
CTestModuleIf(CTestThreadContainer *)
~CTestModuleIf()
voidConstructL(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
enumTExitReason { ENormal, EPanic, EException }
enumTRebootType {
EDefaultReset = 0, EKernelReset, EDeviceReset0 = 100, EDeviceReset1, EDeviceReset2, EDeviceReset3, EDeviceReset4, EDeviceReset5
}
enumTTestBehavior { 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(RThreadaSTIFTestInterference)

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 TIntCancelEvent(TEventIf &aEvent,
TRequestStatus *aStatus
)

Cancel asynchronous event command.

Parameters

TEventIf & aEvent
TRequestStatus * aStatus

CheckAllowResult(TInt)

IMPORT_C TIntCheckAllowResult(TIntaResult)

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(TCommandaCommand,
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 *)

voidConstructL(CTestModuleBase *aTestModule)[private]

By default Symbian OS constructor is private.

Parameters

CTestModuleBase * aTestModule

Event(TEventIf &)

IMPORT_C TIntEvent(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 voidEvent(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 TIntGetMeasurementOptions(TInt &aOptions)

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

Parameters

TInt & aOptions

GetStoredState(TInt &, TName &)

IMPORT_C TIntGetStoredState(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 voidGetTestCaseTitleL(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::TStifMeasurementStructaSTIFMeasurementInfo)

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 voidPrintf(const TIntaPriority,
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 TIntReboot(TIntaType = EDefaultReset)

Reboot device, StoreState MUST have been called.

Parameters

TInt aType = EDefaultReset

RemoteReceive(TDes &, TRequestStatus &)

IMPORT_C voidRemoteReceive(TDes &aRemoteMsg,
TRequestStatus &aStatus
)

RemoteReceive function is used receive remote control protocol messages.

Parameters

TDes & aRemoteMsg
TRequestStatus & aStatus

RemoteReceiveCancel()

IMPORT_C voidRemoteReceiveCancel()

RemoteReceiveCancel function is used cancel pending RemoteReceive.

RemoteSend(const TDesC &)

IMPORT_C TIntRemoteSend(const TDesC &aRemoteMsg)

RemoteSend function is used send remote control protocol messages.

Parameters

const TDesC & aRemoteMsg

RemoveInterferenceThread(RThread)

TInt RemoveInterferenceThread(RThreadaSTIFTestInterference)

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

Parameters

RThread aSTIFTestInterference

ResetAllowResult()

IMPORT_C TIntResetAllowResult()

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 TIntSendTestModuleVersion(TVersionaVersion,
TFileNameaModuleName
)

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 TIntSendTestModuleVersion(TVersion &aVersion,
const TDesC &aModuleName,
TBoolaNewVersion
)

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 TIntSetAllowResult(TIntaResult)

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 TIntSetBehavior(TTestBehavioraType,
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 voidSetExitReason(const CTestModuleIf::TExitReasonaExitReason,
const TIntaExitCode
)

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 TIntStifMacroError(TIntaMacroType,
const TText8 *aFile,
const char *aFunction,
TIntaLine,
TIntaResult = 0,
TIntaExpected1 = 0,
TIntaExpected2 = 0,
TIntaExpected3 = 0,
TIntaExpected4 = 0,
TIntaExpected5 = 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 TIntStopExecution(TStopExecutionTypeaType,
TIntaCode =  KErrNone
)

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

Parameters

TStopExecutionType aType
TInt aCode =  KErrNone

StoreState(TInt, TName &)

IMPORT_C TIntStoreState(TIntaCode,
TName &aName
)

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

Parameters

TInt aCode
TName & aName

UITesting()

IMPORT_C TBoolUITesting()

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]