14. Xray Integration
Subject7 can be used to integrate with Xray which allows you to sync a Subject7 test case with an Xray Test Key and Test Plan whereby you will see different Test Runs and Test Executions in Xray for each execution started in Subject7.
Hover over Administration menu and click Project Management
Click Integrations tab. You will see the following options:
Select between Cloud or Data Center depending on your instance. If you selected Data Center, you will need to enter a Data Center URL and Personal Access Token.
If you selected Cloud, you will need to enter a Client ID and a Client Secret.
Cloud Setup Instructions
On JIRA, click the Gear icon and navigate to Marketplace apps
Under Xray, click API Keys on the left panel and click Create API Key on the top right.
Select the username and click Generate
The Client ID and Client Secret will be generated, copy each of them
Back on the platform, click Enabled to allow using the input boxes and paste the Client ID and Client Secret.
Select the Data Residency Region where your Xray is in. For more info, check this link
Once finished, click Test Integration to ensure that it works, then click Save.
Click Integration Settings to confirm additional options if you wish to do so.
The Subject7 Default Config updates the Description field in Xray but you can add your own configuration of fields by clicking Add Configuration on the top left.
Add the project key which is essentially the Space Key, then click Create Jira Project Configuration
Click the configuration on the left side to edit it
In the General tab, you can choose to Sync Step Results between Subject7 and Xray. This will automatically fill the steps in your Xray test to match the captions of your Subject7 test case. For example:
In the Fields tab, you can click Add field which will allow you to customize the fields in Xray and pre-fill them with specific values.
The example below is used to update the Label, the Due Date and a custom field created in Xray that we called Subject7:
Result:
To add your custom field ID, you can go to Gear icon > Work Items.
Then click Fields and create a new field
Once finished, click 3 dots next to it and click Contexts and default values
The number will be displayed in the URL. Copy it and use it in customfield_number (as shown in step 14 above)
To troubleshoot whether the above will work or not, you can click the Troubleshooting button highlighted below which will show you any errors if the Field ID is incorrect.
You can troubleshoot by entering a sample Test Case Ticket Key and Test Plan Ticket Key from Xray as follows then click Create Sample Test Execution button:
If the configuration has an issue, you will see a response to explain what went wrong. For example:
{ "error" : "Error creating Test Execution - Issue create failed! - customFieldId_10058: Field 'customFieldId_10058' cannot be set. It is not on the appropriate screen, or unknown." }
Using Xray Integration In Cloud Execution
In order to use Xray Integration in Cloud Execution, you will need to add your Xray Test Case Key and Test Plan Key as follows:
Navigate to the Subject7 test case you would like to link to an Xray test case and click Configure Integrations button. The following window will appear:
Enter the XRay Test Case Ticket Key and click Save. For example, the below icons represent Test Case Ticket Keys
Save your test case.
Hover over Executions menu and click Execution Sets
Create an execution set and select the test case you created earlier. Refer to https://subject7.atlassian.net/wiki/spaces/SD/pages/40468511 if you would like to know more about creating execution sets.
Switch back to General Setup tab and fill out the name of the set and select the pool.
(OPTIONAL) Click Configure Integrations and enter the Xray Test Plan Key under which the Test Case Key exists. In step 2 for example, the Xray Test Plan Key is XRAY-1
If you’d like to schedule the set, add a Schedule under Scheduling section.
Save your execution set and click either Start Schedule or Cloud Run from the toolbar.
After execution finishes, a test execution will be created on Xray to indicate one of the below statuses:
Queued - Xray: ToDo
Completed/Failed - Xray: Failed
Completed/Error - Xray: Failed
Completed/Passed - Xray: Passed
Completed/Fail_Skip - Xray: Passed
Back on Xray, open the test case and click Test Runs button
You will see that an execution was added with an id that matches the generated one in Subject7, while the Sample Execution refers to any execution performed in Project Management (step 22 in the above section).
To see more details, click on the Key which opens the Xray Test Execution
If you used datasets in Subject7, they will be displayed by clicking Dataset icon in the Xray test execution. It will also show you additional information such as the Logs File URL, the Video URL, Browser name and Test Execution ID.
You can also find the same information by clicking on the View Execution button
In the Comment section, you can find the test case artifacts (video, image and logs) while in the Parameters section, you can find the dataset information (same as in step 15)