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);
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

@ -467,7 +467,7 @@ public class TestPlanScenarioCaseService {
if(status == null ){
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())) {
return;
}
ApiDefinitionExecResultMapper apiDefinitionExecResultMapper = CommonBeanFactory.getBean(ApiDefinitionExecResultMapper.class);
if (checkReportConfig(config, "api")) {
List<TestPlanFailureApiDTO> apiAllCases = null;
List<TestPlanFailureScenarioDTO> scenarioAllCases = null;

View File

@ -44,7 +44,8 @@
<template v-slot:default="scope">
<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' && scope.row.execResult != 'success'" :value="'Prepare'"/>
<status-table-item v-if="scope.row.execResult != 'error' && scope.row.execResult != 'success'"
:value="'Prepare'"/>
</template>
</ms-table-column>
</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 {getApiReport, getShareApiReport} from "@/network/api";
import MsRequestResultTail from "@/business/components/api/definition/components/response/RequestResultTail";
export default {
name: "ApiCaseFailureResult",
components: {
MsRequestResultTail,
MsTableColumn, MsTable, StatusTableItem, MethodTableItem, TypeTableItem, PriorityTableItem},
MsTableColumn, MsTable, StatusTableItem, MethodTableItem, TypeTableItem, PriorityTableItem
},
props: {
planId: String,
isTemplate: Boolean,
@ -92,7 +95,7 @@ export default {
},
data() {
return {
apiCases: [],
apiCases: [],
result: {},
response: {},
showResponse: false
@ -155,18 +158,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;