In the steps below, we'll start with a project that has an existing Cypress test suite, and we'll add JUnit XML as an additional output format for the test suite.
1. Update your CI workflow to output JUnit XML reports describing the test results.
Below we add the junit reporter when running the test suite, and we tell it to write the reports to the cypress/results/ directory at the root of the project.
@@ -13,4 +13,4 @@ blocks:
- sem-version node 12
- npm install
- - npx cypress run
+ - npx cypress run --reporter junit --reporter-options "mochaFile=cypress/results/results-[hash].xml"
This example project uses Semaphore for CI, so we're updating the CI workflow in
.semaphore/semaphore.yml. If you're using a different CI service, apply this change wherever your CI script is defined (e.g.,
.circleci/config.yml for CircleCI, etc.).
2. Commit this change to your repository.
git commit -am "Update CI to generate JUnit XML for test results"