Exit Test Harness Cleanly when Calling a Stubbed Function

Question:
Is there a way to make VectorCAST exit the test harness cleanly when calling a stubbed function?
Answer:

Yes, in configure stubs user code (Environment | Configure Stubs | Edit) for the stubbed function, insert the following code:
 

void VCAST_driver_termination(int status, int eventCode);
void vCAST_SET_HISTORY (int VC_U, int VC_S);
void vCAST_STORE_GLOBAL_ASCII_DATA (void);
extern unsigned short VCAST_GLOBALS_DISPLAY;
if (VCAST_GLOBALS_DISPLAY != vCAST_EACH_EVENT) {
  vCAST_STORE_GLOBAL_ASCII_DATA();
}
vCAST_SET_HISTORY(0,0);
VCAST_driver_termination(0,0);

Note:
If you would like to set an expected value for the parameter passed to the call to exit, you will need to enter the above user code in the End Of Stubs user code section.


Article ID: 1485
Last updated: 2019-10-31
Revision: 3
VectorCAST -> C++ Unit Testing -> Exit Test Harness Cleanly when Calling a Stubbed Function
https://kb.vector.com/entry/1485/