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 6d82bdfd51
commit fe21f93730
4 changed files with 16 additions and 10 deletions

View File

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

View File

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

View File

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

View File

@ -44,7 +44,8 @@
<template v-slot:default="scope"> <template v-slot:default="scope">
<status-table-item v-if="scope.row.execResult === 'success'" :value="'Pass'"/> <status-table-item v-if="scope.row.execResult === 'success'" :value="'Pass'"/>
<status-table-item v-if="scope.row.execResult === 'error'" :value="'Failure'"/> <status-table-item v-if="scope.row.execResult === 'error'" :value="'Failure'"/>
<status-table-item v-if="scope.row.execResult != 'error' && scope.row.execResult != 'success'" :value="'Prepare'"/> <status-table-item v-if="scope.row.execResult != 'error' && scope.row.execResult != 'success'"
:value="'Prepare'"/>
</template> </template>
</ms-table-column> </ms-table-column>
</ms-table> </ms-table>
@ -76,11 +77,13 @@ import MsTable from "@/business/components/common/components/table/MsTable";
import MsTableColumn from "@/business/components/common/components/table/MsTableColumn"; import MsTableColumn from "@/business/components/common/components/table/MsTableColumn";
import {getApiReport, getShareApiReport} from "@/network/api"; import {getApiReport, getShareApiReport} from "@/network/api";
import MsRequestResultTail from "@/business/components/api/definition/components/response/RequestResultTail"; import MsRequestResultTail from "@/business/components/api/definition/components/response/RequestResultTail";
export default { export default {
name: "ApiCaseFailureResult", name: "ApiCaseFailureResult",
components: { components: {
MsRequestResultTail, MsRequestResultTail,
MsTableColumn, MsTable, StatusTableItem, MethodTableItem, TypeTableItem, PriorityTableItem}, MsTableColumn, MsTable, StatusTableItem, MethodTableItem, TypeTableItem, PriorityTableItem
},
props: { props: {
planId: String, planId: String,
isTemplate: Boolean, isTemplate: Boolean,
@ -162,7 +165,11 @@ export default {
let data = response.data; let data = response.data;
if (data && data.content) { if (data && data.content) {
this.showResponse = true; this.showResponse = true;
try {
this.response = JSON.parse(data.content); this.response = JSON.parse(data.content);
} catch (e) {
this.response = {};
}
} }
} }
}); });