fix(测试计划): 修复测试计划报表点击未执行的报表会报错的问题

--bug=1008134 --user=宋天阳 【github#7888】点开执行中的测试计划日志,展示的是之前的旧数据
https://www.tapd.cn/55049933/s/1072863
This commit is contained in:
song-tianyang 2021-11-23 13:51:53 +08:00 committed by song-tianyang
parent 93ff760fa8
commit 189ce568f7
4 changed files with 11 additions and 8 deletions

View File

@ -741,13 +741,13 @@ public class TestPlanApiCaseService {
String reportId = testPlanApiCaseReportMap.get(testPlanApiCaseId);
dto.setReportId(reportId);
if(StringUtils.isEmpty(reportId)){
dto.setStatus(defaultStatus);
dto.setExecResult(defaultStatus);
}else {
String status = reportResult.get(reportId);
if(status == null){
status = defaultStatus;
}
dto.setStatus(status);
dto.setExecResult(status);
}
}
return buildCases(apiTestCases);

View File

@ -511,7 +511,7 @@ public class TestPlanScenarioCaseService {
if(status == null ){
status = defaultStatus;
}
dto.setStatus(status);
dto.setLastResult(status);
}
}

View File

@ -1728,7 +1728,6 @@ public class TestPlanService {
if (MapUtils.isEmpty(executeInfo.getApiCaseExecInfo()) && MapUtils.isEmpty(executeInfo.getApiScenarioCaseExecInfo())) {
return;
}
ApiDefinitionExecResultMapper apiDefinitionExecResultMapper = CommonBeanFactory.getBean(ApiDefinitionExecResultMapper.class);
if (checkReportConfig(config, "api")) {
List<TestPlanFailureApiDTO> apiAllCases = null;
List<TestPlanFailureScenarioDTO> scenarioAllCases = null;

View File

@ -94,7 +94,7 @@ export default {
},
data() {
return {
apiCases: [],
apiCases: [],
result: {},
response: {},
showResponse: false
@ -157,18 +157,22 @@ export default {
}
});
} else {
if(row.reportId){
if (row.reportId) {
let url = "/api/definition/report/get/" + row.reportId;
this.$get(url, response => {
if (response.data) {
let data = response.data;
if (data && data.content) {
this.showResponse = true;
this.response = JSON.parse(data.content);
try {
this.response = JSON.parse(data.content);
} catch (e) {
this.response = {};
}
}
}
});
}else {
} else {
getApiReport(row.id, (data) => {
if (data && data.content) {
this.showResponse = true;