diff --git a/framework/python/src/core/session.py b/framework/python/src/core/session.py index 16c8f056b..22da5145a 100644 --- a/framework/python/src/core/session.py +++ b/framework/python/src/core/session.py @@ -453,6 +453,9 @@ def add_test_result(self, result): if len(result.description) != 0: test_result.description = result.description + # Add details to test result + test_result.details = result.details + # Add recommendations if provided if result.recommendations is not None: test_result.recommendations = result.recommendations diff --git a/framework/python/src/test_orc/test_case.py b/framework/python/src/test_orc/test_case.py index 6f4e3434b..942b41288 100644 --- a/framework/python/src/test_orc/test_case.py +++ b/framework/python/src/test_orc/test_case.py @@ -28,12 +28,14 @@ class TestCase: # pylint: disable=too-few-public-methods,too-many-instance-attr result: str = TestResult.NON_COMPLIANT recommendations: list = field(default_factory=lambda: []) optional_recommendations: list = field(default_factory=lambda: []) + details: str = "" def to_dict(self): test_dict = { "name": self.name, "description": self.description, + "details": self.details, "expected_behavior": self.expected_behavior, "required_result": self.required_result, "result": self.result @@ -47,3 +49,6 @@ def to_dict(self): test_dict["optional_recommendations"] = self.optional_recommendations return test_dict + + def __post_init__(self): + self.details = self.details.replace("\n", "", 1) diff --git a/framework/python/src/test_orc/test_orchestrator.py b/framework/python/src/test_orc/test_orchestrator.py index 58512893e..66a6c7c86 100644 --- a/framework/python/src/test_orc/test_orchestrator.py +++ b/framework/python/src/test_orc/test_orchestrator.py @@ -611,7 +611,8 @@ def _run_test_module(self, module): # Convert dict from json into TestCase object test_case = TestCase(name=test_result["name"], result=test_result["result"], - description=test_result["description"]) + description=test_result["description"] + ) # Add steps to resolve if test is non-compliant if (test_case.result == TestResult.NON_COMPLIANT @@ -619,6 +620,9 @@ def _run_test_module(self, module): test_case.recommendations = test_result["recommendations"] else: test_case.recommendations = [] + # Add details to the test case if presented + if "details" in test_result: + test_case.details = test_result["details"] self.get_session().add_test_result(test_case)