0

我在使用 ZAPI(Zephyr for Jira)时遇到问题,我需要在创建的执行上标记执行,但是当我尝试使用时:Rest API 函数:StepResultResource/Create New StepResult/Create New StepResult

对于先前创建的测试步骤 Rest API 访问完全不同的测试。

你能告诉我在执行时我需要使用哪个函数来执行测试步骤吗?我的代码:

    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'])))

休息 API:https ://getzephyr.docs.apiary.io/

此致,

迈克尔

4

1 回答 1

0

我找到了解决方案。

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
于 2020-04-08T17:30:45.993 回答