Integration Script Explained
Zephyr for Jira is now Zephyr Squad! Read more about this. |
---|
About the script file
You can create Zephyr automation tasks, run them and push test results to Zephyr for Jira directly from your CI/CD workflow. To do this, you can create a special script file that works with Zephyr through API.
You can create this script based on the following sample files:
Windows (.bat)
Linux and MacOS (.sh)
Before using these files, you need to replace values in them – access key, user ids, project key, result file name, and others – with values relevant to your project and tests. Below is a detailed explanation of what you need to change. For quick reference, search for the icon – it indicates the code parts that need to be updated.
You can modify these files in any text editor.
File contents
Description | .bat file | .sh file |
---|---|---|
The script starts with a comment describing the script file. | :: =========================================
:: This .bat file demonstrates how to create or update an automation task in Zephyr for Jira Cloud, run this task, and publish test results to Zephyr.
:: Author: SmartBear Software
:: =========================================
| ######################################################################
# This .sh file demonstrates how to create or update an automation task in Zephyr for Jira Cloud, run this task, and publish test results to Zephyr.
# Author: SmartBear Software
###################################################################### |
This constant specifies the Zephyr base URL. | set "$zephyrBaseUrl=https://prod-api.zephyr4jiracloud.com/connect"
| |
The access and secret keys to connect to Zephyr for Jira, and id of the user account who will “create” or “update” automation tasks. Replace these values with the values relevant to your Jira project and user account. You can find all these values in Jira. 1. Log in to Jira and go to your Jira project. 3. Click API Keys in the menu on the left. 1. Log in to your Jira project. 3. You will see the account id in the browser’s Address bar. Copy this value and paste it to your script. |
| |
This block generates a JSON Web Token (JWT) that is needed to access Zephyr for Jira through API. To create this token, the script sends an API request to Zephyr for Jira. This block doesn’t require changes, you can use it as it is. The created JWT token is time-limited. The expirationTime parameter in the curl line specifies the expiration period in milliseconds: |
| |
This block specifies properties of the automation task to be created or edited. These properties are scripting analogues to task properties you see in the Create Automation Task dialog box. Replace these values with your values. Task info The name of the automation task. An arbitrary descriptive text for the task. String that specifies the framework used for the test run. Case-insensitive. Cycle info Folder info Other values |
| |
This code sends a request to Zephyr for Jira to create an automation task with the specified properties. Zephyr will run this task and import the testing results from the specified file. |
| |
The script file ends with the code that demonstrates how to update an existing automation task. The code uses constants for the task info, cycle, folder and results file defined above. The “new” constant here is taskId. It specifies the id of the automation task to be updated. You get this id in the response to the request that created the task. Replace the taskId constant in the example script with the value that matches your automation task. The rest of the code doesn’t require changes. You can use it as it is. |
|
Starting Release 8.2, Zephyr Enterprise documentation is moving from its current location on Atlassian to a dedicated, standalone Zephyr Enterprise Documentation page. https://support.smartbear.com/zephyr-enterprise/docs/en/welcome-to-zephyr-enterprise.html