Versions Compared

Key

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

...

  1. Download the required npm packages.

    Code Block
    npm install cypress-mochawesome-reporter junit-report-merger mocha-junit-reporter cypress-multi-reporters mocha
  2. Configure Reporters in the cypress.config.js file

    1. Navigate to Project Root Folder > open cypress.config.js

    2. Append the below code within the module.exports object:

      Code Block
      languagejson
      reporter: 'junit',
      reporterOptions: {
      	mochaFile: 'results/my-test-output-[hash].xml',
      },
  3. Run your test

    1. Run your test with cypress run --reporter junit \--reporter-options "mochaFile=results/my-test-output-[hash].xml"

    2. 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:

  1. https://dzone.com/articles/7-easy-steps-to-generate-xml-and-html-reports-in-cypress

  2. https://dev.to/ganeshsirsi/how-to-generate-both-junit-xml-and-html-reports-in-cypress-step-by-step-guide-4dgd

...