Skip to content

Commit

Permalink
Merge pull request #215 from gurock/properties_cdata_content
Browse files Browse the repository at this point in the history
added test for #212; support for processing properties using cdata
  • Loading branch information
bitcoder authored Mar 6, 2024
2 parents 432e50c + 29284d6 commit 9fb3c2a
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
5 changes: 5 additions & 0 deletions tests/test_data/XML/root.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,14 @@
<property name="testrail_result_field" value="custom_field:custom_val"/>
<property name="testrail_result_comment" value="Finding 1"/>
<property name="testrail_result_comment" value="Finding 2"/>
<property name="testrail_result_comment" value="testing:&amp;&amp;qS55!T@"/>
<property name="testrail_case_field" value="custom_case_field:custom_case_val"/>
<property name="testrail_result_step" value="passed:Go to homepage"/>
<property name="testrail_result_step" value="failed:Verify content"/>
<property name="testrail_case_field"><![CDATA[custom_steps:1. First step
2. Second step
3. Third step]]>
</property>
</properties>
<skipped type="pytest.skip" message="Please skip">skipped by user</skipped>
</testcase>
Expand Down
5 changes: 3 additions & 2 deletions tests/test_data/json/root.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [],
Expand Down Expand Up @@ -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
},
Expand Down
2 changes: 1 addition & 1 deletion trcli/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "1.9.2"
__version__ = "1.9.3"
5 changes: 4 additions & 1 deletion trcli/readers/junit_xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 9fb3c2a

Please sign in to comment.