...
Download the required
npm
packages.Code Block npm install cypress-mochawesome-reporter junit-report-merger mocha-junit-reporter cypress-multi-reporters mocha
Configure Reporters in the
cypress.config.js
fileNavigate to Project Root Folder > open
cypress.config.js
Append the below code within the module.exports object:
Code Block language json reporter: 'junit', reporterOptions: { mochaFile: 'results/my-test-output-[hash].xml', },
Run your test
Run your test with
cypress run --reporter junit \--reporter-options "mochaFile=results/my-test-output-[hash].xml"
This will execute all the spec.js files and generate the test results inside Project Root Folder/results.
...
Below are the helpful resources used to generate test result files in JUNIT/XML. :
Resources:
...