winIDEA SDK
Loading...
Searching...
No Matches
isys::CTestCase Class Reference

This class is the main class of the isystem.test framework. More...

#include <CTestCase.h>

Public Member Functions

isys::CTestStubSPtr callStubs (bool isRunNativeCustomFunc, iconnect::StrVector &scriptParams, isys::CTestPointResultSPtr tpResult)
void checkStopConditionExpr (isys::CTestStopConditionSPtr &stopCondition)
void checkStopConditionStop (isys::CTestStopConditionSPtr &stopCondition)
void clearTest ()
void closeAnalyzer ()
 Closes analyzer document if configured so.
 CTestCase (isys::ConnectionMgrSPtr &connectionMgr)
 CTestCase (isys::ConnectionMgrSPtr &connectionMgr, isys::CTestHostVarsSPtr &hostvars)
 Initializes object with the given connection to winIDEA, and host variables.
void deleteStopConditionBP (isys::CTestStopConditionSPtr &stopCondition, const std::string &testPointOrTestCaseId)
isys::CTestPointSPtr execTestPointEvalAssign (ITestCaseControllerSPtr testCaseCtrl, iconnect::StrVector &scriptParams, isys::CTestPointResultSPtr &tpResult)
CDebugFacadeSPtr getDebugFacade ()
CTestHostVarsSPtr getHostVars ()
ITestCaseControllerSPtr getTestController ()
isys::CTestResultSPtr getTestResults ()
 This method returns test result based on data stored internally in this class, including test specification.
isys::CTestResultSPtr getTestResults (isys::CTestSpecificationSPtr &testSpecification)
 Deprecated.
void handleException ()
bool isSystemTestStopOnBP ()
void itestCpp (const std::string &yamlSpec, bool isDebug=false)
 This method parses test specification given in YAML format, and then calls method runTest().
void itestCpp (const std::string &yamlSpec, iconnect::StrVector &differences, bool isDebug=false)
 Deprecated.
std::string replaceHostVariables (const std::string &expression)
void runTest (isys::CTestSpecificationSPtr &testSpec, iconnect::StrVector &differences, bool isDebug, const isys::CTestFilterSPtr &testFilter)
 Deprecated.
void runTest (isys::CTestSpecificationSPtr &testSpec, iconnect::StrVector &differences, bool isDebug=false)
 Deprecated.
void runTest (isys::CTestSpecificationSPtr &testSpec, iconnect::StrVector &differences, int testTimeout, bool isDebug, const isys::CTestFilterSPtr &testFilter)
 Deprecated.
void runTest (isys::CTestSpecificationSPtr &testSpec, iconnect::StrVector &differences, int testTimeout, bool isDebug, const isys::CTestFilterSPtr &testFilter, const isys::CTestFilterControllerSPtr &filterCtrl)
 Deprecated.
void runTest (isys::CTestSpecificationSPtr &testSpec, int testTimeout, bool isDebug, const isys::CTestFilterSPtr &testFilter)
 Runs single test specification.
void runTest (isys::CTestSpecificationSPtr &testSpec, int testTimeout, bool isDebug, const isys::CTestFilterSPtr &testFilter, const isys::CTestFilterControllerSPtr &filterCtrl)
 Runs single test specification.
void runTest_exec_begin ()
void runTest_exec_end ()
bool runTest_exec_langSpecific ()
void runTest_exec_loopStart (isys::CTestSpecificationSPtr &testSpec, bool isResumeCoverage, bool isStubOrTestPoint)
bool runTest_exec_waitForStop (isys::CTestSpecificationSPtr &testSpec, int unitTestTimeout)
void runTest_finalize (iconnect::StrVector &differences, bool isDryRun, iconnect::StrVector &analyzerFilesToMerge)
bool runTest_init_target (isys::CTestSpecificationSPtr &testSpec, bool isDebug, bool isTestBatchOn)
void runTest_init_test (bool isInitAnalyzers, bool isMeasureStackUsage, int testTimeout)
void setEnableStub (CTestSpecificationSPtr &testSpec, const std::string &stubbedFunction, bool isEnabled)
 Enables or disables existing stub.
void setEnableTestPoint (CTestSpecificationSPtr &testSpec, const std::string &tpId, bool isEnabled)
 Enables or disables existing test point.
void setStopConditionBP (isys::CTestStopConditionSPtr &stopCondition, const std::string &testPointOrTestCaseId)
void setStopConditionForSysTest (const isys::CTestSpecificationSPtr &testSpec)
void setTargetException (bool isTargetException)
void stopTest ()
void waitForAnalyzerToDownloadData (int timeout=0)
 ~CTestCase ()

Detailed Description

This class is the main class of the isystem.test framework.

It connects together classes with test specification and target controllers by providing methods for test execution.

Methods is itestCpp(), and runTest() execute test case, while method getTestResults() returns result.

Note: Wrappers for other languages, for example Python and Java, contain their replacement of this class.

Python example for class PTestCase, which replaces this class in Python: itest_sample.py

Constructor & Destructor Documentation

◆ CTestCase() [1/2]

isys::CTestCase::CTestCase ( isys::ConnectionMgrSPtr & connectionMgr,
isys::CTestHostVarsSPtr & hostvars )

Initializes object with the given connection to winIDEA, and host variables.

Since
9.12.288

◆ CTestCase() [2/2]

isys::CTestCase::CTestCase ( isys::ConnectionMgrSPtr & connectionMgr)
Deprecated
use CTestCase(ConnectionMgrSPtr, CTestHostVarsSPtr) instead Initializes object with the given connection to winIDEA.
Since
9.12.288

◆ ~CTestCase()

isys::CTestCase::~CTestCase ( )
Since
9.12.288

Member Function Documentation

◆ callStubs()

isys::CTestStubSPtr isys::CTestCase::callStubs ( bool isRunNativeCustomFunc,
iconnect::StrVector & scriptParams,
isys::CTestPointResultSPtr tpResult )
Since
9.12.288

◆ checkStopConditionExpr()

void isys::CTestCase::checkStopConditionExpr ( isys::CTestStopConditionSPtr & stopCondition)
Since
9.12.288

◆ checkStopConditionStop()

void isys::CTestCase::checkStopConditionStop ( isys::CTestStopConditionSPtr & stopCondition)
Since
9.12.288

◆ clearTest()

void isys::CTestCase::clearTest ( )
Since
9.12.288

◆ closeAnalyzer()

void isys::CTestCase::closeAnalyzer ( )

Closes analyzer document if configured so.

Since
9.12.288

◆ deleteStopConditionBP()

void isys::CTestCase::deleteStopConditionBP ( isys::CTestStopConditionSPtr & stopCondition,
const std::string & testPointOrTestCaseId )
Since
9.12.288

◆ execTestPointEvalAssign()

isys::CTestPointSPtr isys::CTestCase::execTestPointEvalAssign ( ITestCaseControllerSPtr testCaseCtrl,
iconnect::StrVector & scriptParams,
isys::CTestPointResultSPtr & tpResult )
Since
9.12.288

◆ getDebugFacade()

CDebugFacadeSPtr isys::CTestCase::getDebugFacade ( )
Since
9.12.288

◆ getHostVars()

CTestHostVarsSPtr isys::CTestCase::getHostVars ( )
Since
9.12.288

◆ getTestController()

ITestCaseControllerSPtr isys::CTestCase::getTestController ( )
Since
9.12.288

◆ getTestResults() [1/2]

isys::CTestResultSPtr isys::CTestCase::getTestResults ( )

This method returns test result based on data stored internally in this class, including test specification.

Since
9.12.288

◆ getTestResults() [2/2]

isys::CTestResultSPtr isys::CTestCase::getTestResults ( isys::CTestSpecificationSPtr & testSpecification)

Deprecated.

Deprecated
call getTestResults() without parameter instead
Since
9.12.288

This method returns test result based on data stored internally in this class, including test specification.

◆ handleException()

void isys::CTestCase::handleException ( )
Since
9.12.288

◆ isSystemTestStopOnBP()

bool isys::CTestCase::isSystemTestStopOnBP ( )
Since
9.12.288

◆ itestCpp() [1/2]

void isys::CTestCase::itestCpp ( const std::string & yamlSpec,
bool isDebug = false )

This method parses test specification given in YAML format, and then calls method runTest().

See also
runTest()
Parameters
yamlSpectest specification in YAML format. See User's guide for details.
isDebugif true, then test is not reset in case of error. If execution stops at user breakpoint, it is then possible to check variables and step through the code.
Since
9.12.288

◆ itestCpp() [2/2]

void isys::CTestCase::itestCpp ( const std::string & yamlSpec,
iconnect::StrVector & differences,
bool isDebug = false )

Deprecated.

Deprecated
use itestCpp(yamlSpec, isDebug) instead.

Return parameter differences contains only the most basic test results. Call getTestResult() to get complete information, including expression differences.

Parameters
yamlSpecYAML test spec.
differencesafter return this vector contains a human readable evaluations of expressions from section assert, which evaluated to false, and values of variables used in the expressions.
isDebugDebug.
Since
9.12.288

◆ replaceHostVariables()

std::string isys::CTestCase::replaceHostVariables ( const std::string & expression)
Since
9.12.288

◆ runTest() [1/6]

void isys::CTestCase::runTest ( isys::CTestSpecificationSPtr & testSpec,
iconnect::StrVector & differences,
bool isDebug,
const isys::CTestFilterSPtr & testFilter )

Deprecated.

Deprecated
use runTest(testCase, testTimeout, isDebug, testFilter, filterCtrl) instead, create empty instance of testFilter with default ctor. CTestFilter().
Since
9.12.288

Calls runTest() with infinite timeout.

◆ runTest() [2/6]

void isys::CTestCase::runTest ( isys::CTestSpecificationSPtr & testSpec,
iconnect::StrVector & differences,
bool isDebug = false )

Deprecated.

Deprecated
use runTest(testCase, testTimeout, isDebug, testFilter, filterCtrl) instead, create empty instance of testFilter with default ctor. CTestFilter().
Since
9.12.288

Calls runTest() with empty test filter, which means the given test specification is not filtered - if not empty or abstract, it is executed.

◆ runTest() [3/6]

void isys::CTestCase::runTest ( isys::CTestSpecificationSPtr & testSpec,
iconnect::StrVector & differences,
int testTimeout,
bool isDebug,
const isys::CTestFilterSPtr & testFilter )

Deprecated.

Deprecated
use runTest(testCase, testTimeout, isDebug, testFilter, filterCtrl) instead, create empty instance of testFilter with default ctor. CTestFilter().

Return parameter differences contains only the most basic test results. Call getTestResult() to get complete information, including expression differences.

Parameters
testSpecTest specification.
differencesafter return this vector contains a human readable evaluations of expressions from section assert, which evaluated to false, and values of variables used in the expressions.
testTimeoutTimeout.
isDebugDebug.
testFilterTest filters.
Since
9.12.288

◆ runTest() [4/6]

void isys::CTestCase::runTest ( isys::CTestSpecificationSPtr & testSpec,
iconnect::StrVector & differences,
int testTimeout,
bool isDebug,
const isys::CTestFilterSPtr & testFilter,
const isys::CTestFilterControllerSPtr & filterCtrl )

Deprecated.

Deprecated
use runTest(testCase, testTimeout, isDebug, testFilter, filterCtrl) instead
Since
9.12.288

◆ runTest() [5/6]

void isys::CTestCase::runTest ( isys::CTestSpecificationSPtr & testSpec,
int testTimeout,
bool isDebug,
const isys::CTestFilterSPtr & testFilter )

Runs single test specification.

It sets the environment on the target, calls the function to be tested, handles stubs, and finally verifies the result. Because of callbacks for init, end, and stub function, it can be used only if callbacks are implemented in C++. If any of these methods is specified in test specification (tags initFunc, endFunc, stub [func]), method setCallbackObject() must be called with non-NULL argument before this method.

Parameters
testSpectest specification to be executed
testTimeouttest execution timeout in milliseconds. Value 0 means infinite timeout.
isDebugif true, then test is not reset in case of error. If execution stops at user breakpoint, it is then possible to check variables and step through the code.
testFilterif not empty, test specification must match the condition specified by the filter to be executed. If empty, no filtering is performed and test spec is executed if not empty or abstract. Empty filter can be created with default ctor CTestFilter(). Note: Partition and module are not used for filtering. Call overload with CTestFilterController for complete filtering.
Since
9.12.288

◆ runTest() [6/6]

void isys::CTestCase::runTest ( isys::CTestSpecificationSPtr & testSpec,
int testTimeout,
bool isDebug,
const isys::CTestFilterSPtr & testFilter,
const isys::CTestFilterControllerSPtr & filterCtrl )

Runs single test specification.

It sets the environment on the target, calls the function to be tested, handles stubs, and finally verifies the result. Because of callbacks for init, end, and stub function, it can be used only if callbacks are implemented in C++. If any of these methods is specified in test specification (tags initFunc, endFunc, stub [func]), method setCallbackObject() must be called with non-NULL argument before this method.

Call getTestResults() after this method returns to get test results.

Parameters
testSpectest specification to be executed
testTimeouttest execution timeout in milliseconds. Value 0 means infinite timeout.
isDebugif true, then test is not reset in case of error. If execution stops at user breakpoint, it is then possible to check variables and step through the code.
testFilterif not empty, test specification must match the condition specified by the filter to be executed. If empty, no filtering is performed and test spec is executed if not empty or abstract. Empty filter can be created with default ctor CTestFilter().
filterCtrlclass used for performing filtering. If null, no filtering is performed.
Since
9.12.288

◆ runTest_exec_begin()

void isys::CTestCase::runTest_exec_begin ( )
Since
9.12.288

◆ runTest_exec_end()

void isys::CTestCase::runTest_exec_end ( )
Since
9.12.288

◆ runTest_exec_langSpecific()

bool isys::CTestCase::runTest_exec_langSpecific ( )
Since
9.12.288

◆ runTest_exec_loopStart()

void isys::CTestCase::runTest_exec_loopStart ( isys::CTestSpecificationSPtr & testSpec,
bool isResumeCoverage,
bool isStubOrTestPoint )
Since
9.12.288

◆ runTest_exec_waitForStop()

bool isys::CTestCase::runTest_exec_waitForStop ( isys::CTestSpecificationSPtr & testSpec,
int unitTestTimeout )
Since
9.12.288

◆ runTest_finalize()

void isys::CTestCase::runTest_finalize ( iconnect::StrVector & differences,
bool isDryRun,
iconnect::StrVector & analyzerFilesToMerge )
Since
9.12.288

◆ runTest_init_target()

bool isys::CTestCase::runTest_init_target ( isys::CTestSpecificationSPtr & testSpec,
bool isDebug,
bool isTestBatchOn )
Since
9.12.288

◆ runTest_init_test()

void isys::CTestCase::runTest_init_test ( bool isInitAnalyzers,
bool isMeasureStackUsage,
int testTimeout )
Since
9.12.288

◆ setEnableStub()

void isys::CTestCase::setEnableStub ( CTestSpecificationSPtr & testSpec,
const std::string & stubbedFunction,
bool isEnabled )

Enables or disables existing stub.

Use this method when you know the order in which stubs and test points are hit and there are not enough hardware breakpoints to enable/disable test points and stubs. This way you can keep the number of active stubs and test points below the number of available hardware breakpoints.

See also
setEnableTestPoint
Since
9.12.288

◆ setEnableTestPoint()

void isys::CTestCase::setEnableTestPoint ( CTestSpecificationSPtr & testSpec,
const std::string & tpId,
bool isEnabled )

Enables or disables existing test point.

Use this method when you know the order in which stubs and test points are hit and there are not enough hardware breakpoints to enable/disable test points and stubs. This way you can keep the number of active stubs and test points below the number of available hardware breakpoints.

See also
setEnableStub
Since
9.12.288

◆ setStopConditionBP()

void isys::CTestCase::setStopConditionBP ( isys::CTestStopConditionSPtr & stopCondition,
const std::string & testPointOrTestCaseId )
Since
9.12.288

◆ setStopConditionForSysTest()

void isys::CTestCase::setStopConditionForSysTest ( const isys::CTestSpecificationSPtr & testSpec)
Since
9.12.288

◆ setTargetException()

void isys::CTestCase::setTargetException ( bool isTargetException)
Since
9.12.288

◆ stopTest()

void isys::CTestCase::stopTest ( )
Since
9.12.288

◆ waitForAnalyzerToDownloadData()

void isys::CTestCase::waitForAnalyzerToDownloadData ( int timeout = 0)
Since
9.12.288