winIDEA SDK
Loading...
Searching...
No Matches
IConnectTest Struct Referenceabstract

This interface defines methods for unit testing without code instrumentation. More...

#include <i_Connect.h>

Public Types

enum  EControlFlags {
  controlReset = 0x00000000 , controlTestCaseInit = 0x00000001 ,
  controlTestCaseClean = 0x00000002 , controlTestCaseRun = 0x00000003 ,
  controlTestCaseAbort = 0x00000004 , controlTestCasePause = 0x00000005 ,
  controlTestCaseSetDebugMode = 0x00000006 , controlTestBatchBegin = 0x00000014 ,
  controlTestBatchEnd = 0x00000015 , controlPersistentVariablesInit = 0x00000065 ,
  controlPersistentVariablesClean = 0x00000066 , controlPersistentVariablesApply = 0x00000067 ,
  controlSystemTest = 0x00000100 , controlSystemTestInit = controlSystemTest | controlTestCaseInit ,
  controlSystemTestClean = controlSystemTest | controlTestCaseClean , controlSystemTestRun = controlSystemTest | controlTestCaseRun ,
  controlSystemTestStop = 0x00000104
}
 Defines constants for test case actions. More...
enum  ECreateVariableExFlags { cveRegularVariable = isys::IConnectTest::ECreateVariableExFlags::cveRegularVariable , cvePersistentVariable = isys::IConnectTest::ECreateVariableExFlags::cvePersistentVariable }
enum  EDeleteVariableExFlags { dveRegularVariable = 0x0001 , dvePersistentVariable = 0x0002 }
 Defines the flags used in the DeleteVariableEx function. More...
enum  EErrorCode
 Defines constants describing test case status.
enum  EEvaluateFlags {
  efVagueFloatEqual = isys::IConnectTest::EEvaluateFlags::efVagueFloatEqual , efIgnoreLocalScope = isys::IConnectTest::EEvaluateFlags::efIgnoreLocalScope ,
  efUseRealTimeAccess = isys::IConnectTest::EEvaluateFlags::efUseRealTimeAccess , efModifyParameter = isys::IConnectTest::EEvaluateFlags::efModifyParameter
}
enum  EInfoFlags { infoSupported = 1 }
 Defines the flags used by the GetInfo function. More...
enum  EState {
  stateOffline = isys::IConnectTest::EState::stateOffline , stateInitialized = isys::IConnectTest::EState::stateInitialized ,
  stateRunning = isys::IConnectTest::EState::stateRunning , stateEnded = isys::IConnectTest::EState::stateEnded ,
  stateStub = isys::IConnectTest::EState::stateStub , stateUnexpectedStop = isys::IConnectTest::EState::stateUnexpectedStop ,
  stateAborted = isys::IConnectTest::EState::stateAborted , statePaused = isys::IConnectTest::EState::statePaused ,
  statePersistentReady = isys::IConnectTest::EState::statePersistentReady , stateSystemTest = isys::IConnectTest::EState::stateSystemTest ,
  stateStop = isys::IConnectTest::EState::stateStop , stateException = isys::IConnectTest::EState::stateException ,
  stateTimeOut = isys::IConnectTest::EState::stateTimeOut
}
enum  EStatusFlags {
  sfQueryTestCase = isys::IConnectTest::EStatusFlags::sfQueryTestCase , sfQueryStub = isys::IConnectTest::EStatusFlags::sfQueryStub ,
  sfTestCase = isys::IConnectTest::EStatusFlags::sfTestCase , sfStub = isys::IConnectTest::EStatusFlags::sfStub ,
  sfException = isys::IConnectTest::EStatusFlags::sfException
}
enum  EStubFlags { sfeAutoBreakpoints = isys::IConnectTest::EStubFlags::sfeAutoBreakpoints , sfeCustomBreakpoints = isys::IConnectTest::EStubFlags::sfeCustomBreakpoints }
enum  EStubState { stateStubNotActive = isys::IConnectTest::EStubState::stateStubNotActive , stateStubActive = isys::IConnectTest::EStubState::stateStubActive }

Public Member Functions

virtual isys::HResult Control (DWORD dwControlFlags, DWORD dwHandle)=0
 This method modifies the state of the test case.
virtual isys::HResult CreateParameter (DWORD dwTestCase, DWORD dwIndex, const char *pszName, const char *pszType="")=0
 Creates a name for a parameter that can be used for accessing it.
virtual isys::HResult CreateRealtimeStub (DWORD *pdwStub, const char *pszFunctionName)=0
 Obsolete.
virtual isys::HResult CreateReturnValue (DWORD dwTestCase, const char *pszName)=0
 Creates a name for the function return value that can be used for accessing it during evaluation and modification.
virtual isys::HResult CreateStub (DWORD *pdwStub, const char *pszFunctionName)=0
 Creates stub for function called by function under test.
virtual isys::HResult CreateStubEx (DWORD dwStubFlags, const char *pszFunctionName, DWORD *pdwStub)=0
 Creates stub for function called by function under test.
virtual isys::HResult CreateStubParameter (DWORD dwStub, DWORD dwIndex, const char *pszName)=0
 This method assigns a name to stub parameter at the given position.
virtual isys::HResult CreateStubReturnValue (DWORD dwStub, const char *pszName)=0
 This method assigns a name to stub return value.
virtual isys::HResult CreateTestCase (DWORD *pdwTestCase, const char *pszFunctionName)=0
 Creates a new test case.
virtual isys::HResult CreateUserStub (DWORD *pdwStub, const char *pszFunctionName, const char *pszUserFunctionName)=0
 Creates stub for function called by function under test.
virtual isys::HResult CreateVariable (DWORD *pdwVariable, const char *pszName, const char *pszType)=0
 Creates temporary variable, which can be used as a function parameter.
virtual isys::HResult CreateVariableEx (DWORD dwCreateVariableExFlags, DWORD *pdwVariable, const char *pszName, const char *pszType)=0
 Creates temporary variable, which can be used as a function parameter.
virtual isys::HResult DeleteVariableEx (DWORD dwDeleteVariableExFlags, const char *pszName)=0
 Delete temporary variable, which can be used as a function parameter.
virtual isys::HResult DestroyStub (DWORD dwStub)=0
 Destroys a stub.
virtual isys::HResult DestroyTestCase (DWORD dwTestCase)=0
 Deletes test case created by CreateTestCase().
virtual isys::HResult DestroyVariable (DWORD dwVariable)=0
 Destroys variable created by CreateVariable().
virtual isys::HResult EvaluateExpression (DWORD dwEvaluateFlags, const char *pszExpression, LPSTR pszResult, DWORD dwResultLen)=0
 Evaluates the given expression and returns result as a string.
virtual isys::HResult GetInfo (DWORD dwInfoFlags, DWORD *pdwInfo, LPSTR pszInfo, DWORD dwInfoLen)=0
 Gets information about the iTest module and the TestManager.
virtual isys::HResult GetLastError (DWORD dwErrorFlags, DWORD *pdwErrorCode, LPSTR pszError, DWORD dwErrorLen)=0
 Gets the last error code and it's string description.
virtual isys::HResult GetStatus (DWORD dwStatusFlags, DWORD dwHandle, DWORD *pdwStatus)=0
 Provides status information.
virtual isys::HResult ModifyExpression (DWORD dwModifyFlags, const char *pszExpression, LPSTR pszResult, DWORD dwResultLen, const char *pszValue)=0
 Modifies expression to the given value.
virtual isys::HResult SetTestCaseTimeOut (DWORD dwTimeOut=0)=0
 Set a timeout for a testcase.

Detailed Description

This interface defines methods for unit testing without code instrumentation.

Member Enumeration Documentation

◆ EControlFlags

Defines constants for test case actions.

Enumerator
controlReset 

Clean the active test case from the target if any and destroy all test cases, variables and stubs.

controlTestCaseInit 

Initialize a test case, from offline status.

controlTestCaseClean 

Cleanup the test case from the target make it offline.

controlTestCaseRun 

Run a test case or resume an initialized, paused, stopped or at stub test case; no effect if the test case is offline;.

controlTestCaseAbort 

Abort the the test case, no matter it's status; it has no effect if the test case is not initialized.

controlTestCasePause 

Pause a running test case; valid only if the test case is initialized and running.

controlTestCaseSetDebugMode 

Indicates execution in debug mode. Optimizations should be disabled.

controlTestBatchBegin 

a series of test case runs will follow

controlTestBatchEnd 

a series of test case runs has ended

controlPersistentVariablesInit 

Initialize persistent variables; only possible from from offline status.

controlPersistentVariablesClean 

Cleanup persistent variables; only possible from offline status or ended status.

controlPersistentVariablesApply 

Apply changes on persistent variables; only possible from offline status or ended status.

controlSystemTest 

indicates that this is a system test

controlSystemTestInit 

Initialize a system test case, from offline status.

controlSystemTestClean 

Cleanup the system test case from the target make it offline.

controlSystemTestRun 

Run the initialized system test.

controlSystemTestStop 

stop the running system test

◆ ECreateVariableExFlags

Deprecated
For C++ use flags from isys::IConnectTest::ECreateVariableExFlags (i_ConnectTypes.h), for other languages the right type is automatically used. Provided for backwards compatibility.
Enumerator
cveRegularVariable 

See isys::IConnectTest::ECreateVariableExFlags.

cvePersistentVariable 

See isys::IConnectTest::ECreateVariableExFlags.

◆ EDeleteVariableExFlags

Defines the flags used in the DeleteVariableEx function.

Enumerator
dveRegularVariable 

The function will behave as DeleteVariable.

dvePersistentVariable 

The persistent variable will be deleted.

◆ EEvaluateFlags

Deprecated
For C++ use flags from isys::IConnectTest::EEvaluateFlags (i_ConnectTypes.h), for other languages the right type is automatically used. Provided for backwards compatibility.
Enumerator
efVagueFloatEqual 

See isys::IConnectTest::EEvaluateFlags.

efIgnoreLocalScope 

See isys::IConnectTest::EEvaluateFlags.

efUseRealTimeAccess 

See isys::IConnectTest::EEvaluateFlags.

efModifyParameter 

See isys::IConnectTest::EEvaluateFlags.

◆ EInfoFlags

Defines the flags used by the GetInfo function.

Enumerator
infoSupported 

Queries if the currently selected processor architecture in winIDEA is supported by iTest.

◆ EState

Deprecated
For C++ use flags from isys::IConnectTest::EState (i_ConnectTypes.h), for other languages the right type is automatically used. Provided for backwards compatibility.
Enumerator
stateOffline 

See isys::IConnectTest::EState.

stateInitialized 

See isys::IConnectTest::EState.

stateRunning 

See isys::IConnectTest::EState.

stateEnded 

See isys::IConnectTest::EState.

stateStub 

See isys::IConnectTest::EState.

stateUnexpectedStop 

See isys::IConnectTest::EState.

stateAborted 

See isys::IConnectTest::EState.

statePaused 

See isys::IConnectTest::EState.

statePersistentReady 

See isys::IConnectTest::EState.

stateSystemTest 

See isys::IConnectTest::EState.

stateStop 

See isys::IConnectTest::EState.

stateException 

See isys::IConnectTest::EState.

stateTimeOut 

See isys::IConnectTest::EState.

◆ EStatusFlags

Deprecated
For C++ use flags from isys::IConnectTest::EStatusFlags (i_ConnectTypes.h), for other languages the right type is automatically used. Provided for backwards compatibility.
Enumerator
sfQueryTestCase 

See isys::IConnectTest::EStatusFlags.

sfQueryStub 

See isys::IConnectTest::EStatusFlags.

sfTestCase 

See isys::IConnectTest::EStatusFlags.

sfStub 

See isys::IConnectTest::EStatusFlags.

sfException 

See isys::IConnectTest::EStatusFlags.

◆ EStubFlags

Deprecated
For C++ use flags from isys::IConnectTest::EStubFlags (i_ConnectTypes.h), for other languages the right type is automatically used. Provided for backwards compatibility.
Enumerator
sfeAutoBreakpoints 

See isys::IConnectTest::EStubFlags.

sfeCustomBreakpoints 

See isys::IConnectTest::EStubFlags.

◆ EStubState

Deprecated
For C++ use flags from isys::IConnectTest::EStubState (i_ConnectTypes.h), for other languages the right type is automatically used. Provided for backwards compatibility.
Enumerator
stateStubNotActive 

See isys::IConnectTest::EStubState.

stateStubActive 

See isys::IConnectTest::EStubState.

Member Function Documentation

◆ Control()

virtual isys::HResult IConnectTest::Control ( DWORD dwControlFlags,
DWORD dwHandle )
pure virtual

This method modifies the state of the test case.

Returns
S_OK for success, ICONNECT_S_STATUS_1 if the tested function is void and return value was created
Parameters
dwControlFlagsdefines action to be performed. See IConnectTest::EControlFlags for valid values.
dwHandlehandle, depending on the control flags

◆ CreateParameter()

virtual isys::HResult IConnectTest::CreateParameter ( DWORD dwTestCase,
DWORD dwIndex,
const char * pszName,
const char * pszType = "" )
pure virtual

Creates a name for a parameter that can be used for accessing it.

If the variable name with this name already exists, it is hidden by the created variable.

Parameters
dwTestCasetest case handle as returned by CreateTestCase()
dwIndexzero based index of the parameter
pszNamename of the parameter to be created
pszTypetype of parameter to be created

◆ CreateReturnValue()

virtual isys::HResult IConnectTest::CreateReturnValue ( DWORD dwTestCase,
const char * pszName )
pure virtual

Creates a name for the function return value that can be used for accessing it during evaluation and modification.

If the variable name with this name already exists, it is hidden by the created variable.

Parameters
dwTestCasetest case handle as returned by CreateTestCase()
pszNamename of the variable to be created

◆ CreateStub()

virtual isys::HResult IConnectTest::CreateStub ( DWORD * pdwStub,
const char * pszFunctionName )
pure virtual

Creates stub for function called by function under test.

Since no code instrumentation is allowed, only breakpoint is set at the given function. When the function is called, the test case execution stops, and then the test framework can define next actions. Usually it will simulate desired side effects of a stubbed function (for example set global variables), and then continue execution of the function under test.

This method must be called BEFORE test case is initialized by method Control(controlTestCaseInit).

Parameters
pdwStubcontains a new stub handle on return
pszFunctionNamename of the stubbed function

◆ CreateStubEx()

virtual isys::HResult IConnectTest::CreateStubEx ( DWORD dwStubFlags,
const char * pszFunctionName,
DWORD * pdwStub )
pure virtual

Creates stub for function called by function under test.

Since no code instrumentation is allowed, breakpoint is set automatically or manually (depending on flags) at the given function. When the function is called, the test case execution stops, and then the test framework can define next actions. Usually it will simulate desired side effects of a stubbed function (for example set global variables), and then continue execution of the function under test.

This method must be called BEFORE test case is initialized by method Control(controlTestCaseInit).

Parameters
pdwStubcontains a new stub handle on return
pszFunctionNamename of the stubbed function
dwStubFlagsflags used for specified stub

◆ CreateStubParameter()

virtual isys::HResult IConnectTest::CreateStubParameter ( DWORD dwStub,
DWORD dwIndex,
const char * pszName )
pure virtual

This method assigns a name to stub parameter at the given position.

This could be done only with regular stubs. This is not supported in real-time or user stubs. The assigned name may be used in expressions by EvaluateExpression() and ModifyExpression(). This function can be called anytime after the stub is setup and before it is hit.

Parameters
dwStubstub handle as returned by CreateStub()
dwIndex0 - based parameter index
pszNamename assigned to parameter

◆ CreateStubReturnValue()

virtual isys::HResult IConnectTest::CreateStubReturnValue ( DWORD dwStub,
const char * pszName )
pure virtual

This method assigns a name to stub return value.

This could be done only with regular stubs. This is not supported in real-time or user stubs. The assigned name may be used in expressions by EvaluateExpression() and ModifyExpression() to define value returned to the function under test. This function can be called anytime after the stub is setup and before it is hit.

Parameters
dwStubstub handle as returned by CreateStub()
pszNamename assigned to return value

◆ CreateTestCase()

virtual isys::HResult IConnectTest::CreateTestCase ( DWORD * pdwTestCase,
const char * pszFunctionName )
pure virtual

Creates a new test case.

Parameters
pdwTestCasecontains a new test case handle on return
pszFunctionNamename of the function to be tested

◆ CreateUserStub()

virtual isys::HResult IConnectTest::CreateUserStub ( DWORD * pdwStub,
const char * pszFunctionName,
const char * pszUserFunctionName )
pure virtual

Creates stub for function called by function under test.

User stubs are used to replace a function with another. Both functions have to have the same parameters and return value. When setting up the stub, code will be patched to achieve this behavior. This could be used to test parts of the code with alternative implementations of functions.

This method must be called BEFORE test case is initialized by method Control(controlTestCaseInit).

Parameters
pdwStubcontains a new stub handle on return
pszFunctionNamename of the stubbed function
pszUserFunctionNamename of replacement function

◆ CreateVariable()

virtual isys::HResult IConnectTest::CreateVariable ( DWORD * pdwVariable,
const char * pszName,
const char * pszType )
pure virtual

Creates temporary variable, which can be used as a function parameter.

If the variable name with this name already exists, it is hidden by the created variable.

Parameters
pdwVariablevariable handle as returned by CreateVariable()
pszNamename of the variable to be created
pszTypetype of the variable. This should be one of the existing types in the application under test.

◆ CreateVariableEx()

virtual isys::HResult IConnectTest::CreateVariableEx ( DWORD dwCreateVariableExFlags,
DWORD * pdwVariable,
const char * pszName,
const char * pszType )
pure virtual

Creates temporary variable, which can be used as a function parameter.

If the variable name with this name already exists, it is hidden by the created variable.

Parameters
dwCreateVariableExFlagsflags to set variable type (regular or persistent)
pdwVariablevariable handle as returned by CreateVariable()
pszNamename of the variable to be created
pszTypetype of the variable. This should be one of the existing types in the application under test.

◆ DeleteVariableEx()

virtual isys::HResult IConnectTest::DeleteVariableEx ( DWORD dwDeleteVariableExFlags,
const char * pszName )
pure virtual

Delete temporary variable, which can be used as a function parameter.

If the variable name with this name already exists, it is hidden by the created variable.

Parameters
dwDeleteVariableExFlagsflags to set variable type (regular or persistent)
pszNamename of the variable to be created

◆ DestroyStub()

virtual isys::HResult IConnectTest::DestroyStub ( DWORD dwStub)
pure virtual

Destroys a stub.

Parameters
dwStubstub handle as returned by CreateStub(), CreateRealtimeStub() or CreateUserStub().

◆ DestroyTestCase()

virtual isys::HResult IConnectTest::DestroyTestCase ( DWORD dwTestCase)
pure virtual

Deletes test case created by CreateTestCase().

Parameters
dwTestCasetest case handle as returned by CreateTestCase()

◆ DestroyVariable()

virtual isys::HResult IConnectTest::DestroyVariable ( DWORD dwVariable)
pure virtual

Destroys variable created by CreateVariable().

Parameters
dwVariablevariable handle as returned by CreateVariable().

◆ EvaluateExpression()

virtual isys::HResult IConnectTest::EvaluateExpression ( DWORD dwEvaluateFlags,
const char * pszExpression,
LPSTR pszResult,
DWORD dwResultLen )
pure virtual

Evaluates the given expression and returns result as a string.

This method is similar to IConnectDebug::Evaluate(). The difference is in variable scope, since this method takes into account also variables created by CreateVariable() or CreateParameter(), return value, and stub related data.

Parameters
dwEvaluateFlagsmodifies the behavior of the evaluate function. See IConnectTest::EEvaluateFlags
pszExpressionthe expression to be evaluated
pszResultpointer to string, which will contain evaluation result
dwResultLenthe length of allocated array pointed to by pszResult
Returns
result in string form. Numbers may be returned in hex or decimal format, depending on setting in winIDEA's Watch window.

◆ GetInfo()

virtual isys::HResult IConnectTest::GetInfo ( DWORD dwInfoFlags,
DWORD * pdwInfo,
LPSTR pszInfo,
DWORD dwInfoLen )
pure virtual

Gets information about the iTest module and the TestManager.

This method can be called independently of the status of the TestManager

Parameters
dwInfoFlagsspecifies the type of information that is being queried
pdwInforeturns numeric information
pszInforeturns string information to a user allocated buffer
dwInfoLenlength of the user allocated buffer

◆ GetLastError()

virtual isys::HResult IConnectTest::GetLastError ( DWORD dwErrorFlags,
DWORD * pdwErrorCode,
LPSTR pszError,
DWORD dwErrorLen )
pure virtual

Gets the last error code and it's string description.

Call this method, when other methods of this interface do not return S_OK, to get detailed error code and description.

Parameters
dwErrorFlagsflags that modify the behavior of the function
pdwErrorCodeerror code
pszErrorbuffer for the error string
dwErrorLenlength of the error string buffer

◆ GetStatus()

virtual isys::HResult IConnectTest::GetStatus ( DWORD dwStatusFlags,
DWORD dwHandle,
DWORD * pdwStatus )
pure virtual

Provides status information.

Parameters
dwStatusFlagsthe function operation and the meaning of the other parameters depend on this, for more information see IConnectTest::EStatusFlags
dwHandlehandle to a test object (test case, variable, stub, call), its meaning depends on the flags passed to the function
pdwStatuscontains data on return

◆ ModifyExpression()

virtual isys::HResult IConnectTest::ModifyExpression ( DWORD dwModifyFlags,
const char * pszExpression,
LPSTR pszResult,
DWORD dwResultLen,
const char * pszValue )
pure virtual

Modifies expression to the given value.

Expression must be an lvalue.

Parameters
dwModifyFlagsmodifies the behavior of the modify function. See IConnectTest::EEvaluateFlags
pszExpressionlvalue to be modified
pszResultresult of evaluated pszValue is stored here. May be NULL, if we don't need the evaluation result.
dwResultLenthe length of allocated array pointed to by pszResult
pszValuethe value to be assigned to pszExpression

◆ SetTestCaseTimeOut()

virtual isys::HResult IConnectTest::SetTestCaseTimeOut ( DWORD dwTimeOut = 0)
pure virtual

Set a timeout for a testcase.

Parameters
dwTimeOutwhen to timeout in ms