Page History
Xray supports integration with Continuous Integration tools, thanks to its REST API.For some tools (e.
g. Bamboo, Jenkins), our team provides Xray team has made some add-ons for Jenkins and Bamboo that you can use to easily setup your CI/CD pipeline. These add-ons interact with our public REST API.
If you're using another CI tool, you can still easily integrate with Xray. The Integration with TeamCity page is a good example, where you're able to see how easy is to submit automated test results for different automation frameworks supported by Xray.
make this integration easy. While we're working on making them also compatible with Xray Cloud (soon available), you can still integrate your CI pipeline using the instructions provided here.
Info | ||
---|---|---|
| ||
For TeamCity, there is a free plugin that already supports Xray Cloud. More info here. |
Table of Contents |
---|
CI in a project using Cucumber tests
The steps include:
Authenticate
Export Cucumber, Gherkin base tests from Jira
- Run the tests
- Import the results back to Jira
Authenticate base on the credentials associated with a given API Key
No Format |
---|
token=$(curl -H "Content-Type: application/json" -X POST --data '{ "client_id": "${***}","client_secret": "${***}" }' https://xray.cloud.getxray.app/api/v1/authenticate| tr -d '"') |
Export Cucumber tests
No Format |
---|
curl -H "Content-Type: application/json" --output featureBundle.zip -X GET -H "Authorization: Bearer ${token}" "https://xray.cloud.getxray.app/api/v1/export/cucumber?keys=CALC-1;CALC-3" |
Unzip the tests (Cucumber .feature files)
No Format |
---|
unzip -o featureBundle.zip -d features/ |
Run the tests and save the report
No Format |
---|
cucumber -x -f json -o report.json |
Import the test results to Jira
No Format |
---|
curl -H "Content-Type: application/json" -X POST -H "Authorization: Bearer ${token}" --data @report.json https://xray.cloud.getxray.app/api/v1/import/execution/cucumber |
CI in a project using non-Cucumber tests
If you are using any other framework to specify your test cases, you can also use a CI tool to import the execution results into Xray and Jira.
Xray supports the most common Test Runner reports when importing execution results. These are listed bellow:
- JUnit
- TestNG
- NUnit
If the Test cases being imported are not yet created in Xray/Jira, then Xray will create them automatically. The created tests will have the Generic test type and will contain the identifier or the name in the definition field. Xray will reuse the same Test issues in JIRA for subsequent imports of execution results.
Only one additional step is needed in order to import the execution results using the test runners specified above:
Run the Tests
Authenticate with the Xray REST API
- Import the results back into Jira
Authenticate base on the credentials associated with a given API Key
No Format |
---|
token=$(curl -H "Content-Type: application/json" -X POST --data '{ "client_id": "${***}","client_secret": "${***}" }' https://xray.cloud.getxray.app/api/v1/authenticate| tr -d '"') |
Import the test results to Jira
No Format | |||
---|---|---|---|
curl -H "Content-Type: text/xml" -X POST -H "Authorization: Bearer ${token}" --data @report.xml https://xray.cloud.getxray.app/api/v1/import/execution/junit | |||
Section | |||
|