winIDEA SDK
|
This class wraps test case stubs, which are created, used, and destroyed by IControlTest class.
Stubs may have lifetime different than single test case, for example they may be used by several test cases.
Stub replaces 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 return value, local and global variables), and then continue execution of the function under test.
Destructor automatically destroys the stub on the target.
#include <CTestCaseController.h>
Public Types | |
enum | EStubType { E_SCRIPT_STUB , E_RT_USER_STUB , E_RT_EMPTY_STUB } |
Enumeration for stub types. More... | |
Public Member Functions | |
void | create (IConnectTest::EStubFlags flags, const std::string &stubbedFunctionName) |
Creates stub in winIDEA. More... | |
void | createParameter (DWORD parameterIndex, const std::string ¶meterName) |
Assigns a name to stub parameter at the given position. More... | |
void | createReturnValue (const std::string &retValName) |
Assigns a name to stub return value. More... | |
CTestStubController (std::shared_ptr< ConnectionMgr > connectionMgr) | |
Creates empty controller, call method create() to actually create stub in winIDEA. More... | |
CTestStubController (std::shared_ptr< ConnectionMgr > connectionMgr, const std::string &stubbedFunctionName) | |
Creates function stub on the target. More... | |
DWORD | getHandle () |
Returns handle as used by IConnectTest. | |
std::string | getRetValName () |
Returns return value name. | |
std::string | getStubName () |
Returns stub name. | |
~CTestStubController () | |
Destroys also stub on the target. | |
Enumeration for stub types.
isys::CTestStubController::CTestStubController | ( | std::shared_ptr< ConnectionMgr > | connectionMgr | ) |
Creates empty controller, call method create() to actually create stub in winIDEA.
Use this ctor, when greater flexibility is required for stub creation (for example, when stub breakpoint setting should not be managed by winIDEA (for example, when there are not enough HW BPs)).
connectionMgr | connection to winIDEA |
isys::CTestStubController::CTestStubController | ( | std::shared_ptr< ConnectionMgr > | connectionMgr, |
const std::string & | stubbedFunctionName | ||
) |
Creates function stub on the target.
connectionMgr | connection to winIDEA |
stubbedFunctionName | name of the function to be stubbed |
void isys::CTestStubController::create | ( | IConnectTest::EStubFlags | flags, |
const std::string & | stubbedFunctionName | ||
) |
Creates stub in winIDEA.
flags | see IConnectTest::EStubFlags |
stubbedFunctionName | name of the function to be stubbed |
void isys::CTestStubController::createParameter | ( | DWORD | parameterIndex, |
const std::string & | parameterName | ||
) |
Assigns a name to stub parameter at the given position.
The assigned name may be used in expressions by CTestCaseController::evaluate() and CTestCaseController::modify().
parameterIndex | 0 - based parameter index |
parameterName | name assigned to parameter |
void isys::CTestStubController::createReturnValue | ( | const std::string & | retValName | ) |
Assigns a name to stub return value.
The assigned name may be used in expressions by CTestCaseController::evaluateExpression() and CTestCaseController::modifyExpression() to define value returned to the function under test.
retValName | name assigned to return value |