Forum Discussion

gualashok's avatar
gualashok
Visitor
2 years ago

how to upload junit test result file to existing test cycle

  1.   As of now every time when we upload the junitresult.xml file into the zephyr scale, it creates a new test cycle. but I want to upload it to the existing test cycle and to a specific folder in the same post-call. which is not happening now.
  2.  to customize the test cycle name I am sending the test cycle JSON object along with the junitresultfile.xml but, post-call is ignoring the test cycle JSON object.

below is my request:

  1. import json
    import requests
    def upload_result_to_zyphyr():
    headers = {
    'Authorization': 'Bearer Token'
    }
    params = (
    ('projectKey', 'xxx'),
    ('autoCreateTestCases', 'true'),
    )
    payload = {
    "name": "Sanity",
    "description": "Any additional description can be added here.",
    "jiraProjectVersion": 'null',
    "folderId": 1111111,
    }

    files = {
    'file': open('junitresult.xml', 'rb'),
    }
    data = {'data': json.dumps(payload)}
    response = requests.post('https://api.zephyrscale.smartbear.com/v2/automations/executions/junit', headers=headers,params=params, data=data, files=files)
    print(response.content)


    upload_result_to_zyphyr()

Response:

I am getting a successful response with 200 OK and the result file is getting uploaded into the test cycle but, test cycle customization is not working.

 

Any suggestion on the above-mentioned points will be really appreciable.

 

1 Reply