Reputation: 406
My test structure looks like so:
cypress
integration
module1
module1test1_spec.js
module1test1_spec.js
module2
module2test1_spec.js
module2test1_spec.js
I have set up Cypress to use mocha-multi-reports like in instruction provided under
https://docs.cypress.io/guides/tooling/reporters.html#Multiple-Reporters
My config.json looks exactly like here:
https://github.com/cypress-io/cypress-example-docker-circle#spec--xml-reports
When Cypress finishes testing, results.xml file shows results from last test spec ONLY; module2test1_spec.js
How to configure this to get the aggregated results from all test spec?
Upvotes: 5
Views: 4480
Reputation: 1086
Just to add to the answer above, if you would like to merge all these multiple [hash].xml
created into a single mergedreport.xml
report, then you can use this package junit-report-merger which is useful for running it on CI pipeline which usually looks for a single reporter with a command like the one below:
jrm ./cypress/reports/mergedreport.xml "./cypress/reports/*.xml"
Upvotes: 0
Reputation: 322
You can use [hash].xml in your path.
e.g. ./path_to_your/test-results.[hash].xml. [hash] is replaced by MD5 hash of test results XML. This enables support of parallel execution of multiple mocha-junit-reporter's writing test results in separate files.
https://www.npmjs.com/package/mocha-junit-reporter#results-report
I solved this problem with this way.
my config.json file seems like this:
"reporterEnabled": "spec,json, mocha-junit-reporter",
"mochaJunitReporterReporterOptions": {
"mochaFile": "multiple-results/[hash].xml",
Upvotes: 5