Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 10 Next »

This article explains how to push a JSON result file into a Zephyr test cycle.

This article assumes that:

  • Your Jira project contains a Zephyr test cycle with BDD scenarios

  • The BDD scenarios are automated with Cucumber Open

  • The BDD scenarios have been executed from the features files downloaded from the test cycle

  • The test results are stored into a JSON result file named results.json

Instructions

The Zephyr Cloud REST API allows users to push JSON formatted test results. In this tutorial, we will use curl to execute the request but you are free to use any HTTP client.

Endpoint description

POST endpoint

https://prod-api.zephyr4jiracloud.com/connect/public/rest/api/1.0/bdd/results/import

Headers

  • Content-Type: application/json

  • Authorization: JWT <JWT Token>

  • zapiAccessKey: <ZAPI Access Key>

Parameters

  • projectId: Jira project id

  • cycleId: test cycle id

  • versionId: test cycle version id

  • bddresult: JSON test result file

ZAPI keys

To obtain your ZAPI Keys, the ZAPI app should be installed on your Jira. Install this application on Jira like any other application.

Once ZAPI is installed, go to the ZAPI Key Administration page in Jira settings.

Click on the copy button next to the Access Key and the Secret key to copy them.

More documentation about ZAPI app here.

JWT Token

Zephyr Cloud uses a technology called JWT (JSON Web Token) to authenticate API requests. JSON Web Tokens (JWT) are a standard way of representing security claims.

To generate the JWT token, you need:

  • ZAPI access key

  • ZAPI secret key

  • Atlassian Account Id

More informations on how to generate JWT tokens can be found here.

Jira Project Id

There are many ways to find the Jira project Id. You can, for example, use the Jira API but the easier way is to go into the project setting page and to look at in the page URL.

Zephyr Test Cycle Id and Version Id

To obtain the Test Cycle Id and the Version Id:

  1. Select the Zephyr menu → Select the Cycle Summary menu → Select your test cycle

  2. Click on the Detail view

  3. In the breadcrumb, select your test cycle

  4. Look at the page URL to find the ids

Curl command

Run this Curl command next to the results.json file.

curl -X POST 'https://prod-api.zephyr4jiracloud.com/connect/public/rest/api/1.0/bdd/results/import' \
-H 'Authorization: JWT $jwt_token' \
-H 'ZapiAccessKey: $zapi_access_token'  \
-F 'cycleId=$cycle_id&versionId=$version_id&projectId=$project_id' \
-F bddresult=@results.json

You can now see the test results directly into your test cycle.

  • No labels