Versions Compared

Key

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

Table of Contents
 

Overview

This app Xray enables an easy integration between with Jenkins and Xray, providing the means for successful Continuous Integration by allowing users to report automated testing results.

Release Notes

Children Display

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

This app was tested against Jenkins v2.32.x and it may not work properly with previous versions. 


Manual Installation

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

...

Info
titleDownload the latest version of the Jenkins Plugin

You may download the latest version of the Jenkins plugin here: Xray Integration wtih Jenkins Plugin.


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. 

...

  1. Configuration alias
  2. Server Address: The address of the Jira Server where Xray is running
  3. Authentication:
    1. User: username
    2. Password.

Creating a new Project

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

For this app, you should configure a "Freestyle project". In the home page, clicking New Item > Freestyle project, provide a name, and then click OK.

Build Steps

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

...

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.

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: 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.

Configuration 

fielddescription
Jira instanceThe Jira instance where Xray is running
FormatA list of test result formats and its specific endpoint
Execution Report File

The results relative file path

Note: regex is not supported.

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

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

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)


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.

...

  1. Pulling the Cucumber project
  2. Exporting Cucumber features from Jira to your Cucumber project
  3. Executing the tests in the CI environment
  4. Importing the execution results back to Jira

Exporting Cucumber features

To start the configuration, add the build step Xray: Cucumber Features Export Task.

...

In this example, we configured the task to extract the features from a set of issues (PROJ-78 and PROJ-79) to the folder that holds the Cucumber project.

Importing the execution results

To start the configuration, add the post-build action Xray: Results Import Task.

...

After running the job, the expected result is a new Test Execution issue created in the Jira instance.

Importing the execution results with user-defined field values

For Cucumber, Behave, JUnit, Nunit and Robot, Xray for Jenkins allows you to create new Test Executions and have control over newly-created Test Execution fields. You can send two files, the normal execution result file and a JSON file similar to the one Jira uses to create new issues. More details regarding how Jira creates new issues here

...

After running the job, the expected result is a new Test Execution issue created in the Jira instance, with the Test Execution fields as specified in the Jenkins build step configuration.

JUnit

Apart from supporting Cucumber natively, Xray enables you to take advantage of many other testing frameworks like JUnit. In this sense, Xray for Jenkins lets you import results in other formats besides Cucumber JSON.

...

  1. Pulling the JUnit project
  2. Executing the tests in the CI environment
  3. Importing the execution results, including Tests, to JIRA

Importing the execution results

To start the configuration, add the post-build action Xray: Results Import Task.

...

After running the plan, the expected result is a new Test Execution issue created in the JIRA instance.

Troubleshooting

The build process is failing with status code 403

When you check the log, it has the following:

...