Introduction

Maven is a software project management and comprehension tool.

The Xray integration with Maven is possible using an open-source Maven plugin sponsored by the Xray team. This Maven plugin is a wrapper that invokes Xray APIs to achieve its goals.

This plugin allows you to upload Test results to Xray, supporting a wide range of Test reports and formats. It also enables the import and export of Cucumber/Gherkin scenarios to and from Xray, facilitating the implementation of related automation code.

Support for the open-source plugin is handled through the respective GitHub project, in line with regular open-source practices. Users can report issues and suggest ideas, but contributions are also encouraged. Please note that there is no service-level agreement for issues raised on this open-source project, as they will be handled on a best-effort basis by the community.

The previous proprietary Maven plugin provided by the Xray team, which only partially supported Xray Server/DC, has been deprecated. If you are still using the previous proprietary Maven plugin, you will continue to have access to official support. However, please be aware that it has been deprecated, and it is highly recommended to switch to the new plugin.

The Xray Maven plugin offers a powerful integration for managing Automated Tests within Jira, making it easier to manage Test automation results and Cucumber/Gherkin scenarios in Xray. By following the installation and configuration instructions above, you can streamline your Testing process and take full advantage of Xray's capabilities.

Installation and Configuration

This plugin is available on the (Maven) Central Repository, which is configured by default in your Maven installation.

Add the following dependency to your pom.xml. The <configuration> section is optional and should be adapted to your specific use case.

Ensure that you are using Xray on Jira Cloud or Xray on Jira Server/Data Center, as these are two similar but distinct products with slightly different capabilities.


pom.xml sample
        <dependency>
            <groupId>app.getxray</groupId>
            <artifactId>xray-maven-plugin</artifactId>
            <version>0.8.0</version>
            <scope>test</scope>
            <configuration>
                <cloud>true</cloud>
                <clientId>215FFD69FE46447280000000000</clientId>
                <clientSecret>1c00f8f22f56a8684d7c18cd61470000000</clientSecret>
                <projectKey>CALC</projectKey>
                <fixVersion>1.0</fixVersion>
                <reportFormat>junit</reportFormat>
                <reportFile>target/junit.xml</reportFile>
            </configuration>
        </dependency>

Configuration parameters (e.g., reportFormat) can also be specified from the command line using -D (e.g., -Dxray.reportFormat=junit). In this case, the parameters have the xray. prefix.

Configuration set directly in the pom.xml file has higher priority over command-line arguments.

There is a set of common configurations related to Xray details and their authentication. Additionally, each task has its own configuration parameters, as shown below.

Common Configurations

The base configurations depend on whether you're using Xray on Jira Cloud or Xray on Jira Server/Datacenter.

Xray Server/Datacenter Users

(i.e., using Xray on Jira server/datacenter)

Xray on Jira Server/Datacenter is built on top of Jira's REST API, reusing the built-in capabilities provided by Jira.

Authentication is handled either by using a Jira user's username and password or via a Jira Personal Access Token (PAT). These credentials are managed by Jira, not directly by Xray.

ParameterCommand line parameterDescriptionExample
cloudxray.cloudSet to false if not using Xray cloud (default: false)false
jiraBaseUrlxray.jiraBaseUrlJira server/DC base URLhttp://10.0.0.1/
jiraUsernamexray.jiraUsernameUsername of Jira user to use on API callssomeuser
jiraPasswordxray.jiraPasswordPassword of Jira user to use on API callssomepass
jiraTokenxray.jiraTokenJira PAT (Personal Access Token) used instead of username/password-
ignoreSslErrorsxray.ignoreSslErrorsIgnore SSL errors, e.g., expired certificate (default: false)-
timeoutxray.timeoutConnection timeout in seconds (default: 50)-

Xray Cloud Users 

(i.e., using Xray on Jira cloud)

Xray on Jira Cloud uses its own mechanism (i.e., API key pairs) for authenticating requests; contact your Jira admin to obtain the API key (client ID + client secret pair).

If you are using Data Residency capabilities supported by Jira and Xray in the Cloud, you can fine-tune Xray's REST API base URL to use a specific region. While this is optional, it can improve latency on API calls and overall performance when using this plugin.


ParameterCommand line parameterDescriptionExample
cloudxray.cloudSet to true if using Xray cloud (default: false)true
clientIdxray.clientIdClient ID of the API key configured on Xray Cloudxxxx...
clientSecretxray.clientSecretClient secret of the API key configured on Xray Cloudxxxx...
cloudApiBaseUrlxray.cloudApiBaseUrlXray Cloud REST API base URL (default: https://xray.cloud.getxray.app/api/v2); useful for deployments having data residency. Check possible values in the API docshttps://eu.xray.cloud.getxray.app/api/v2
timeoutxray.timeoutConnection timeout in seconds (default: 50)50

Using the Plugin

The plugin provides these tasks:

  • xray:import-results
  • xray:import-features
  • xray:export-features

Importing Test Automation Results

To import Test results, use the xray:import-results task.

 mvn clean compile test xray:import-results

Ensure the pom.xml is configured properly (see available configurations). Alternatively, you can pass configurations directly from the command line as mentioned earlier, or have some in the pom.xml and others specified through command-line parameters.

 mvn clean compile test xray:import-results -Dxray.reportFormat=junit -Dxray.reportFile=results/junit.xml

Xray Server/DC and Xray Cloud support mostly the same formats. Please check the respective product documentation as restrictions may apply.

Configuration Options

There are two ways of importing results. You can either choose one or the other, but not both.

First Way

The first method is simpler (recommended for most users) and is also known as "standard" (due to how it is referred to in terms of the REST API). This method provides a mix of predefined and common parameters (e.g., projectKey, version) that are sufficient for most usage scenarios.

SettingCommand line parameterDescriptionMandatory/OptionalExample
reportFormatxray.reportFormatFormat of the report (JUnit, TestNG, NUnit, Nunit, Xunit, Robot, Cucumber, Behave)MandatoryJUnit
reportFilexray.reportFileFile with the test results (relative or absolute path); it can also be a directory (all .xml files will be imported in this case); finally, it can also be a regex that applies to the current working directoryMandatorytarget/junit.xml
projectKeyxray.projectKeyKey of the Jira project where to import the resultsMandatory (doesn't apply to Cucumber or Behave report formats, for legacy reasons)CALC
testExecKeyxray.testExecKeyIssue key of the Test Execution, in case you want to update the results on itOptionalCALC-2
testPlanKeyxray.testPlanKeyIssue key of the Test Plan to link the results toOptionalCALC-1
versionxray.versionA version of the SUT that corresponds to the Jira project version/release; it will be assigned to the Test Execution issue using the fixVersion(s) fieldOptional1.0
revisionxray.revisionSource code revision or a build identifierOptional123
testEnvironmentxray.testEnvironmentUsually, a Test environment name/identifier (e.g., browser vendor, OS version, mobile device, Testing stage); multiple Test environments may be specified by using ";" as the delimiterOptionalchrome
testInfoJsonxray.testInfoJsonPath to a JSON file containing attributes to apply on the Test Issues that may be created, following the Jira Issue update syntaxOptional-
testExecInfoJsonxray.testExecInfoJsonPath to a JSON file containing attributes to apply on the Test Execution Issue that may be created, following the Jira Issue update syntaxOptional-
abortOnErrorAbort if multiple results are being imported, and exit with an error if uploading results failsoptional--
Second Way

The second method is more flexible and powerful, allowing you to import any kind of Test results, from simple to complex ones (e.g., with multiple Test steps). This method provides flexibility but also requires additional knowledge about the specific Test report format and the associated REST API used for importing the test results.

This method utilizes an external task xray:import that requires the format to be either specified on the command line or defined in the pom.xml.

SettingCommand line parameterDescriptionMandatory/OptionalExample
reportFormatxray.reportFormatFormat of the report (JUnit, TestNG, NUnit, Nunit, Xunit, Robot, Cucumber, Behave)MandatoryJUnit
reportFilexray.reportFileFile with the Test results (relative or absolute path); it can also be a directory (all .xml files will be imported in this case); finally, it can also be a regex that applies to the current working directoryMandatorytarget/junit.xml
testInfoJsonxray.testInfoJsonPath to a JSON file containing attributes to apply to the Test Issues that may be created, following the Jira Issue update syntaxOptionaltestInfo.json
testExecInfoJsonxray.testExecInfoJsonPath to a JSON file containing attributes to apply on the Test Execution Issue that may be created, following the Jira Issue update syntaxOptionaltestExecInfo.json
abortOnErrorabort, if multiple results are being imported, and exit with an error if uploading results fails. False by default.Optional-true

Examples

Importing a file with Junit XML test results to Xray; assign them to a project, version, and Test Plan

In this example you will:

  • Upload a JUnit XML report to Xray.
  • Create a Test Execution and assign it to a given Jira project, release (i.e. project's FixVersion), and Test Plan.
Xray Cloud: pom.xml snippet
        <dependency>
            <groupId>app.getxray</groupId>
            <artifactId>xray-maven-plugin</artifactId>
            <version>0.8.0</version>
            <scope>test</scope>
            <configuration>
                <cloud>true</cloud>
                <clientId>215FFD69FE46447280000000000</clientId>
                <clientSecret>1c00f8f22f56a8684d7c18cd61470000000</clientSecret>
                <projectKey>CALC</projectKey>
                <fixVersion>1.0</fixVersion>
                <testPlanKey>CALC-1200</testPlanKey>
                <reportFormat>junit</reportFormat>
                <reportFile>target/junit.xml</reportFile>
            </configuration>
        </dependency>
Xray server/datacenter: pom.xml snippet
        <dependency>
            <groupId>app.getxray</groupId>
            <artifactId>xray-maven-plugin</artifactId>
            <version>0.8.0</version>
            <scope>test</scope>
            <configuration>
                <cloud>false</cloud>
				<jiraBaseUrl>https://myjiraserver</jiraBaseUrl>
                <jiraUsername>someuser</jiraUsername>
                <jiraPassword>somepass</jiraPassword>
                <projectKey>CALC</projectKey>
                <fixVersion>1.0</fixVersion>
                <testPlanKey>CALC-1200</testPlanKey>
                <reportFormat>junit</reportFormat>
                <reportFile>target/junit.xml</reportFile>
				<abortOnError>true></abortOnError>
            </configuration>
        </dependency>

To import the Test results, you need to invoke the respective task.

mvn clean compile test xray:import-results
Import multiple Junit XML test results to Xray; assign them to a project, version, and Test Plan

In this example, you will:

  • Upload multiple JUnit XML reports to Xray, based on a given regular expression.
  • Create a Test Execution for each imported file, and assign it to a given Jira project, release (i.e. project's FixVersion), and Test Plan.
  • Abort the process, if any of the imports fails.
Xray Cloud: pom.xml snippet
        <dependency>
            <groupId>app.getxray</groupId>
            <artifactId>xray-maven-plugin</artifactId>
            <version>0.8.0</version>
            <scope>test</scope>
            <configuration>
                <cloud>true</cloud>
                <clientId>215FFD69FE46447280000000000</clientId>
                <clientSecret>1c00f8f22f56a8684d7c18cd61470000000</clientSecret>
                <projectKey>CALC</projectKey>
                <fixVersion>1.0</fixVersion>
                <testPlanKey>CALC-1200</testPlanKey>
                <reportFormat>junit</reportFormat>
                <reportFile>target/*.xml</reportFile>
				<abortOnError>true></abortOnError>
            </configuration>
        </dependency>
Xray server/datacenter: pom.xml snippet
        <dependency>
            <groupId>app.getxray</groupId>
            <artifactId>xray-maven-plugin</artifactId>
            <version>0.8.0</version>
            <scope>test</scope>
            <configuration>
                <cloud>false</cloud>
				<jiraBaseUrl>https://myjiraserver</jiraBaseUrl>
                <jiraUsername>someuser</jiraUsername>
                <jiraPassword>somepass</jiraPassword>
                <projectKey>CALC</projectKey>
                <fixVersion>1.0</fixVersion>
                <testPlanKey>CALC-1200</testPlanKey>
                <reportFormat>junit</reportFormat>
                <reportFile>target/*.xml</reportFile>
				<abortOnError>true></abortOnError>
            </configuration>
        </dependency>

To import the Test results, we need to invoke the respective task.

mvn clean compile test xray:import-results

You could also specify some of these options from the command line instead of having them hardcoded in the pom.xml file.

mvn xray:import-features -Dxray.reportFile=target/*.xml
Import a file with Junit XML test results to Xray, and customize fields on the corresponding Test Execution Issue

In this example, you will:

  • Upload a JUnit XML report to Xray.
  • Create a Test Execution and assign it to a given Jira project, release (i.e. project's FixVersion).
  • Additionally, customize some fields on the Test Execution Issue (e.g., set a label, description, or a custom field by its ID - obtainable from Jira administration).
Xray Cloud: pom.xml snippet
        <dependency>
            <groupId>app.getxray</groupId>
            <artifactId>xray-maven-plugin</artifactId>
            <version>0.8.0</version>
            <scope>test</scope>
            <configuration>
                <cloud>true</cloud>
                <clientId>215FFD69FE46447280000000000</clientId>
                <clientSecret>1c00f8f22f56a8684d7c18cd61470000000</clientSecret>
                <reportFormat>junit</reportFormat>
                <reportFile>target/junit.xml</reportFile>
				<testExecInfoJson>testExecInfo.json</testExecInfoJson>
				<testInfoJson>testInfo.json</testInfoJson>
				<abortOnError>true></abortOnError>
            </configuration>
        </dependency>
Xray server/datacenter: pom.xml snippet
        <dependency>
            <groupId>app.getxray</groupId>
            <artifactId>xray-maven-plugin</artifactId>
            <version>0.8.0</version>
            <scope>test</scope>
            <configuration>
                <cloud>false</cloud>
				<jiraBaseUrl>https://myjiraserver</jiraBaseUrl>
                <jiraUsername>someuser</jiraUsername>
                <jiraPassword>somepass</jiraPassword>
                <reportFormat>junit</reportFormat>
                <reportFile>target/junit.xml</reportFile>
				<testExecInfoJson>testExecInfo.json</testExecInfoJson>
				<testInfoJson>testInfo.json</testInfoJson>
				<abortOnError>true></abortOnError>
            </configuration>
        </dependency>

The testExecInfo.json contents are as follows:

testExecInfo.json sample
{
    "fields": {
        "project": {
            "key": "CALC"
        },
        "summary": "Results for some automated tests",
        "description": "For more info please check [here|https://www.example.com]",
        "issuetype": {
            "name": "Test Execution"
        },
        "customfield_11805" : [
            "iOS"
        ],
        "fixVersions" :
                [
                 {
                        "name": "1.0"
                 }
                ]
    }
}

To import the Test results, you need to invoke the respective task.

mvn clean compile test xray:import-results 

You could also specify some of these options from the command line instead of having them hardcoded in the pom.xml file.

mvn xray:import-features -Dxray.reportFile=target/*.xml -Dxray.testExecInfoJson=testExecInfo.json
Import a file with Junit XML test results to Xray, and customize fields on corresponding Test issues

In this example, you will:

  • Upload a JUnit XML report to Xray.
  • Create a Test Execution and assign it to a given Jira project, or release (i.e. project's FixVersion).
  • Customize some fields on the Test Issues (e.g., set a label) that will be provisioned the first time results are imported (if the Tests don't already exist).
Xray Cloud: pom.xml snippet
        <dependency>
            <groupId>app.getxray</groupId>
            <artifactId>xray-maven-plugin</artifactId>
            <version>0.8.0</version>
            <scope>test</scope>
            <configuration>
                <cloud>true</cloud>
                <clientId>215FFD69FE46447280000000000</clientId>
                <clientSecret>1c00f8f22f56a8684d7c18cd61470000000</clientSecret>
                <reportFormat>junit</reportFormat>
                <reportFile>target/junit.xml</reportFile>
				<testExecInfoJson>testExecInfo.json</testExecInfoJson>
				<testInfoJson>testInfo.json</testInfoJson>
				<abortOnError>true></abortOnError>
            </configuration>
        </dependency>
Xray server/datacenter: pom.xml snippet
        <dependency>
            <groupId>app.getxray</groupId>
            <artifactId>xray-maven-plugin</artifactId>
            <version>0.8.0</version>
            <scope>test</scope>
            <configuration>
                <cloud>false</cloud>
				<jiraBaseUrl>https://myjiraserver</jiraBaseUrl>
                <jiraUsername>someuser</jiraUsername>
                <jiraPassword>somepass</jiraPassword>
                <reportFormat>junit</reportFormat>
                <reportFile>target/junit.xml</reportFile>
				<testExecInfoJson>testExecInfo.json</testExecInfoJson>
				<testInfoJson>testInfo.json</testInfoJson>
				<abortOnError>true></abortOnError>
            </configuration>
        </dependency>

The testExecInfo.json contents are as follows:

testExecInfo.json sample
{
    "fields": {
        "project": {
            "key": "CALC"
        },
        "summary": "Test Execution for some automated tests",
        "issuetype": {
            "name": "Test Execution"
        },
        "fixVersions" :
                [
                 {
                        "name": "1.0"
                 }
                ]
    }
}

The testInfo.json contents are as follows:

testInfo.json sample
{
    "fields": {
        "description": "Automated Test",
        "labels": [
            "Automation"
        ]
    }
}

To import the test results, you need to invoke the respective task:

mvn clean compile test xray:import-results 

You could also specify some of these options from the command line instead of having them hardcoded in the pom.xml file.

mvn xray:import-features -Dxray.reportFile=target/*.xml -Dxray.testExecInfoJson=testExecInfo.json -Dxray.testInfoJson=testInfo.json

Importing/Synchronizing Cucumber .feature Files to Xray

One of the possible workflows for using Gherkin-based frameworks is to use Git (or another versioning control system) as the master to store the corresponding .feature files. To provide visibility of Test results for these Tests (i.e. Gherkin scenarios), these need to exist in Xray beforehand. Therefore, you need to import/synchronize them to Xray.

There is no direct integration; the integration is ad-hoc, i.e., the following task is run on a local copy of the repository where the .features are stored.

 mvn clean compile test xray:import-features -Dxray.inputFeatures=features/

How Xray relates the Scenarios/Background to the corresponding Test or Precondition Issues is described in Xray technical documentation (e.g., Xray cloud docs, Xray server/DC docs).

Configuration Options

ParameterCommand line parameterDescriptionMandatory/OptionalExample
projectKeyxray.projectKeyKey of Jira project where to import the Cucumber Scenarios/Backgrounds as Test and Precondition issuesMandatory (if projectId not used)CALC
projectIdxray.projectIdXray Cloud only: ID of Jira project where to import the Cucumber Scenarios/Backgrounds as Test and Precondition IssuesMandatory (if projectKey not used)1000
sourcexray.source-Optional; only applies to Xray cloud
testInfoJsonxray.testInfoJsonPath to a JSON file containing attributes to apply to the Test Issues that may be created, following the Jira Issue update syntaxOptional-
precondInfoJsonxray.precondInfoJsonPath to a JSON file containing attributes to apply to the Precondition Issues that may be created, following the Jira Issue update syntaxOptional-
inputFeaturesxray.inputFeaturesEither a .feature file, a directory containing .feature files, or a zipped file containing .feature filesMandatoryfeatures/
updateRepositoryxray.updateRepositoryCreate folder structure in the Test Repository based on the folder structure in the .zip file containing the .feature files; default is false. Only supported on Xray Server/DC.Optionaltrue

Examples

Importing Scenarios and Backgrounds from existing .feature files in a folder to Xray

In this example, you will:

  • Process all .feature files in the given folder.
  • Create or update existing Cucumber/Gherkin Test(s) and/or Precondition(s) Issues in Xray.
Xray Cloud: pom.xml snippet
        <dependency>
            <groupId>app.getxray</groupId>
            <artifactId>xray-maven-plugin</artifactId>
            <version>0.8.0</version>
            <scope>test</scope>
            <configuration>
                <cloud>true</cloud>
                <clientId>215FFD69FE46447280000000000</clientId>
                <clientSecret>1c00f8f22f56a8684d7c18cd61470000000</clientSecret>
                <featuresPath>features/</featuresPath>
            </configuration>
        </dependency>
Xray server/datacenter: pom.xml snippet
        <dependency>
            <groupId>app.getxray</groupId>
            <artifactId>xray-maven-plugin</artifactId>
            <version>0.8.0</version>
            <scope>test</scope>
            <configuration>
                <cloud>false</cloud>
				<jiraBaseUrl>https://myjiraserver</jiraBaseUrl>
                <jiraUsername>someuser</jiraUsername>
                <jiraPassword>somepass</jiraPassword>
                <featuresPath>features/</featuresPath>
            </configuration>
        </dependency>

To import the Gherkin scenarios, you need to invoke the respective task.

mvn xray:import-features

You could also specify some of these options from the command line instead of having them hardcoded in the pom.xml file.

mvn xray:import-features -Dxray.featuresPath=features/
Importing Scenarios and Backgrounds from existing .feature files in a zipped file to Xray

In this example, you will:

  • Process all .feature files in the given .zip file.
  • Create or update existing Cucumber/Gherkin Test(s) and/or Precondition(s) Issues in Xray.

This can be done just once to import the Test scenarios to Xray or it can be done multiple times, to "synchronize" (i.e., update) the scenarios in Xray.

Xray Cloud: pom.xml snippet
        <dependency>
            <groupId>app.getxray</groupId>
            <artifactId>xray-maven-plugin</artifactId>
            <version>0.8.0</version>
            <scope>test</scope>
            <configuration>
                <cloud>true</cloud>
                <clientId>215FFD69FE46447280000000000</clientId>
                <clientSecret>1c00f8f22f56a8684d7c18cd61470000000</clientSecret>
                <featuresPath>gherkin_features.zip</featuresPath>
            </configuration>
        </dependency>
Xray server/datacenter: pom.xml snippet
        <dependency>
            <groupId>app.getxray</groupId>
            <artifactId>xray-maven-plugin</artifactId>
            <version>0.8.0</version>
            <scope>test</scope>
            <configuration>
                <cloud>false</cloud>
				<jiraBaseUrl>https://myjiraserver</jiraBaseUrl>
                <jiraUsername>someuser</jiraUsername>
                <jiraPassword>somepass</jiraPassword>
                <featuresPath>gherkin_features.zip</featuresPath>
            </configuration>
        </dependency>

To import the Gherkin scenarios, you need to invoke the respective task.

mvn xray:import-features

You could also specify some of these options from the command line instead of having them hardcoded in the pom.xml file.

mvn xray:import-features -Dxray.featuresPath=gherkin_features.zip

Exporting/Generating Cucumber .feature Files from Xray

No matter which workflow you decide to use for dealing with Gherkin-based tests (e.g., Cucumber .feature files and corresponding Scenarios), as part of that workflow comes the need to extract/generate the .feature files based on Scenarios or Backgrounds detailed in Xray using Test or Precondition Issues. This plugin provides a task for this purpose. It will download/generate .feature files to a local folder from existing information in Xray. The .feature and Scenario elements will be properly tagged with info from Xray.

 mvn xray:export-features -Dxray.issueKeys=CALC-1,CALC-2 -Dxray.outputDir=features/

Files on the destination folder will be overwritten; however, if this directory contains other information (including other .feature files) you may need to remove them before generating the .feature files into this directory.

How Xray generates the .feature files with the Scenarios/Background from existing Test or Precondition Issues is described in Xray technical documentation (e.g., Xray cloud docs, Xray server/DC docs).

Configurations for Exporting/Generating Cucumber .feature Files from Xray

ParameterCommand line parameterDescriptionMandatory/optionalExample
issueKeysxray.issueKeysIssue keys of direct or indirect references to Cucumber/Gherkin tests/scenarios (e.g., Test issue keys), delimited by comma

Mandatory (optional if filterId is used instead)

CALC-1,CALC-2
filterIdxray.filterIdID of the Jira filter containing direct or indirect references to Cucumber/Gherkin tests/scenariosMandatory (optional if issueKeys is used instead)12000
outputDirxray.outputDirOutput directory where the .feature files should be extracted toMandatoryfeatures/

Examples

Export Cucumber/Gherkin test scenarios from Xray to a local directory, based on the given Issue keys

In this example, you will:

  • Export two existing Cucumber/Gherkin Test Issues from Xray; these Issue keys could also be referring to story Issues, Test Plans, etc. (Xray will find out the related Cucumber/Gherkin Tests and export those).
  • Generate the corresponding .feature file(s), on a local directory.
Xray Cloud: pom.xml snippet
        <dependency>
            <groupId>app.getxray</groupId>
            <artifactId>xray-maven-plugin</artifactId>
            <version>0.8.0</version>
            <scope>test</scope>
            <configuration>
                <cloud>true</cloud>
                <clientId>215FFD69FE46447280000000000</clientId>
                <clientSecret>1c00f8f22f56a8684d7c18cd61470000000</clientSecret>
                <issueKeys>CALC-1,CALC-2</issueKeys>
                <outputDir>features/</outputDir>
            </configuration>
        </dependency>
Xray server/datacenter: pom.xml snippet
        <dependency>
            <groupId>app.getxray</groupId>
            <artifactId>xray-maven-plugin</artifactId>
            <version>0.8.0</version>
            <scope>test</scope>
            <configuration>
                <cloud>false</cloud>
				<jiraBaseUrl>https://myjiraserver</jiraBaseUrl>
                <jiraUsername>someuser</jiraUsername>
                <jiraPassword>somepass</jiraPassword>
                <issueKeys>CALC-1,CALC-2</issueKeys>
                <outputDir>features/</outputDir>
            </configuration>
        </dependency>

To export the Cucumber/Gherkin Tests and generate the corresponding .feature file(s), you need to invoke the respective task.

mvn xray:export-features

You could also specify some of these options from the command line instead of having them hardcoded in the pom.xml file.

mvn xray:export-features -Dxray.issueKeys=CALC-1,CALC-2 -Dxray.outputDir=features/
Export Cucumber/Gherkin test scenarios from Xray to a local directory, based on the given Jira filter ID

In this example, you will:

  • Export two existing Cucumber/Gherkin Test Issues from Xray, based on a given Jira filter ID; the filter can include Tests directly or related Issues (e.g., story Issues, Test Plans, etc ), and Xray will then find out the related Cucumber/Gherkin Tests and export those.
  • Generate the corresponding .feature file(s), on a local directory.


Xray Cloud: pom.xml snippet
        <dependency>
            <groupId>app.getxray</groupId>
            <artifactId>xray-maven-plugin</artifactId>
            <version>0.8.0</version>
            <scope>test</scope>
            <configuration>
                <cloud>true</cloud>
                <clientId>215FFD69FE46447280000000000</clientId>
                <clientSecret>1c00f8f22f56a8684d7c18cd61470000000</clientSecret>
                <filterId>12345</filterId>
                <outputDir>features/</outputDir>
            </configuration>
        </dependency>
Xray server/datacenter: pom.xml snippet
        <dependency>
            <groupId>app.getxray</groupId>
            <artifactId>xray-maven-plugin</artifactId>
            <version>0.8.0</version>
            <scope>test</scope>
            <configuration>
                <cloud>false</cloud>
				<jiraBaseUrl>https://myjiraserver</jiraBaseUrl>
                <jiraUsername>someuser</jiraUsername>
                <jiraPassword>somepass</jiraPassword>
                <filterId>12345</filterId>
                <outputDir>features/</outputDir>
            </configuration>
        </dependency>

To export the Cucumber/Gherkin tests and generate the corresponding .feature file(s), you need to invoke the respective task.

mvn xray:export-features

You could also specify some of these options from the command line instead of having them hardcoded in the pom.xml file.

mvn xray:export-features -Dxray.filterId=12345 -Dxray.outputDir=features/

FAQs

Is this the same Maven plugin as the original one made by the Xray team?

No. This is a totally new one, made from scratch and open-source.

If I have questions/support issues, where should those be sent?

It's an open-source project, so it should be handled in the GitHub project and supported by the community. If you want to use the previous, proprietary plugin, you can do so and that has commercial support, if you have a valid license; please note that the proprietary Maven plugin has been deprecated.

Are the underlying APIs the same for Xray Derver/DC and Xray Cloud? Are the available options the same? Are the supported Test automation report formats the same?

Not exactly. Xray Server/DC and Xray Cloud, even though similar, are two distinct products; besides, Jira Server/DC and Jira Cloud are different themselves and have different capabilities. This plugin makes use of the available REST APIs for Xray Server/DC and Xray Cloud, so you should check them to see exactly what is supported for your environment.


  • No labels