fix(测试跟踪): 修复测试计划点击未执行的case报错的缺陷 (#15998)

--bug=1015053 --user=王孝刚
【测试跟踪】测试计划-执行测试计划时选择失败重试&失败停止-报告中点击接口case中未执行的用例报500error
https://www.tapd.cn/55049933/s/1205319

Co-authored-by: wxg0103 <727495428@qq.com>
This commit is contained in:
MeterSphere Bot 2022-07-21 11:33:00 +08:00 committed by GitHub
parent 8964dec435
commit 4472c320bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 5 deletions

View File

@ -1498,13 +1498,17 @@ public class ApiDefinitionService {
}
APIReportResult reportResult = new APIReportResult();
reportResult.setStatus(result.getStatus());
if (StringUtils.isNotEmpty(result.getEnvConfig())) {
String contentStr = result.getContent();
try {
JSONObject content = JSONObject.parseObject(result.getContent());
content.put("envName", this.getEnvNameByEnvConfig(result.getProjectId(), result.getEnvConfig()));
reportResult.setContent(content.toJSONString());
} else {
reportResult.setContent(result.getContent());
if (StringUtils.isNotEmpty(result.getEnvConfig())) {
content.put("envName", this.getEnvNameByEnvConfig(result.getProjectId(), result.getEnvConfig()));
}
contentStr = content.toString();
} catch (Exception e) {
LogUtil.error("解析content失败!", e);
}
reportResult.setContent(contentStr);
return reportResult;
}