【发布时间】:2022-01-03 15:07:44
【问题描述】:
我正在尝试为导入执行结果调用“POST /rest/raven/1.0/import/execution/cucumber/multipart” - REST
由于这个端点允许你发送两个 JSON 文件,我写了下面的空手道测试
@UploadResultMultiPartURL 场景:将执行结果导出到 xray 测试计划 给定路径“导入/执行/黄瓜/多部分” 并且标头 Authorization = 'Bearer' + accessToken 而多部分文件信息 = { read('classpath:data/testplanwithkey.json'), filename: 'testplanwithkey.json', contentType: 'application/json' } 多部分文件结果 = { read('classpath:JiraReports/cucumber.json'), filename: 'cucumber.json', contentType: 'application/json' } 当方法发布时 并打印响应
我怎么会空手道响应
15:50:50.334 [打印] {
“错误”:“意外字段(结果)”
}
我已附上我的空手道成绩文件以供参考。请告诉我哪里出错了。
我也尝试过使用rest api,我将上传结果,但不确定空手道哪里出了问题: ResponseBody responseBody = given() .multiPart("results", new File(CUCUMBER_RESULT_FILE)) .mul .multiPart("info", "info.json", jiraExecutionJson.getBytes()) .header("Authorization", "Bearer " + jiraTokenGenerator.getXrayToken()) .post(JIRA_IMPORT_EXECUTION_MULTIPART_URL) .getBody();
【问题讨论】:
-
除了向您推荐这个答案之外,我无能为力:stackoverflow.com/a/54527955/143475