SpecSync Documentation
Getting StartedConfigurationGuidesDownloads
Azure DevOps
Azure DevOps
  • Introduction to SpecSync for Azure DevOps
  • Getting started
    • Getting started using SpecFlow
    • Getting started using Cucumber or other Gherkin-based BDD tool
  • Installation & Setup
    • Install as .NET tool
    • Install as .NET Console App
    • Install as native binaries for Linux or macOS
    • Install as Docker image
    • Setup and Configure
  • Features
    • Push features
      • Pushing scenario changes to Test Cases
      • Configuring the format of the synchronized test cases
      • Synchronizing Scenario Outlines
      • Add new Test Cases to an Area or an Iteration
      • Mark Test Cases as Automated
      • Setting Test Case state on change
      • Update Test Case fields
      • Attach files to Test Cases using tags
      • Customization: Setting Test Case fields with default values
      • Customization: Update custom Test Case fields on push
      • Customization: Ignoring marked Test Case steps
      • Customization: Ignoring Test Case Tags
      • Customization: Ignore non-supported local tags
      • Customization: Mapping tags
      • Customization: Synchronizing scenarios from feature branches
      • Customization: Reset Test Case state after change
      • Customization: Automatically link changed Test Cases
      • Customization: Synchronize linked artifact titles
      • Customization: Add Test Cases to Suites
      • Customization: Do not synchronize title
    • Pull features
      • Pulling Test Case changes to local scenarios
    • Common synchronization features
      • Configuration key
      • Remote scope
      • Linking Work Items using tags
      • Synchronizing Test Case hierarchies using Test Suites
      • Include synchronized Test Cases to a Test Suite (deprecated)
      • Excluding scenarios from synchronization
      • Synchronization conflict resolution
      • Re-link scenarios to new Test Cases
    • Test result publishing features
      • Publishing test result files
      • Support for Azure DevOps Test Plan / Test Suite based test execution
      • Customization: Publishing test results to multiple Test Suites
    • General features
      • Azure DevOps authentication options
      • Configuration file
      • Hierarchical configuration files
      • Local test case conditions
      • Configuration wizards
      • SpecSync plugins
    • Customizations
    • Plugin list
  • Licensing
  • Guides
    • What is my Azure DevOps project URL?
    • How to define the local feature-set to be synchronized
    • Filters and scopes
    • How to synchronize automated test cases
    • How to use SpecSync from build or release pipeline
    • How to publish test results from pipelines using the VSTest task
    • How to use the SpecSync Azure DevOps pipeline tasks
    • How to link GitHub pull requests
    • How to upgrade to a newer version of SpecSync
    • How to attach files to test results
    • Using SpecSync with SpecFlow+
    • Using SpecSync with Cucumber
    • Using SpecSync with Cypress
    • Using SpecSync with Postman
    • Using SpecSync with TestNG
    • Using SpecSync on macOS or Linux
    • Using SpecSync inside a Docker container
    • How to handle Test Cases of multiple parallel application releases
    • Migrating from SpecSync v3 to v5
    • Migrating from SpecSync v2 to v3
    • Migrating from SpecSync v1 to v2
  • Changelog
  • Release Model and Roadmap
  • Downloads
  • Reference
    • Command line reference
      • init
      • upgrade
      • push
      • pull
      • publish-test-results
      • re-link
      • version
    • Configuration reference
      • toolSettings
      • local
      • remote
      • knownRemotes
      • synchronization
        • push
        • pull
        • automation
        • state
        • areaPath
        • iterationPath
        • links
        • attachments
        • format
        • fieldUpdates
      • hierarchies
      • publishTestResults
      • specFlow
      • reqnroll
      • customizations
    • Compatibility
    • Older versions
  • Contact
    • SpecSync Support
    • Troubleshooting
    • FAQ
  • Project Website
Powered by GitBook
On this page
  • Step 1: Check cypress-cucumber-preprocessor configuration
  • Step 2: Run Cypress tests as usual
  • Step 3: Publish test results with SpecSync
  • Use SpecSync with older version of cypress-cucumber-preprocessor

Was this helpful?

  1. Guides

Using SpecSync with Cypress

PreviousUsing SpecSync with CucumberNextUsing SpecSync with Postman

Last updated 1 year ago

Was this helpful?

Cypress is a popular end to end testing tool that supports BDD-style testing as well.

By configuring Cypress with the cypress-cucumber-preprocessor, you can express your tests as BDD scenarios using the Gherkin format. As the format of the feature files are compatible with SpecSync, you can use SpecSync to synchronize them with Azure DevOps Test Cases. The installation and configuration options are the same as with Using SpecSync with Cucumber.

There are two versions of the cypress-cucumber-preprocessor plugin. This guide focuses on the newer, package, but the section below shows the differences if a project uses the older, unmaintained package.

Publishing test results from Cypress requires a few simple configuration steps.

Perform the following steps to generate the test results correctly with SpecSync.

Step 1: Check cypress-cucumber-preprocessor configuration

In order to publish the test results from Cypress, the Cypress result files (XML files in the results folder) cannot be used, but the cypress-cucumber-preprocessor has to be configured to generate JSON test result files, that also contain step-level results and screenshots as well. This can be done by adding the following configuration section to the package.json configuration file.

package.json
  "cypress-cucumber-preprocessor": {
    "nonGlobalStepDefinitions": false,
    "step_definitions": "cypress/support/step_definitions/",
    "json": {
      "enabled": true,
      "output": "cypress/cucumber-json/cucumber-report.json"
    }
  },

The relevant part of the configuration above is the json setting for the results, as it instructs Cypress to generate a Cucumber-JSON output file for the test execution. In the example above, Cypress is configured to generate this file to cypress/cucumber-json/cucumber-report.json.

Step 2: Run Cypress tests as usual

You can run the Cypress tests now. The test results settings are not relevant for the SpecSync integration, because SpecSync will anyway use the JSON files generated in the folder configured in Step 1.

A simple command invocation is enough:

npx cypress run

or

cypress run

Step 3: Publish test results with SpecSync

If the scenarios have been synchronized earlier already with SpecSync, you will be able to publish the test results from the folder configured in Step 1 using the SpecSync publish-test-results command. For that

  • you have to specify the test result file

  • you have to use cypressCucumberJson as format specifier

The following example publishes the test results from the cypress/cucumber-json/cucumber-report.json file.

dotnet specsync publish-test-results --testResultFileFormat cypressCucumberJson --testResultFile cypress/cucumber-json/cucumber-report.json

The same can be achieved with the short option forms:

dotnet specsync publish-test-results -f cypressCucumberJson -r cypress/cucumber-json/cucumber-report.json

With the configuration and the steps above, the test results are now published to Azure DevOps.

Use SpecSync with older version of cypress-cucumber-preprocessor

The configuration in the package.json should use the cucumberJson setting instead of the json setting like in the example below.

package.json
  "cypress-cucumber-preprocessor": {
    "nonGlobalStepDefinitions": false,
    "step_definitions": "cypress/support/step_definitions/",
    "cucumberJson": {
      "generate": true,
      "outputFolder": "cypress/cucumber-json",
      "filePrefix": "",
      "fileSuffix": ".cucumber"
    }
  },

In this case the outputFolder setting specifies a folder. As there will be multiple report files generated to this folder, when publishing the results with SpecSync, you have to specify the folder as a result instead of an individual result file.

dotnet specsync publish-test-results -f cypressCucumberJson -r cypress/cucumber-json

In case you use the older (unmaintained) version of the package, through the package, the configuration steps are slightly different.

cypress-cucumber-preprocessor
@badeball/cypress-cucumber-preprocessor
cypress-cucumber-preprocessor
"Use SpecSync with older version of cypress-cucumber-preprocessor"