Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions trcli/readers/file_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
5 changes: 0 additions & 5 deletions trcli/readers/junit_xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 4 additions & 3 deletions trcli/readers/robot_xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand All @@ -149,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)
Expand Down