Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagejs
titlecypress.json
{
  "reporter": "junit",
  "reporterOptions": {
    "mochaFile": "results/test-results.xml",
    "testCaseSwitchClassnameAndName": false
  }
}


We then create two tests: a dummy one with an assertion and another one, a bit more complete, that visits a web page and performs some checks against it.

...

After running the tests and generating the JUnit XML reports (e.g. test-results., xml), they can be imported to Xray (either by the REST API, or by one of the CI plugins Xray has or through the Import Execution Results action within the Test Execution).

No Format
curl -H "Content-Type: multipart/form-data" -u admin:admin -F "file=@results/test-results.xml" http://jiraserver/rest/raven/1.0/import/execution/junit?projectKey=CALC

Image Removed


Image Added


Each test JUnit's Test Case is mapped to a Generic Test in Jira, and the Generic Test Definition field contains the value of the "it" concatenated with the several "describe"' that make up the test case" element along with the "it" element again. It is possible to configure the behaviour of "mocha-junit-reporter" to behave differentely; for example, setting "testCaseSwitchClassnameAndName" to true on cypress.json configuration file, will generate a slight different XML report with different name and classname attributes on the testcase element. Please see Taking advantage of JUnit XML reports for more info on the mapping done based on JUnit XML report.


The Execution Details of the Generic Test contains information about the Test Suite, which in this case corresponds to the concatenation of the test's "describe".


Image RemovedImage Added

References