fix: --bug=1006224 --user=陈建星 【测试跟踪-报告】问题汇总 https://www.tapd.cn/55049933/s/1043426

This commit is contained in:
chenjianxing 2021-09-03 13:11:36 +08:00 committed by jianxing
parent 52e014d84e
commit 79a75e2977
4 changed files with 37 additions and 8 deletions

View File

@ -208,6 +208,12 @@ public class TestPlanReportService {
TestPlanReportContentWithBLOBs testPlanReportContent = new TestPlanReportContentWithBLOBs();
testPlanReportContent.setId(UUID.randomUUID().toString());
testPlanReportContent.setTestPlanReportId(testPlanReportID);
if (testPlanReportContent.getStartTime() == null) {
testPlanReportContent.setStartTime(System.currentTimeMillis());
}
if (testPlanReportContent.getEndTime() == null) {
testPlanReportContent.setEndTime(System.currentTimeMillis());
}
Map<String, String> apiCaseInfoMap = new HashMap<>();
Map<String, String> scenarioInfoMap = new HashMap<>();
@ -629,6 +635,14 @@ public class TestPlanReportService {
testPlanReportContentMapper.updateByPrimaryKeySelective(parseReportDaoToReportContent(reportDTO, testPlanReportContent));
}
if (reportDTO.getStartTime() == null) {
reportDTO.setStartTime(System.currentTimeMillis());
}
if (reportDTO.getEndTime() == null) {
reportDTO.setEndTime(System.currentTimeMillis());
}
String testPlanStatus = this.getTestPlanReportStatus(testPlanReport, reportDTO);
testPlanReport.setStatus(testPlanStatus);
this.update(testPlanReport);

View File

@ -240,16 +240,30 @@ public class TestPlanService {
} // 非已结束->已结束更新结束时间
}
// 如果状态是未开始设置时间为null
if (StringUtils.isNotBlank(testPlan.getStatus()) && testPlan.getStatus().equals(TestPlanStatus.Prepare.name())) {
testPlan.setActualStartTime(null);
testPlan.setActualEndTime(null);
}
// 如果当前状态已完成没有结束时间设置结束时间
if (StringUtils.equalsAnyIgnoreCase(testPlan.getStatus(),TestPlanStatus.Finished.name(),TestPlanStatus.Completed.name())
&& res.getActualEndTime() == null) {
testPlan.setActualEndTime(System.currentTimeMillis());
}
// 如果当前状态不是已完成设置结束时间为null
if (!StringUtils.equalsAnyIgnoreCase(testPlan.getStatus(),TestPlanStatus.Finished.name(),TestPlanStatus.Completed.name())
&& res.getActualEndTime() != null) {
testPlan.setActualEndTime(null);
}
// 如果当前状态不是未开始并且没有开始时间设置开始时间
if (!StringUtils.equals(testPlan.getStatus(),TestPlanStatus.Prepare.name())
&& res.getActualStartTime() == null) {
testPlan.setActualStartTime(System.currentTimeMillis());
}
int i;
if (testPlan.getName() == null) {// 若是点击该测试计划则仅更新了updateTime其它字段全为null使用updateByPrimaryKeySelective
i = testPlanMapper.updateByPrimaryKeySelective(testPlan);
@ -1211,7 +1225,7 @@ public class TestPlanService {
TestPlanWithBLOBs targetPlan = new TestPlanWithBLOBs();
targetPlan.setId(targetPlanId);
targetPlan.setName(testPlan.getName() + "_COPY");
targetPlan.setName(testPlan.getName() + "_" + UUID.randomUUID().toString().substring(0, 5) + "_COPY");
targetPlan.setWorkspaceId(testPlan.getWorkspaceId());
targetPlan.setDescription(testPlan.getDescription());
targetPlan.setStage(testPlan.getStage());
@ -1705,7 +1719,7 @@ public class TestPlanService {
config = JSONObject.parseObject(reportConfig);
}
TestPlanSimpleReportDTO report = getReport(planId);
buildFunctionalReport(report, config, planId);
buildApiReport(report, config, executeInfo, planId, saveResponse);
buildLoadReport(report, config, executeInfo, planId, saveResponse);
return report;

View File

@ -1,10 +1,10 @@
<template>
<div>
<el-row >
<el-col :span="12">
<el-col :span="12" v-if="caseCharData && caseCharData.length > 0">
<ms-doughnut-pie-chart :name="$t('单接口用例')" :data="caseCharData" ref="functionChar"/>
</el-col>
<el-col :span="12">
<el-col :span="12" v-if="scenarioCharData && scenarioCharData.length > 0">
<api-scenario-char-result :name="'场景用例数'" :data="scenarioCharData"/>
<api-scenario-char-result style="margin-top: -50px;" :name="'步骤用例数'" :data="stepCharData"/>
</el-col>

View File

@ -81,19 +81,20 @@ export default {
},
platformFilters() {
let platforms = this.data.map(i => i.platform);
let option = ISSUE_PLATFORM_OPTION;
let option = [...ISSUE_PLATFORM_OPTION];
option.push( {value: 'Local',text: 'Local'});
return option.filter(i => platforms.indexOf(i.value) > -1);
},
statusFilters() {
let statusFilter = [];
this.data.forEach(item => {
if (item.status) {
let status = item.platform === 'Local' ? item.status : item.platformStatus;
if (status) {
let values = statusFilter.map(i => i.value);
let status = this.isThirdPart ? item.platformStatus : item.status;
if (values.indexOf(status) == -1) {
statusFilter.push({
value: status,
text: status
text: ISSUE_STATUS_MAP[status] ? ISSUE_STATUS_MAP[status] :status
});
}
}