This class stores results of test case run. More...
#include <CTestResult.h>
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 | addDiagram (const std::string &imageFileName) |
| void | addDryRunAssignment (const std::string &varName, const std::string &value) |
| void | addExprResult (CTestResult::ETestResultSection section, CTestExprResultSPtr &result) |
| Adds result of evaluated test expression. | |
| 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. | |
| CTestBaseSPtr | createInstance (const CTestBaseSPtr &parent) const override |
| CTestResult (const isys::CTestSpecificationSPtr &testSpecification) | |
| std::string | diffsToUIString (CTestResult::ETestResultSection section) |
| std::string | getAnalyzerFileName () |
| The following methods are reserved for iSYSTEM internal use. | |
| 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. | |
| 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. | |
| std::string | getScriptError (const std::string &scriptFunctionType) override |
| Returns string returned by the given script function. | |
| std::string | getScriptOutput (const std::string &scriptFunctionType) override |
| Returns everything printed to std out by script function. | |
| CStackUsageResultSPtr | getStackUsageResult (bool isConst) |
| CTestBaseListSPtr | getStubResults (bool isConst) |
| std::string | getTestId () const |
| Returns the testId. | |
| CTestBaseListSPtr | getTestPointResults (bool isConst) |
| isys::CTestSpecificationSPtr | getTestSpecification () |
| Returns test specification, which produced this result. | |
| 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. | |
| void | serializeErrorsOnly (const isys::IEmitterSPtr &emitter, const isys::CTestReportConfigSPtr &reportConfig) |
| Writes errors to destination stream, which is usually associated with file. | |
| void | setDefaultDownloadFile (const std::string &defaultDlFileName) |
| 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. | |
| void | setTargetExceptionStr (const std::string &targetException) |
| Sets description of target exception. | |
| void | setTestSpecification (isys::CTestSpecificationSPtr &testSpec) |
| std::string | toString () override |
| Returns object's data as YAML string. | |
| std::string | toUIString () |
| Returns string readable also as pure text, only errors are included. | |
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:
Python example: create_test_report.py
| isys::CTestResult::CTestResult | ( | const isys::CTestSpecificationSPtr & | testSpecification | ) |
| void isys::CTestResult::addDiagram | ( | const std::string & | imageFileName | ) |
| void isys::CTestResult::addDryRunAssignment | ( | const std::string & | varName, |
| const std::string & | value ) |
| 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. |
| void isys::CTestResult::addStubResult | ( | CTestPointResultSPtr & | result | ) |
Adds stub result.
| void isys::CTestResult::addTestPointResult | ( | CTestPointResultSPtr & | result | ) |
Adds test point result.
|
override |
Appends error message of script function.
|
override |
Appends stdout of script function.
|
override |
| std::string isys::CTestResult::diffsToUIString | ( | CTestResult::ETestResultSection | section | ) |
| std::string isys::CTestResult::getAnalyzerFileName | ( | ) |
The following methods are reserved for iSYSTEM internal use.
| CTestBaseListSPtr isys::CTestResult::getAssertResults | ( | bool | isConst | ) |
Returns list of CTestExprResult -s, one item per assert expression.
| void isys::CTestResult::getCoverageResults | ( | isys::StrCoverageTestResultsMap & | resultMap | ) | const |
Returns all coverage results.
| void isys::CTestResult::getCoverageResultsWithError | ( | isys::StrCoverageTestResultsMap & | resultMap | ) | const |
Returns only those coverage results, which do match expected values.
| std::string isys::CTestResult::getDefaultDownloadFile | ( | ) |
Returns default download file name.
It is set only when profiler was run during test.
|
override |
If isException() returns true, this method returns the message of the exception.
| std::string isys::CTestResult::getFunction | ( | ) | const |
Returns the name of the function under test.
| CLogResultSPtr isys::CTestResult::getLogResult | ( | bool | isConst | ) |
Returns object containing logged values.
| CTestBaseListSPtr isys::CTestResult::getPreConditionResults | ( | bool | isConst | ) |
Returns list of precondition evaluations.
| isys::CProfilerTestResultSPtr isys::CTestResult::getProfilerCodeResult | ( | const std::string | areaName | ) |
Returns profiler code result if exists, NULL otherwise.
| void isys::CTestResult::getProfilerCodeResults | ( | isys::StrProfilerTestResultsMap & | resultMap | ) |
Returns all profiler code results.
| isys::CProfilerTestResultSPtr isys::CTestResult::getProfilerDataResult | ( | const std::string | areaName | ) |
Returns profiler data result without value set if exists, NULL otherwise.
| void isys::CTestResult::getProfilerDataResults | ( | isys::StrProfilerTestResultsMap & | resultMap | ) |
Returns all profiler data results.
| std::string isys::CTestResult::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).
|
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.
|
override |
Returns everything printed to std out by script function.
| CStackUsageResultSPtr isys::CTestResult::getStackUsageResult | ( | bool | isConst | ) |
| CTestBaseListSPtr isys::CTestResult::getStubResults | ( | bool | isConst | ) |
| std::string isys::CTestResult::getTestId | ( | ) | const |
Returns the testId.
| CTestBaseListSPtr isys::CTestResult::getTestPointResults | ( | bool | isConst | ) |
| isys::CTestSpecificationSPtr isys::CTestResult::getTestSpecification | ( | ) |
Returns test specification, which produced this result.
Usually this is the merged test specification.
| bool isys::CTestResult::isCodeCoverageError | ( | ) |
Returns true, if coverage results don't match the test specification requirements.
|
override |
Returns true if any of possible errors occurred - expressions, profiler, coverage, exception, ...
|
override |
Returns true, if an exception was thrown.
| bool isys::CTestResult::isExpressionError | ( | ) |
Returns true, if target values after test run don't match expected values given in test specification (section 'expected').
| bool isys::CTestResult::isPreConditionError | ( | ) |
Returns true, if conditions verified before test failed.
| bool isys::CTestResult::isProfilerCodeError | ( | ) |
Returns true, if profiler code results don't match the test specification requirements.
| bool isys::CTestResult::isProfilerDataError | ( | ) |
Returns true, if profiler data results don't match the test specification requirements.
|
override |
Returns true, if there was error when executing script functions.
|
override |
Returns true, if there was error when executing the given script function.
|
override |
Returns true, if there was error in stack usage.
| bool isys::CTestResult::isStubError | ( | ) |
Returns true, if there was error in stub.
| bool isys::CTestResult::isTargetException | ( | ) |
Returns true, if exception was thrown by function on the target.
| bool isys::CTestResult::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 isys::CTestResult::isTestPointError | ( | ) |
Returns true, if there was error in test points.
| virtual void isys::CTestBase::serialize | ( | const isys::IEmitterSPtr & | emitter | ) |
Sends contents of this class to emitter.
| 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::setDefaultDownloadFile | ( | const std::string & | defaultDlFileName | ) |
| void isys::CTestResult::setLogResult | ( | const CLogResultSPtr & | logResult | ) |
Sets log result.
| void isys::CTestResult::setResultComment | ( | const std::string & | resultComment | ) |
Set arbitrary text to appear in test report, for example test description or purpose.
| void isys::CTestResult::setStackUsageResult | ( | CStackUsageResultSPtr | stackUsageResult | ) |
Sets Stack usage result.
| void isys::CTestResult::setTargetException | ( | bool | isTargetException | ) |
Set to true, if exception on target occurred during test.
| void isys::CTestResult::setTargetExceptionStr | ( | const std::string & | targetException | ) |
| void isys::CTestResult::setTestSpecification | ( | isys::CTestSpecificationSPtr & | testSpec | ) |
|
override |
Returns object's data as YAML string.
This method is intended for debugging purposes only, do not parse the returned data!
| std::string isys::CTestResult::toUIString | ( | ) |
Returns string readable also as pure text, only errors are included.