From 87c1be77e597930e08c29343cb5f1e6fec09eb22 Mon Sep 17 00:00:00 2001 From: Cody D'Ambrosio Date: Wed, 29 Apr 2026 08:47:16 -0400 Subject: [PATCH 1/2] support case_result_statuses in robot --- trcli/readers/file_parser.py | 6 ++++++ trcli/readers/junit_xml.py | 5 ----- trcli/readers/robot_xml.py | 5 +++-- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/trcli/readers/file_parser.py b/trcli/readers/file_parser.py index 5885408e..f839433b 100644 --- a/trcli/readers/file_parser.py +++ b/trcli/readers/file_parser.py @@ -15,6 +15,12 @@ def __init__(self, environment: Environment): self.filepath = self.check_file(environment.file) self.filename = self.filepath.name self.env = environment + self._case_result_statuses = {} + + def _update_with_custom_statuses(self): + custom_statuses = self.env.params_from_config.get("case_result_statuses", None) + if custom_statuses: + self._case_result_statuses.update(custom_statuses) @staticmethod def check_file(filepath: Union[str, Path]) -> Path: diff --git a/trcli/readers/junit_xml.py b/trcli/readers/junit_xml.py index 65cd9cca..e99a294b 100644 --- a/trcli/readers/junit_xml.py +++ b/trcli/readers/junit_xml.py @@ -91,11 +91,6 @@ def _extract_section_properties(section, processed_props) -> List[TestRailProper return properties - def _update_with_custom_statuses(self): - custom_statuses = self.env.params_from_config.get("case_result_statuses", None) - if custom_statuses: - self._case_result_statuses.update(custom_statuses) - def _extract_case_id_and_name(self, case) -> tuple: case_name = case.name case_id = None diff --git a/trcli/readers/robot_xml.py b/trcli/readers/robot_xml.py index 72e5088f..d193a7e5 100644 --- a/trcli/readers/robot_xml.py +++ b/trcli/readers/robot_xml.py @@ -22,6 +22,8 @@ class RobotParser(FileParser): def __init__(self, environment: Environment): super().__init__(environment) self.case_matcher = environment.case_matcher + self._case_result_statuses = {"pass": 1, "not run": 3, "skip": 4, "fail": 5} + self._update_with_custom_statuses() @staticmethod def check_file(filepath: Union[str, Path]) -> Path: @@ -131,8 +133,7 @@ def _find_suites(self, suite_element, sections_list: List, namespace=""): if line.lower().startswith("- testrail_case_field"): case_fields.append(self._remove_tr_prefix(line, "- testrail_case_field:")) status = test.find("status") - status_dict = {"pass": 1, "not run": 3, "skip": 4, "fail": 5} - status_id = status_dict[status.get("status").lower()] + status_id = self._case_result_statuses[status.get("status").lower()] elapsed_time = None # if status contains "elapsed" then obtain it, otherwise calculate it from starttime and endtime From 1fc5f5cb90cf41947e7103b23b2dbd0a9787884b Mon Sep 17 00:00:00 2001 From: Cody D'Ambrosio Date: Fri, 1 May 2026 10:36:41 -0400 Subject: [PATCH 2/2] replace status_dict call --- trcli/readers/robot_xml.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/trcli/readers/robot_xml.py b/trcli/readers/robot_xml.py index d193a7e5..7878ed12 100644 --- a/trcli/readers/robot_xml.py +++ b/trcli/readers/robot_xml.py @@ -150,7 +150,7 @@ def _find_suites(self, suite_element, sections_list: List, namespace=""): for kw in keywords: kw_result = kw.find("status").get("status") step = TestRailSeparatedStep(kw.get("name")) - step.status_id = status_dict[kw_result.lower()] + step.status_id = self._case_result_statuses[kw_result.lower()] step_keywords.append(step) result_fields_dict, error = FieldsParser.resolve_fields(result_fields)