From 29284d6dbc7104a83105bd84db641103486b6e51 Mon Sep 17 00:00:00 2001 From: Sergio Freire Date: Wed, 6 Mar 2024 12:01:52 +0000 Subject: [PATCH] added test for #212; support for processing properties using cdata --- tests/test_data/XML/root.xml | 5 +++++ tests/test_data/json/root.json | 5 +++-- trcli/__init__.py | 2 +- trcli/readers/junit_xml.py | 5 ++++- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/tests/test_data/XML/root.xml b/tests/test_data/XML/root.xml index ea7dd23..2d5605e 100644 --- a/tests/test_data/XML/root.xml +++ b/tests/test_data/XML/root.xml @@ -11,9 +11,14 @@ + + + skipped by user diff --git a/tests/test_data/json/root.json b/tests/test_data/json/root.json index b29a532..77f6b5a 100644 --- a/tests/test_data/json/root.json +++ b/tests/test_data/json/root.json @@ -26,7 +26,7 @@ "refs": null, "result": { "assignedto_id": null, - "comment": "Finding 1\n\nFinding 2\n\nType: pytest.skip\nMessage: Please skip\nText: skipped by user", + "comment": "Finding 1\n\nFinding 2\n\ntesting:&&qS55!T@\n\nType: pytest.skip\nMessage: Please skip\nText: skipped by user", "defects": null, "elapsed": "159s", "junit_result_unparsed": [], @@ -56,7 +56,8 @@ "template_id": null, "title": "test_testrail_test_suite", "case_fields": { - "custom_case_field": "custom_case_val" + "custom_case_field": "custom_case_val", + "custom_steps": "1. First step\n2. Second step\n3. Third step" }, "type_id": null }, diff --git a/trcli/__init__.py b/trcli/__init__.py index 2cbc28c..bdc0f16 100644 --- a/trcli/__init__.py +++ b/trcli/__init__.py @@ -1 +1 @@ -__version__ = "1.9.2" +__version__ = "1.9.3" diff --git a/trcli/readers/junit_xml.py b/trcli/readers/junit_xml.py index d3eb0f3..1a8a79a 100644 --- a/trcli/readers/junit_xml.py +++ b/trcli/readers/junit_xml.py @@ -138,7 +138,10 @@ def parse_file(self) -> List[TestRailSuite]: if prop.name and prop.name.startswith("testrail_result_comment"): comments.append(prop.value) if prop.name and prop.name.startswith("testrail_case_field"): - case_fields.append(prop.value) + if prop._elem.text is not None: + case_fields.append(prop._elem.text.strip()) + else: + case_fields.append(prop.value) if prop.name and prop.name.startswith("testrail_sauce_session"): sauce_session = prop.value result_fields_dict, error = FieldsParser.resolve_fields(result_fields)