DEV Community

Raghwendra Sonu
Raghwendra Sonu

Posted on

Generate Allure reports in Cypress Framework

To generate an HTML Allure report in the Cypress framework, you can follow these steps:

Install the Allure Command Line tool:

The Allure Command Line tool is required to generate the HTML report. Install it globally using the following command:

npm install -g allure-commandline
Enter fullscreen mode Exit fullscreen mode

Add the Cypress Allure Plugin:

Install the Cypress Allure Plugin by running the following command:

npm install --save-dev @shelex/cypress-allure-plugin
Enter fullscreen mode Exit fullscreen mode

Configure the Cypress plugin:

Open the cypress/plugins/index.js file and add the following code:

const allureWriter = require('@shelex/cypress-allure-plugin/writer');

module.exports = (on, config) => {
  allureWriter(on, config);
  return config;
};

Enter fullscreen mode Exit fullscreen mode

Run your Cypress tests:

Run your Cypress tests using the Cypress command:

npx cypress run
Enter fullscreen mode Exit fullscreen mode

Generate the Allure report:

After running the tests, the Allure report data will be stored in the allure-results directory.

To generate the HTML report, use the following command:

allure generate allure-results --clean && allure open
Enter fullscreen mode Exit fullscreen mode

This command will generate the HTML report based on the data in the allure-results directory and open it in your default browser.

That's it! You have generated an HTML Allure report for your Cypress tests. The report will provide detailed information about the test execution, including test cases, steps, attachments, and more.

Top comments (0)