Xray-App / xray-junit-extensions

Enhanced JUnit 5 integration with Xray Test Management for Jira
Eclipse Public License 2.0
16 stars 8 forks source link

Escaping double quotes in @DisplayName for JUnit 5 test breaks JQL #31

Closed adicusar-lh closed 1 year ago

adicusar-lh commented 1 year ago

When JUnit 5 test is annotated with @DisplayName and it looks like @DisplayName("Error \"Login or/and password are incorrect\"") (double quotes are escaped with backslash) then after extended JUnit report is generated (with test_summary property having that value) on the import we will get {"error":"Invalid JQL query"} image

In Extended XML report " is present which later breaks JQL

To upload results to XRay I have used https://github.com/mikepenz/xray-action To fix it I have used single quotes in the @DisplayName annotation

bitcoder commented 1 year ago

From a JUnit XML format point of view (more XML encoding actually), the current encoding is correct. It produces something like the following:

<property name="test_summary" value="Error &quot;Login or/and password are incorrect&quot;"/>

The standard/built-in JUnit legacy reporter that comes with Junit5 works in the same way. Therefore, the problem is ahead, namely on Xray cloud endpoint. Having said, I would advise reaching out Xray support team and give an example of the Junit XML file you're trying to import. I took already the opportunity to raise a bug internally

adicusar-lh commented 1 year ago

Thank you for reply and for raising the bug. I will close the issue so it could be useful for others if they find themselves in the same situation.