Zephry for Jira API

458 Views Asked by At

I have a problem with ZAPI (Zephyr for Jira) I need to mark execution on my created execution but when I am trying to use: Rest API function: StepResultResource/Create New StepResult/Create New StepResult

For Previously created teststep Rest API access to tottaly different test.

Could You tell me which function I need to use to execute teststeps on execution? My code:

    jsondata = {}
    jsondata['stepId'] = ''
    jsondata['issueId'] = '25137'
    jsondata['executionId'] = '6954'
    jsondata['status'] = '1'
    data_input = ''
    r = requests.post(paths['zapiURL'] + 'latest/stepResult', data_input, jsondata, verify=paths['pathToCertificate'],
                      auth=(cred.getUser(paths['pathToCredentials']), cred.getPw(paths['pathToCredentials'])))

Rest Api: https://getzephyr.docs.apiary.io/

Best regards,

Michal

1

There are 1 best solutions below

0
On

I have found a solution.

jsondata = {}

    jsondata["status"] = data['testStatus']
    jsondata["comment"] = data['testComment']
    #jsondata["defects"] = data['defects']

    headers = {"Content-Type": "application/json"}

    r = requests.put(paths['zapiURL'] + 'latest/stepResult/'+data['testId'], json.dumps(jsondata), headers=headers, verify=paths['pathToCertificate'],
                     auth=(cred.getUser(paths['pathToCredentials']), cred.getPw(paths['pathToCredentials'])))
    o = r.content.decode("utf-8")
    joutput = json.loads(o)
    return joutput