Blog / DevOps & Agile

Xray-logo-white

Import Cucumber Tests with Xray v2.1

Now is possible to migrate your Cucumber tests

Like we said in our article Manual Tests with Test Case Importer, with Xray v2.1 you will be able to import Cucumber Scenario and Scenario Outlines from existing Cucumber .feature files. Yes, really!

This feature will allow you to migrate your existing Cucumber tests to JIRA and to the respective Xray Test issues, making them manageable.

How it works

Xray v2.1 provides an endpoint (/rest/raven/1.0/import/feature) that can be used to submit one .feature file or more, in a .zip file in the later case.

Each “.feature” file will be processed as follows:

  • The “Scenario” or “Scenario Outlines” should be imported to Tests, of the Test Type “Cucumber”, with the respective Cucumber Type filled out.
  • A Test will be uniquely identified by the name of the test case that follows the “Scenario/Scenario Outline” sections. Therefore, if a test is found with the same name, then it will be updated; otherwise, a new Test will be created in JIRA.

The mapping from the Scenario/Scenario Outline present in the .feature files to the Test issues in JIRA will be as follows:

cucumberteststable22

The “Feature” section is not imported since the feature itself should exist previously as a JIRA requirement issue (e.g. story).

The exception is the tags before the “Feature:” section; if a requirement issue is found for the specified key, then a “Tests” link is created between the Test and the requirement issue.

If the cucumber feature has a background, a Pre-Condition issue will be created containing the information provided in that background. If the background has no name, then the Summary of the Pre-Condition is going to be a string containing the keys of the Tests of that Cucumber feature.

Example

Below is an example of a Cucumber .feature file containing a Scenario Outline:

table cucumber tests

cucumbertests2.1

In sum…

Xray v2.1 makes it easier to migrate existing Cucumber tests that you may have already alongside your source code.

For now, this is going to be available as a REST API endpoint that can be used to import one or more Cucumber feature files.

In the future, this may be integrated as a distinct option available in Xray’s Test Case Importer so, it can even be more straightforward for users wishing to import existing Cucumber tests.

Read more about it in our documentation

FacebookTwitterLinkedIn

Leave a reply