How to integrate Cypress results with QTM4J?

This article is intended for users who want to integrate Cypress results with QTM4J. QMetry supports import for the following framework files that are JUnit, TestNG, QAF, Cucumber, and Specflow out of the box. Cypress can generate the test results file in JUnit format after the automation project execution which can be further imported to QTM4J. Using the mocha-junit-reporter package of Cypress the test result files are generated in JUnit/XML format.

Note: Any inquiries/issues related to the mentioned documentation are out of QMetry Support’s scope, users can directly reach out to Cypress support for such queries.

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:

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

Test Result Import:

Once the test result files are generated in JUnit/XML format refer to the below links to import them into QMetry for Jira.

  1. Import Test Results in QTM4J

  2. Test using JUnit in QTM4J

For any queries regarding the import of JUnit test results to QTM4J, reach out to QMetry support.