Test results
The PyScadeOne services allow to load the test results file in Python objects. TestResultsParser
allows
to use the load()
method to load the test results file and return a TestResults
object.
from ansys.scadeone.core.svc.test.test_results import TestResultsParser
test_results = TestResultsParser.load("testResults.json")
Test results parsing
This section describes the main class for parsing the test results files.
-
class ansys.scadeone.core.svc.test.test_results.TestResultsParser
Bases: BaseTestResults
Parse the Test results file.
-
static load(file: str | Path) → TestResults | None
Read a test results file (.JSON), create and fill a TestResults object.
- Parameters:
- file
Test results file path.
- Returns:
TestResults
Test results object.
- Raises:
ScadeOneException
-
Handling test results
TestResults
represents the test results.
-
class ansys.scadeone.core.svc.test.test_results.TestResults
Bases: BaseTestResults
Test results object.
-
check_version()
Check the version of the test results.
- Raises:
ScadeOneException
If the version is not supported
-
property test_cases: List[TestCase]
Returns the list of test cases.
-
property version: str
Returns the test results version.
Handling test cases
TestCase
represents the test cases of the test results.
-
class ansys.scadeone.core.svc.test.test_results.TestCase
Bases: BaseTestResults
Test case object.
-
property cycles_count: int
Returns the test case cycles count.
-
property end: str
Returns the test case end time.
-
property harness: str
Returns the test harness namespace.
-
property start: str
Returns the test case start time.
-
property status: TestStatus
Returns the test case status.
-
property test_items: List[TestItem]
Returns the list of test items.
Handling test items
TestItem
represents the test items of the test results.
-
class ansys.scadeone.core.svc.test.test_results.TestItem
Bases: BaseTestResults
Test item object.
-
property failures: List[Failure]
Returns the list of failures.
-
property kind: TestItemKind
Returns the test item kind.
-
property model_path: str
Returns the test item model path.
-
property passed_count: int
Returns the test item passed count.
Failure class
Failure
represents the failures of the test items.
-
class ansys.scadeone.core.svc.test.test_results.Failure
Bases: object
Failure object.
-
property actual: str
Returns the failure actual value.
-
property cycle: int
Returns the failure cycle.
-
property expected: str
Returns the failure expected value.
-
property float32_atol: int | float
Returns the absolute tolerance applied in float32 comparisons.
-
property float32_rtol: int | float
Returns the relative tolerance applied in float32 comparisons.
-
property float64_atol: int | float
Returns the absolute tolerance applied in float64 comparisons.
-
property float64_rtol: int | float
Returns the relative tolerance applied in float64 comparisons.
-
property parts_error_paths: List[str]
Returns the list of parts error paths.
Test status enum
TestStatus
represents the status of the test items.
-
class ansys.scadeone.core.svc.test.test_results.TestStatus(value)
Bases: BaseTestResults
, Enum
Test status.
-
Error = 3
Test error.
-
Failed = 2
Test failed.
-
Passed = 1
Test passed.
Test item kind enum
TestItemKind
represents the kind of the test items.
-
class ansys.scadeone.core.svc.test.test_results.TestItemKind(value)
Bases: BaseTestResults
, Enum
Test item kind.
-
Assert = 1
Assert test item.
-
Oracle = 2
Oracle test item.