Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Children Display
sortcreation
reversetrue

Upgrading to version 2.1.1

Warning
titleUpgrading from version below 2.1.1
  1. Uninstall the old version of the plugin (xray-for-jira-connector)
  2. Go to the Xray configuration section and re-write your instances credentials
  3. Re-save (you don't need to change any data) any Project/Job that is using Xray steps.

Installation

The installation is made manually. For more information on how to install add-ons, please refer to how to install add-ons.

Info
titleRequirements

The Jenkins baseline for this app is v2.60.3 and it may not work properly with previous versions. 

...

Info
titleDownload the latest version of the Jenkins Plugin

You may download the latest version of the Jenkins plugin from the latest Release Notes.

If you have the actual xray-connector.hpi file,

  1. Go to the Update Center of Jenkins in Manage Jenkins > Manage Plugins.
  2. Select the advanced tab
  3. In the Upload Plugin section, click upload and select the file xray-connector.hpi file.

Jenkins Native Installation (via web UI)

Since version 2.1.0, you can install the plugin by using the Jenkins native Web UI. You can read more about how to to it here.

Configuration

Xray for Jenkins is configured in the global settings configuration page  Manage Jenkins > Configure System > Xray for Jira configuration.

Jira servers

The Jira servers configuration defines connections with Jira instances. 

To add a new Jira instance connection, you need to specify some properties:

  1. Configuration alias
  2. Hosting: Hosting (instance type) in this case Server/Data Center.
  3. Server Address: The address of the Jira Server where Xray is running
  4. Credentials:
    1. Use the Jenkins Credentials Plugin to set the username/password (if you are using a Server/Data Center instance).
    2. Make sure that the user you are using have the following permissions in the projects where you want to import the results and import/export feature files: View, Edit, Create.

...

Installation

The installation is made manually. For more information on how to install add-ons, please refer to how to install add-ons.


Info
titleRequirements

The Jenkins baseline for this app is v2.60.3 and it may not work properly with previous versions. 


Manual Installation


Info
titleDownload the latest version of the Jenkins Plugin

You may download the latest version of the Jenkins plugin from the latest Release Notes.


If you have the actual xray-connector.hpi file,

  1. Go to the Update Center of Jenkins in Manage Jenkins > Manage Plugins.
  2. Select the advanced tab
  3. In the Upload Plugin section, click upload and select the file xray-connector.hpi file.


Jenkins Native Installation (via web UI)

Since version 2.1.0, you can install the plugin by using the Jenkins native Web UI. You can read more about how to to it here.

Configuration

Xray for Jenkins is configured in the global settings configuration page  Manage Jenkins > Configure System > Xray for Jira configuration.

Jira servers

The Jira servers configuration defines connections with Jira instances. 

To add a new Jira instance connection, you need to specify some properties:

  1. Configuration alias
  2. Hosting: Hosting (instance type) in this case Server/Data Center.
  3. Server Address: The address of the Jira Server where Xray is running
  4. Credentials:
    1. Use the Jenkins Credentials Plugin to set the username/password (if you are using a Server/Data Center instance).
    2. Make sure that the user you are using have the following permissions in the projects where you want to import the results and import/export feature files: View, Edit, Create.

note: the Configuration ID is not editable. This value can be used in the pipelines scripts.


Info
titlePlease note

The user present in this configuration must exist in the JIRA instance and have permission to Create Test and Test Execution Issues

Image Added

Creating a new Project

The project is where the work that should be performed by Jenkins is configured.

For this app, you can configure:

  • Freestyle projects
  • Maven Projects
  • Multi-configuration Projects
  • Pipeline Projects

In the home page, clicking for example New Item > Freestyle project, provide a name, and then click OK.

Image Added

Build Steps

Build steps are the building blocks of the build process. These need to be defined in the project configuration.

The app provides

  • one build step for exporting Cucumber Scenario/Scenario Outlines from Jira as .feature files
  • one build step for importing Cucumber Tests from existing Cucumber features into Jira.
  • one post-build action which publishes the execution results back to Jira, regardless of the build process status.


Info
titlePlease note
The user present in this configuration must exist in the JIRA instance and have permission to Create Test and Test Execution Issues

Image Removed

Creating a new Project

The project is where the work that should be performed by Jenkins is configured.

For this app, you can configure:

  • Freestyle projects
  • Maven Projects
  • Multi-configuration Projects
  • Pipeline Projects

In the home page, clicking for example New Item > Freestyle project, provide a name, and then click OK.

Image Removed

Build Steps

Build steps are the building blocks of the build process. These need to be defined in the project configuration.

The app provides

  • one build step for exporting Cucumber Scenario/Scenario Outlines from Jira as .feature files
  • one build step for importing Cucumber Tests from existing Cucumber features into Jira.
  • one post-build action which publishes the execution results back to Jira, regardless of the build process status.
Info
titlePlease note
The fields of the tasks may take advantage of the Jenkins Environment variables, which can be used to populate fields such as the "Revision" for specifying the source code's revision. For more information, please see Jenkins set environment variables.

Xray: Cucumber Features Export Task

This build step will export the Cucumber Tests (i.e., Scenario/Scenario Outlines) in .feature or bundled in a .zip file. The rules for exporting are defined here.

fields of the tasks may take advantage of the Jenkins Environment variables, which can be used to populate fields such as the "Revision" for specifying the source code's revision. For more information, please see Jenkins set environment variables.

Xray: Cucumber Features Export Task

This build step will export the Cucumber Tests (i.e., Scenario/Scenario Outlines) in .feature or bundled in a .zip file. The rules for exporting are defined here.

It invokes Xray's Export Cucumber Tests REST API endpoint (see more information here).

Configuration

Some fields need to be configured in order to export the Cucumber Tests. As input, you can either specify issue keys (see the endpoint documention here) or the ID of the saved filter in Jira.

fielddescription
Jira instanceThe Jira instance where Xray is running
Issue keysSet of issue keys separated by ";"

Filter ID

A number that indicates the filter ID
File path

The relative path of the directory where the features should be exported to; normally, this corresponds to the "features" folder of the Cucumber project that has the implementation steps. Note: The directory will be created if it does not exist.

Xray: Cucumber Features Import Task

This build step will import existing cucumber Tests from existing Cucumber feature files into Xray issues. This Task will import from .feature files and also from .zip files.

It invokes Xray's Import Cumcumber It invokes Xray's Export Cucumber Tests REST API endpoint (see more information here)

fielddecription
JIRA instanceThe Jira instance where Xray is running.

Configuration

Some fields need to be configured in order to export the Cucumber Tests. As input, you can either specify issue keys (see the endpoint documention here) or the ID of the saved filter in Jira.

...

Filter ID

...

The relative path of the directory where the features should be exported to; normally, this corresponds to the "features" folder of the Cucumber project that has the implementation steps. Note: The directory will be created if it does not exist.

Project KeyThis is the project where the Tests and Pre-Conditions will be created/updated.
Cucumber feature files directoryThis is the directory containing your feature files. All the files in this directory and sub directories will be imported.
Modified in the last hoursBy entering an integer n here, only files that where modified in the last n hours will be imported. 
Leave empty if you do not want to use this parameter.


Xray: Results Import Task

The app provides easy access to Xray's Import Execution Results REST API endpoints (see more information here). Therefore, it mimics the endpoints input parameters.

It supports importing results in Xray's own JSON format, Cucumber, Behave, JUnit, and NUnit, among others.

Using a glob expression, you can import multiple results files in the following formats:

  • JUnit
  • TestNG
  • NUnit
  • Robot framework

For those formats, the file path needs to be relative to the workspace.

Configuration 

fielddescription
Jira

Xray: Cucumber Features Import Task

This build step will import existing cucumber Tests from existing Cucumber feature files into Xray issues. This Task will import from .feature files and also from .zip files.

It invokes Xray's Import Cumcumber Tests REST API endpoint (see more information here)

fielddecription
JIRA instanceThe Jira instance where Xray is running.
Project KeyThis is the project where the Tests and Pre-Conditions will be created/updated.
Cucumber feature files directoryThis is the directory containing your feature files. All the files in this directory and sub directories will be imported.
Modified in the last hoursBy entering an integer n here, only files that where modified in the last n hours will be imported. 
Leave empty if you do not want to use this parameter.

Xray: Results Import Task

The app provides easy access to Xray's Import Execution Results REST API endpoints (see more information here). Therefore, it mimics the endpoints input parameters.

It supports importing results in Xray's own JSON format, Cucumber, Behave, JUnit, and NUnit, among others.

Using a glob expression, you can import multiple results files in the following formats:

  • JUnit
  • TestNG
  • NUnit
  • Robot framework

For those formats, the file path needs to be relative to the workspace.

Configuration 

...

The results relative file path

Note: glob expressions are supported for

  • JUnit
  • JUnit Multipart
  • TestNG
  • TestNG Multipart
  • NUnit
  • NUnit Multipart
  • Robot framework
  • Robot framework Multipart

Additional fields

Depending on the chose test result format and endpoint, some additional fields may need to be configured.

...

Behave JSON multipart

Cucumber JSON multipart

NUnit XML multipart

JUnit XML multipart

Robot XML multipart

TestNG XML multipart

...

Test execution fields

An object (JSON) specifying the fields for the issue. You may specify the object either directly in the field or in the file path.

Info
titleLearn more

The custom field IDs can be obtained using the Jira REST API Browser tool included in Jira. Each ID is of the form "customfield_ID".

Another option, which does not require Jira administration rights, is to invoke the "Get edit issue meta" in an existing issue (e.g., in a Test issue) as mentioned here.

Example: GET http://yourserver/rest/api/2/issue/CALC-1/editmeta 

FormatA list of test result formats and its specific endpoint
Execution Report File

The results relative file path

Note: glob expressions are supported for

  • JUnit
  • JUnit Multipart
  • TestNG
  • TestNG Multipart
  • NUnit
  • NUnit Multipart
  • Robot framework
  • Robot framework Multipart

Additional fields

Depending on the chose test result format and endpoint, some additional fields may need to be configured.

Format and specific endpointFieldDescription

Behave JSON multipart

Cucumber JSON multipart

NUnit XML multipart

JUnit XML multipart

Robot XML multipart

TestNG XML multipart

Import to Same Test ExecutionWhen this option is check, if you are importing multiple execution report files using a glob expression, the results will be imported to the same Test Execution

Test execution fields

An object (JSON) specifying the fields for the issue. You may specify the object either directly in the field or in the file path.



Info
titleLearn more

The custom field IDs can be obtained using the Jira REST API Browser tool included in Jira. Each ID is of the form "customfield_ID".

Another option, which does not require Jira administration rights, is to invoke the "Get edit issue meta" in an existing issue (e.g., in a Test issue) as mentioned here.

Example: GET http://yourserver/rest/api/2/issue/CALC-1/editmeta 


NUnit XML

JUnit XML

Robot XML

TestNG XML

Import to Same Test ExecutionWhen this option is check, if you are importing multiple execution report files using a glob expression, the results will be imported to the same Test Execution
Project keyKey of the project where the Test Execution (if the Test Execution Key field wasn't provided) and the Tests (if they aren't created yet) are going to be created
Test execution key

Key of the Test Execution

Test plan keyKey of the Test Plan
Test environmentsList of Test Environments separated by ";"
RevisionSource code's revision being target by the Test Execution
Fix versionThe Fix Version associated with the test execution (it supports only one value)

Xray: Build Enviroment Variables

Since version 2.2.0, the Xray plugin will now set some build enviroment variables according to the operation result after each of the Xray Steps mensioned above.


Build Enviroment Variable NameMeaning and Value

XRAY_IS_REQUEST_SUCCESSFUL

Contains the string 'true' if all requests made by the step were sucesseful, or 'false' otherwise.

XRAY_ISSUES_MODIFIED

All Issue keys that were modified and/or created by the step, seperated by ';' with no duplicated entries (E.g. 'CALC-100;CALC-101;CALC-102').

XRAY_RAW_RESPONSE

The unprocessed JSON response of all requests made by the step, seperated by ';'.

XRAY_TEST_EXECS

All Test Execution Issue keys that were modified and/or created by the step, seperated by ';' with no duplicated entries (E.g. 'CALC-200;CALC-201;CALC-202').

Please note that in same cases, it will be not possible to determine the issue type of the Issue key returned in the request response and in that case, the key it will only be added to the XRAY_ISSUES_MODIFIED variable.

XRAY_TEST

All Test Issue keys that were modified and/or created by the step, seperated by ';' with no duplicated entries (E.g. 'CALC-300;CALC-301;CALC-302').

Please note that in same cases, it will be not possible to determine the issue type of the Issue key returned in the request response and in that case, the key it will only be added to the XRAY_ISSUES_MODIFIED variable.

Info
titlePipeline Project Limitations

Due to Jenkins limitations, these variables will not be set on Pipeline projects.

Image Added

NUnit XML

JUnit XML

Robot XML

TestNG XML

...

Key of the Test Execution

...


Examples

Cucumber

In a typical Cucumber Workflow, after having created a Cucumber project and the Cucumber tests specified in Jira, you may want to have a project that exports the features from Jira, executes the automated tests on a CI environment and then imports back its results.

...