提交 cc4e7290 编写于 作者: C chenjianxing

测试报告失败列表

上级 ae8c7ee6
......@@ -36,6 +36,9 @@
#{nodeId}
</foreach>
</if>
<if test="request.status != null">
and test_plan_test_case.status = #{request.status}
</if>
<if test="request.executor != null">
and test_plan_test_case.executor = #{request.executor}
</if>
......
......@@ -11,6 +11,7 @@ public class TestCaseReportMetricDTO {
private List<TestCaseReportStatusResultDTO> executeResult;
private List<TestCaseReportModuleResultDTO> moduleExecuteResult;
private List<TestPlanCaseDTO> failureTestCases;
private List<String> executors;
private String principal;
private Long startTime;
......
......@@ -25,4 +25,6 @@ public class QueryTestPlanCaseRequest extends TestPlanTestCase {
private String workspaceId;
private String name;
private String status;
}
......@@ -3,10 +3,7 @@ package io.metersphere.track.service;
import com.alibaba.fastjson.JSON;
import io.metersphere.base.domain.*;
import io.metersphere.base.mapper.TestCaseMapper;
import io.metersphere.base.mapper.TestCaseNodeMapper;
import io.metersphere.base.mapper.TestPlanMapper;
import io.metersphere.base.mapper.TestPlanTestCaseMapper;
import io.metersphere.base.mapper.*;
import io.metersphere.base.mapper.ext.ExtProjectMapper;
import io.metersphere.base.mapper.ext.ExtTestPlanMapper;
import io.metersphere.base.mapper.ext.ExtTestPlanTestCaseMapper;
......@@ -67,6 +64,9 @@ public class TestPlanService {
@Resource
ExtProjectMapper extProjectMapper;
@Resource
TestCaseReportMapper testCaseReportMapper;
public void addTestPlan(TestPlan testPlan) {
if (getTestPlanByName(testPlan.getName()).size() > 0) {
MSException.throwException(Translator.get("plan_name_already_exists"));
......@@ -256,6 +256,8 @@ public class TestPlanService {
QueryTestPlanRequest queryTestPlanRequest = new QueryTestPlanRequest();
queryTestPlanRequest.setId(planId);
TestPlanDTO testPlan = extTestPlanMapper.list(queryTestPlanRequest).get(0);
TestCaseReport testCaseReport = testCaseReportMapper.selectByPrimaryKey(testPlan.getReportId());
// testCaseReport.get
Set<String> executors = new HashSet<>();
Map<String, TestCaseReportStatusResultDTO> reportStatusResultMap = new HashMap<>();
......@@ -274,6 +276,7 @@ public class TestPlanService {
});
List<TestPlanCaseDTO> testPlanTestCases = listTestCaseByPlanId(planId);
List<TestPlanCaseDTO> failureTestCases = new ArrayList<>();
Map<String, TestCaseReportModuleResultDTO> moduleResultMap = new HashMap<>();
......@@ -281,6 +284,7 @@ public class TestPlanService {
executors.add(testCase.getExecutor());
getStatusResultMap(reportStatusResultMap, testCase);
getModuleResultMap(childIdMap, moduleResultMap, testCase, nodeTrees);
getFailureTestCases(failureTestCases, testCase);
}
nodeTrees.forEach(rootNode -> {
......@@ -303,10 +307,17 @@ public class TestPlanService {
testCaseReportMetricDTO.setExecutors(new ArrayList<>(executors));
testCaseReportMetricDTO.setExecuteResult(new ArrayList<>(reportStatusResultMap.values()));
testCaseReportMetricDTO.setModuleExecuteResult(new ArrayList<>(moduleResultMap.values()));
testCaseReportMetricDTO.setFailureTestCases(failureTestCases);
return testCaseReportMetricDTO;
}
private void getFailureTestCases(List<TestPlanCaseDTO> failureTestCases, TestPlanCaseDTO testCase) {
if (StringUtils.equals(testCase.getStatus(), TestPlanTestCaseStatus.Failure.name())) {
failureTestCases.add(testCase);
}
}
private void getStatusResultMap(Map<String, TestCaseReportStatusResultDTO> reportStatusResultMap, TestPlanCaseDTO testCase) {
TestCaseReportStatusResultDTO statusResult = reportStatusResultMap.get(testCase.getStatus());
if (statusResult == null) {
......
<template>
<common-component :title="'失败用例'">
<template>
<el-table
row-key="id"
:data="failureTestCases">
<el-table-column
prop="name"
:label="$t('commons.name')"
show-overflow-tooltip>
</el-table-column>
<el-table-column
prop="priority"
column-key="priority"
:label="$t('test_track.case.priority')">
<template v-slot:default="scope">
<priority-table-item :value="scope.row.priority" ref="priority"/>
</template>
</el-table-column>
<el-table-column
prop="type"
column-key="type"
:label="$t('test_track.case.type')"
show-overflow-tooltip>
<template v-slot:default="scope">
<type-table-item :value="scope.row.type"/>
</template>
</el-table-column>
<el-table-column
prop="method"
column-key="method"
:label="$t('test_track.case.method')"
show-overflow-tooltip>
<template v-slot:default="scope">
<method-table-item :value="scope.row.method"/>
</template>
</el-table-column>
<el-table-column
prop="nodePath"
:label="$t('test_track.case.module')"
show-overflow-tooltip>
</el-table-column>
<el-table-column
prop="executorName"
:label="$t('test_track.plan_view.executor')">
</el-table-column>
<el-table-column
prop="status"
column-key="status"
:label="$t('test_track.plan_view.execute_result')">
<template v-slot:default="scope">
<status-table-item :value="scope.row.status"/>
</template>
</el-table-column>
<el-table-column
sortable
prop="updateTime"
:label="$t('commons.update_time')"
show-overflow-tooltip>
<template v-slot:default="scope">
<span>{{ scope.row.updateTime | timestampFormatDate }}</span>
</template>
</el-table-column>
</el-table>
</template>
</common-component>
</template>
<script>
import CommonComponent from "./CommonComponent";
import PriorityTableItem from "../../../../../common/tableItems/planview/PriorityTableItem";
import TypeTableItem from "../../../../../common/tableItems/planview/TypeTableItem";
import MethodTableItem from "../../../../../common/tableItems/planview/MethodTableItem";
import StatusTableItem from "../../../../../common/tableItems/planview/StatusTableItem";
export default {
name: "FailureResultComponent",
components: {StatusTableItem, MethodTableItem, TypeTableItem, PriorityTableItem, CommonComponent},
props: {
failureTestCases: {
type: Array,
default() {
return [
{
moduleName: this.$t('test_track.module.module') + '1',
caseCount: '14',
passRate: 10.8,
issuesCount: 3
},
{
moduleName: this.$t('test_track.module.module') + '2',
caseCount: '24',
passRate: 40,
issuesCount: 6
},
{
moduleName: this.$t('test_track.module.module') + '3',
caseCount: '50',
passRate: 76.9,
issuesCount: 8
}
]
}
}
}
}
</script>
<style scoped>
</style>
......@@ -7,6 +7,7 @@
<test-result-component v-if="preview.id == 2"/>
<test-result-chart-component v-if="preview.id == 3"/>
<rich-text-component :preview="preview" v-if="preview.type != 'system'"/>
<failure-result-component/>
</div>
<!--报告-->
......@@ -15,6 +16,7 @@
<test-result-component :test-results="metric.moduleExecuteResult" v-if="preview.id == 2"/>
<test-result-chart-component :execute-result="metric.executeResult" v-if="preview.id == 3"/>
<rich-text-component :is-report-view="isReportView" :preview="preview" v-if="preview.type != 'system'"/>
<failure-result-component :failure-test-cases="metric.failureTestCases"/>
</div>
</div>
......@@ -25,9 +27,12 @@
import TestResultComponent from "./TestResultComponent";
import TestResultChartComponent from "./TestResultChartComponent";
import RichTextComponent from "./RichTextComponent";
import FailureResultComponent from "./FailureResultComponent";
export default {
name: "TemplateComponent",
components: {RichTextComponent, TestResultChartComponent, TestResultComponent, BaseInfoComponent},
components: {
FailureResultComponent,
RichTextComponent, TestResultChartComponent, TestResultComponent, BaseInfoComponent},
props: {
preview: {
type: Object
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册