Ask a Question

how to upload junit test result file to existing test cycle

gualashok
Visitor

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 1
pbeeby
Occasional Visitor

pbeeby_0-1675212079120.png

I also have this problem - trying to make a POST request and additional JSON which contains information on test cycle for Zephyr scale is always ignored. 

putting this as another Key "testCycle" in the form-data with value 

{
"name":"regression overlays",
"description":"regression testing",
"jiraProjectVersion":1,
"folderId":7367090,
"customFields":null
}

 

trying to following this API doco

https://support.smartbear.com/zephyr-scale-cloud/api-docs/#tag/Automations/operation/createJUnitExec...

 

 

get a request back but test cases are not put inside test cycle which suggest JSON part of request is being ignored.

{
    "testCycle": {
        "id"8411568,
        "key""ICRMK-R70"
    }
}
cancel
Showing results for 
Search instead for 
Did you mean: