Forum Discussion

antonius2003's avatar
Regular Visitor
3 years ago

Upload test results including info for a testrun (Curl and Python)


I want to upload test results to Zephyr Scale for Jira server using the Rest API automation/execution/<projectKey>.

I can create a cycle and upload test results successfully, but the test cycle info are not applied to the test run in Zephyr Scale.

I tried both Curl and Python, but both failed to upload the test cycle info.

# Curl

curl -X POST "https://<Jira Server>/rest/atm/1.0/automation/execution/<projectKey>?autoCreateTestCases=true" -H "Authorization: Bearer <Jira Token>" -F 'testCycle="{\"name\":\"Full regression\",\"description\":\"Any additional description can be added here.\",\"customFields\":{\"Build Number\":20}}";type=application/json' -F ""
{"testCycle":{"id":141065,"key":"<projectKey>-C159","url":"https://<Jira Server>/secure/Tests.jspa#/testPlayer/<projectKey>-C159"}}


# Python

import os
from json import dumps
import requests

session = requests.Session()
session.verify = False
baseURL = "https://<jira server>/rest/atm/1.0/automation/execution/<projectKey>?autoCreateTestCases=True"

testCycle = {
    "name": "Full regression",
    "description": "Any additional description can be added here.",
    "customFields": {
        "Build Number": 20
files = {
    'testCycle': (None, dumps(testCycle), 'application/json'),
    'file': (os.path.basename(file), open(file, 'rb'), 'application/zip')
headers={"Authorization": "Bearer <Jira token>"}
response =,files=files,headers=headers)


Does somebody has a solution or a working example to this in Curl and Python? Thanks.




No RepliesBe the first to reply