winIDEA SDK
|
This class stores results of test case run.
Normally it is not intended to be instantiated by clients - call isys::CTestCase::getTestResult() or similar method in the scripting language wrapper to get test results. However, if you'd like to create testIDE-like reports with custom scripts, feel free to use it.
For result analysis the simple method used in itest_sample.py
is enough in most cases:
#include <CTestResult.h>
Inherits isys::CTestResultBase.
Public Types | |
enum | ETestResultSection { E_SECTION_RESULT_COMMENT , E_SECTION_DEFAULT_DOWNLOAD_FILE , E_SECTION_STUB_RESULTS , E_SECTION_TEST_POINT_RESULTS , E_SECTION_STACK_USAGE_RESULTS , E_SECTION_TARGET_EXCEPTION , E_SECTION_PRE_CONDITION , E_SECTION_ASSERT , E_SECTION_LOG , E_SECTION_DRY_RUN_ASSIGNMENTS , E_SECTION_DIAGRAMS , E_SECTION_SCRIPT_ERRORS , E_SECTION_SCRIPT_OUTPUT } |
Test result sections. More... | |
Public Member Functions | |
void | addExprResult (CTestResult::ETestResultSection section, CTestExprResultSPtr &result) |
Adds result of evaluated test expression. More... | |
void | addStubResult (CTestPointResultSPtr &result) |
Adds stub result. | |
void | addTestPointResult (CTestPointResultSPtr &result) |
Adds test point result. | |
void | appendScriptError (const std::string &scriptFunctionType, const std::string &errorDesc) override |
Appends error message of script function. | |
void | appendScriptOutput (const std::string &scriptFunctionType, const std::string &outStr) override |
Appends stdout of script function. | |
CTestBaseListSPtr | getAssertResults (bool isConst) |
Returns list of CTestExprResult -s, one item per assert expression. | |
void | getCoverageResults (isys::StrCoverageTestResultsMap &resultMap) const |
Returns all coverage results. | |
void | getCoverageResultsWithError (isys::StrCoverageTestResultsMap &resultMap) const |
Returns only those coverage results, which do match expected values. | |
std::string | getDefaultDownloadFile () |
Returns default download file name. More... | |
std::string | getExceptionString () override |
If isException() returns true, this method returns the message of the exception. | |
std::string | getFunction () const |
Returns the name of the function under test. | |
CLogResultSPtr | getLogResult (bool isConst) |
Returns object containing logged values. | |
CTestBaseListSPtr | getPreConditionResults (bool isConst) |
Returns list of precondition evaluations. | |
isys::CProfilerTestResultSPtr | getProfilerCodeResult (const std::string areaName) |
Returns profiler code result if exists, NULL otherwise. | |
void | getProfilerCodeResults (isys::StrProfilerTestResultsMap &resultMap) |
Returns all profiler code results. | |
isys::CProfilerTestResultSPtr | getProfilerDataResult (const std::string areaName) |
Returns profiler data result without value set if exists, NULL otherwise. | |
void | getProfilerDataResults (isys::StrProfilerTestResultsMap &resultMap) |
Returns all profiler data results. | |
std::string | getProfilerExportFileName () |
Returns name of the file, where profiler data was exported - this is real file name, without host variables (they were replaced with values before test execution and saved in this class). | |
std::string | getResultComment () override |
Returns comment, which describes specific test run. More... | |
std::string | getScriptError (const std::string &scriptFunctionType) override |
Returns string returned by the given script function. More... | |
std::string | getScriptOutput (const std::string &scriptFunctionType) override |
Returns everything printed to std out by script function. | |
std::string | getTestId () const |
Returns the testId. | |
isys::CTestSpecificationSPtr | getTestSpecification () |
Returns test specification, which produced this result. More... | |
bool | isCodeCoverageError () |
Returns true, if coverage results don't match the test specification requirements. | |
bool | isError () override |
Returns true if any of possible errors occurred - expressions, profiler, coverage, exception, ... | |
bool | isException () override |
Returns true, if an exception was thrown. | |
bool | isExpressionError () |
Returns true, if target values after test run don't match expected values given in test specification (section 'expected'). | |
bool | isPreConditionError () |
Returns true, if conditions verified before test failed. | |
bool | isProfilerCodeError () |
Returns true, if profiler code results don't match the test specification requirements. | |
bool | isProfilerDataError () |
Returns true, if profiler data results don't match the test specification requirements. | |
bool | isScriptError () override |
Returns true, if there was error when executing script functions. | |
bool | isScriptError (const std::string &scriptFunctionType) override |
Returns true, if there was error when executing the given script function. | |
bool | isStackUsageError () override |
Returns true, if there was error in stack usage. | |
bool | isStubError () |
Returns true, if there was error in stub. | |
bool | isTargetException () |
Returns true, if exception was thrown by function on the target. | |
bool | isTargetExceptionError () |
Returns true, if exception was thrown on target, but it is not expected as test result, or it is expected as test result, but it was not thrown on the target. | |
bool | isTestPointError () |
Returns true, if there was error in test points. | |
virtual void | serialize (const isys::IEmitterSPtr &emitter) |
Sends contents of this class to emitter. | |
void | serialize (const isys::IEmitterSPtr &emitter, const isys::CTestReportConfigSPtr &reportConfig) |
Writes result to destination stream, which is usually associated with file. More... | |
void | serializeErrorsOnly (const isys::IEmitterSPtr &emitter, const isys::CTestReportConfigSPtr &reportConfig) |
Writes errors to destination stream, which is usually associated with file. More... | |
void | setLogResult (const CLogResultSPtr &logResult) |
Sets log result. | |
void | setResultComment (const std::string &resultComment) |
Set arbitrary text to appear in test report, for example test description or purpose. | |
void | setStackUsageResult (CStackUsageResultSPtr stackUsageResult) |
Sets Stack usage result. | |
void | setTargetException (bool isTargetException) |
Set to true, if exception on target occurred during test. More... | |
void | setTargetExceptionStr (const std::string &targetException) |
Sets description of target exception. More... | |
std::string | toString () override |
Returns object's data as YAML string. More... | |
std::string | toUIString () |
Returns string readable also as pure text, only errors are included. | |
void isys::CTestResult::addExprResult | ( | CTestResult::ETestResultSection | section, |
CTestExprResultSPtr & | result | ||
) |
Adds result of evaluated test expression.
section | should be CTestResult::E_SECTION_PRE_CONDITION, or CTestResult::E_SECTION_ASSERT, if expression is evaluated before or after test respectively. |
result | result to be added. |
std::string isys::CTestResult::getDefaultDownloadFile | ( | ) |
Returns default download file name.
It is set only when profiler was run during test.
|
override |
Returns comment, which describes specific test run.
This value is typically entered by user after test run and before saving test report.
|
override |
Returns string returned by the given script function.
If there was no error, an empty string is returned.
isys::CTestSpecificationSPtr isys::CTestResult::getTestSpecification | ( | ) |
Returns test specification, which produced this result.
Usually this is the merged test specification.
void isys::CTestResult::serialize | ( | const isys::IEmitterSPtr & | emitter, |
const isys::CTestReportConfigSPtr & | reportConfig | ||
) |
Writes result to destination stream, which is usually associated with file.
emitter | destination object for serialized data |
reportConfig | report configuration. If set to NULL, default configuration is used. If CTestReportConfig::setReportContents(RCONFIG_ERRORS_ONLY) is called, this call is identical to call serializeErrorsOnly() below. |
void isys::CTestResult::serializeErrorsOnly | ( | const isys::IEmitterSPtr & | emitter, |
const isys::CTestReportConfigSPtr & | reportConfig | ||
) |
Writes errors to destination stream, which is usually associated with file.
emitter | destination object for serialized data |
reportConfig | report configuration. If set to NULL, default configuration is used. |
void isys::CTestResult::setTargetException | ( | bool | isTargetException | ) |
Set to true, if exception on target occurred during test.
void isys::CTestResult::setTargetExceptionStr | ( | const std::string & | targetException | ) |
Sets description of target exception.
|
override |
Returns object's data as YAML string.
This method is intended for debugging purposes only, do not parse the returned data!