I'm seeking a solution to display Cypress test results, in Azure DevOps results tab in the release pipeline. Right now, Mocha Awesome test results HTML report is created. But need a solution to integrate and show results in the Azure. Could someone please advise on how can we resolve a similar problem?
Currently azure devops results tab donot support html test results. You need to generate xml test result with junit reporter. And then to publish the test results with task Publish Test Results.
So you may need to configure your cypress.json file to specifically set junit as the reporter. For below simple example:
{
"integrationFolder": "cypress/integration/examples",
"reporter": "junit",
"reporterOptions": {
"mochaFile": "tests/test-output-[hash].xml",
"toConsole": true,
"attachments": true
},
"video": false,
"pluginsFile": "cypress/plugins/index.js",
"supportFile": "cypress/support/index.js"
}
And also you need to add task Publish Test Results in your pipeline to publish the test result to azure devops.
In above example shown in the screenshot. I have npm install task to install cypress and other dependencies. The command line task run
npx cypress run
. and at last publish test results task publish the test results to azure devops.
If you want to show the test results in release pipeline. You need to include the test result files in the artifacts and publish the artifacts which has the test results to azure devops. And in your release pipeline add a publish test results task to publish those test results.
There is another way to show test result in release pipeline is to run your cypress test in release pipeline. You need to include you cypress test files in the artifacts and publish to azure devops and run cypress run command in the press pipeline and then publish the test results with publish test results task. You can refer this blog for more information
If you want to azure devops to support html format test results, there are user voices already submit to microsoft. you can go here and vote for this voice or submit a new feature request.