Cypress BDD project with mochawesome HTML and JUnit reports
- Clone the project
- Install below VS Code extensions
Must
- Cucumber (Gherkin) Full Support Good to have
- Code Runner
- Prettier - Code formatter
- Extension settings - Configure the locations of step definition files, so we can make use of Cucumber (Gherkin) Full Support and navigate to step definition
- Make use of scripts added in package.json to complete local setup and start working with Cypress
- We can either trigger scripts directly from package.json or else we can also call script as
npm run <script>
- setup: To install all dependencies
- cypress-run: To execute all test scenarios
- cypress-open: To open cypress UI
- run-smoke-tests: To execute all test scenarios tagged 'Smoke'
- run-regression-tests: To execute all test scenarios tagged 'Regression'
cypress.config.js - Explanation
- Cucumber Preprocessor
await preprocessor.addCucumberPreprocessorPlugin(on, config); on( "file:preprocessor", createBundler({ plugins: [createEsbuildPlugin.default(config)], }) );
- Reporter
cypress-multi-reporters
: Helps in generating multiple reports
await preprocessor.addCucumberPreprocessorPlugin(on, config); on( "file:preprocessor", createBundler({ plugins: [createEsbuildPlugin.default(config)], }) );
cypress-mochawesome-reporter
: To generate HTML reportmocha-junit-reporter
: To generate JUnit report for each feature filemocha
: Required for mocha-junit-reporterjunit-report-merger
: Combine JUnit reports generated by mocha-junit-reporter to single file, so that the same can be published in CICD tools