Search code examples
jsonxmljunitjunit5jira-xray

JUnit 5 report to json or test runner with json reporting


I have a test documentation tool which accepts reports in XML and JSON. I need to attach screenshots to every test case even the passed ones. Unfortunately, the tool (xRay for Jira) can only digest screenshots in a form of JSON and cannot in XML. I know that cucumber does reports in json but I do not want tests to be BDD-like.

Is there a test runner, which can do reporting in JSON or a solution on how to convert JUnit 5 XML report to appropriate JSON format with screenshots in Base64.

Current set up is Java/Gradle/JUnit5/Selenide but can be reviewed.


Solution

  • Importing attachments, as of today, is supported if you use Xray JSON or Cucumber JSON reports.

    The only way, right now, would be to implement either a JUnit5 TestExecutionListener or a TestWatcher that would generate a Xray JSON report.

    Note: in the short term, support will be added for JUnit 5 and also for TestNG; currently, this is experimental and not yet supported in the product but please raise a support request asking for this improvement, so the team can track your interest on it. The URLs for the previous repos will probably change.