Test using Cypress

Users can integrate Cypress results with QTM4J. QMetry supports import for the framework files JUnit, TestNG, QAF, Cucumber, and Specflow out of the box. Once the automation project is executed, Cypress generates the test results file in JUnit format. The test result files are generated in JUnit/XML format using the mocha-junit-reporter package of Cypress. The generated test results file can be further imported into QTM4J.

→ For Cypress versions above v9.x

You can follow the below steps to generate the result files in JUnit/XML:

  1. Download the required npm packages.

    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:

      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.

→ For Cypress v9.x and below

Refer to the article to generate test result files in JUNIT/XML:

→ Test Result Import

Once the test result files are generated in JUnit/XML format, refer to the following pages to import the result files into QTM4J.