feat(测试跟踪): 新增缺陷列表,缺陷数
This commit is contained in:
parent
6e8f7f4796
commit
d9b3831b3e
|
@ -1,6 +1,7 @@
|
||||||
package io.metersphere.base.domain;
|
package io.metersphere.base.domain;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
|
@ -23,5 +24,7 @@ public class Issues implements Serializable {
|
||||||
|
|
||||||
private String description;
|
private String description;
|
||||||
|
|
||||||
|
private String model;
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
}
|
}
|
|
@ -115,9 +115,10 @@
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="list" resultType="io.metersphere.track.dto.TestPlanCaseDTO">
|
<select id="list" resultType="io.metersphere.track.dto.TestPlanCaseDTO">
|
||||||
select test_plan_test_case.*, test_case.*
|
select test_plan_test_case.*, test_case.*,test_case_node.name as model
|
||||||
from test_plan_test_case
|
from test_plan_test_case
|
||||||
inner join test_case on test_plan_test_case.case_id = test_case.id
|
inner join test_case on test_plan_test_case.case_id = test_case.id left join test_case_node on
|
||||||
|
test_case_node.id=test_case.node_id
|
||||||
<where>
|
<where>
|
||||||
<if test="request.combine != null">
|
<if test="request.combine != null">
|
||||||
<include refid="combine">
|
<include refid="combine">
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package io.metersphere.track.domain;
|
package io.metersphere.track.domain;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import io.metersphere.base.domain.Issues;
|
||||||
import io.metersphere.base.domain.TestCaseNode;
|
import io.metersphere.base.domain.TestCaseNode;
|
||||||
import io.metersphere.base.domain.TestCaseNodeExample;
|
import io.metersphere.base.domain.TestCaseNodeExample;
|
||||||
import io.metersphere.base.mapper.TestCaseNodeMapper;
|
import io.metersphere.base.mapper.TestCaseNodeMapper;
|
||||||
|
@ -8,6 +9,7 @@ import io.metersphere.commons.constants.TestPlanTestCaseStatus;
|
||||||
import io.metersphere.commons.utils.CommonBeanFactory;
|
import io.metersphere.commons.utils.CommonBeanFactory;
|
||||||
import io.metersphere.commons.utils.MathUtils;
|
import io.metersphere.commons.utils.MathUtils;
|
||||||
import io.metersphere.track.dto.*;
|
import io.metersphere.track.dto.*;
|
||||||
|
import io.metersphere.track.service.IssuesService;
|
||||||
import io.metersphere.track.service.TestCaseNodeService;
|
import io.metersphere.track.service.TestCaseNodeService;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
|
@ -78,7 +80,9 @@ public class ReportResultComponent extends ReportComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void getModuleResultMap(Map<String, Set<String>> childIdMap, Map<String, TestCaseReportModuleResultDTO> moduleResultMap, TestPlanCaseDTO testCase, List<TestCaseNodeDTO> nodeTrees) {
|
private void getModuleResultMap(Map<String, Set<String>> childIdMap, Map<String, TestCaseReportModuleResultDTO> moduleResultMap, TestPlanCaseDTO testCase, List<TestCaseNodeDTO> nodeTrees) {
|
||||||
|
IssuesService issuesService = (IssuesService) CommonBeanFactory.getBean("issuesService");
|
||||||
childIdMap.forEach((rootNodeId, childIds) -> {
|
childIdMap.forEach((rootNodeId, childIds) -> {
|
||||||
|
|
||||||
if (childIds.contains(testCase.getNodeId())) {
|
if (childIds.contains(testCase.getNodeId())) {
|
||||||
TestCaseReportModuleResultDTO moduleResult = moduleResultMap.get(rootNodeId);
|
TestCaseReportModuleResultDTO moduleResult = moduleResultMap.get(rootNodeId);
|
||||||
if (moduleResult == null) {
|
if (moduleResult == null) {
|
||||||
|
@ -112,15 +116,11 @@ public class ReportResultComponent extends ReportComponent {
|
||||||
if (StringUtils.equals(testCase.getStatus(), TestPlanTestCaseStatus.Blocking.name())) {
|
if (StringUtils.equals(testCase.getStatus(), TestPlanTestCaseStatus.Blocking.name())) {
|
||||||
moduleResult.setBlockingCount(moduleResult.getBlockingCount() + 1);
|
moduleResult.setBlockingCount(moduleResult.getBlockingCount() + 1);
|
||||||
}
|
}
|
||||||
if (StringUtils.isNotBlank(testCase.getIssues())) {
|
moduleResult.setIssuesCount(moduleResult.getIssuesCount() + issuesService.getIssues(testCase.getCaseId()).size());
|
||||||
if (JSON.parseObject(testCase.getIssues()).getBoolean("hasIssues")) {
|
|
||||||
moduleResult.setIssuesCount(moduleResult.getIssuesCount() + 1);
|
|
||||||
}
|
|
||||||
;
|
|
||||||
}
|
|
||||||
moduleResultMap.put(rootNodeId, moduleResult);
|
moduleResultMap.put(rootNodeId, moduleResult);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package io.metersphere.track.dto;
|
package io.metersphere.track.dto;
|
||||||
|
|
||||||
|
import io.metersphere.base.domain.Issues;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@ -12,6 +13,7 @@ public class TestCaseReportMetricDTO {
|
||||||
private List<TestCaseReportStatusResultDTO> executeResult;
|
private List<TestCaseReportStatusResultDTO> executeResult;
|
||||||
private List<TestCaseReportModuleResultDTO> moduleExecuteResult;
|
private List<TestCaseReportModuleResultDTO> moduleExecuteResult;
|
||||||
private List<TestPlanCaseDTO> failureTestCases;
|
private List<TestPlanCaseDTO> failureTestCases;
|
||||||
|
private List<Issues> Issues;
|
||||||
private List<String> executors;
|
private List<String> executors;
|
||||||
private String principal;
|
private String principal;
|
||||||
private Long startTime;
|
private Long startTime;
|
||||||
|
|
|
@ -1,8 +1,11 @@
|
||||||
package io.metersphere.track.dto;
|
package io.metersphere.track.dto;
|
||||||
|
|
||||||
|
import io.metersphere.base.domain.Issues;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
public class TestCaseReportModuleResultDTO {
|
public class TestCaseReportModuleResultDTO {
|
||||||
|
|
|
@ -16,4 +16,5 @@ public class TestPlanCaseDTO extends TestCaseWithBLOBs {
|
||||||
private String caseId;
|
private String caseId;
|
||||||
private String issues;
|
private String issues;
|
||||||
private String reportId;
|
private String reportId;
|
||||||
|
private String model;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,7 @@ import io.metersphere.commons.constants.TestPlanStatus;
|
||||||
import io.metersphere.commons.constants.TestPlanTestCaseStatus;
|
import io.metersphere.commons.constants.TestPlanTestCaseStatus;
|
||||||
import io.metersphere.commons.exception.MSException;
|
import io.metersphere.commons.exception.MSException;
|
||||||
import io.metersphere.commons.user.SessionUser;
|
import io.metersphere.commons.user.SessionUser;
|
||||||
|
import io.metersphere.commons.utils.CommonBeanFactory;
|
||||||
import io.metersphere.commons.utils.MathUtils;
|
import io.metersphere.commons.utils.MathUtils;
|
||||||
import io.metersphere.commons.utils.ServiceUtils;
|
import io.metersphere.commons.utils.ServiceUtils;
|
||||||
import io.metersphere.commons.utils.SessionUtils;
|
import io.metersphere.commons.utils.SessionUtils;
|
||||||
|
@ -43,7 +44,6 @@ import java.util.stream.Collectors;
|
||||||
@Service
|
@Service
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public class TestPlanService {
|
public class TestPlanService {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
TestPlanMapper testPlanMapper;
|
TestPlanMapper testPlanMapper;
|
||||||
|
|
||||||
|
@ -252,7 +252,7 @@ public class TestPlanService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public TestCaseReportMetricDTO getMetric(String planId) {
|
public TestCaseReportMetricDTO getMetric(String planId) {
|
||||||
|
IssuesService issuesService = (IssuesService) CommonBeanFactory.getBean("issuesService");
|
||||||
QueryTestPlanRequest queryTestPlanRequest = new QueryTestPlanRequest();
|
QueryTestPlanRequest queryTestPlanRequest = new QueryTestPlanRequest();
|
||||||
queryTestPlanRequest.setId(planId);
|
queryTestPlanRequest.setId(planId);
|
||||||
|
|
||||||
|
@ -264,16 +264,25 @@ public class TestPlanService {
|
||||||
List<ReportComponent> components = ReportComponentFactory.createComponents(componentIds.toJavaList(String.class), testPlan);
|
List<ReportComponent> components = ReportComponentFactory.createComponents(componentIds.toJavaList(String.class), testPlan);
|
||||||
|
|
||||||
List<TestPlanCaseDTO> testPlanTestCases = listTestCaseByPlanId(planId);
|
List<TestPlanCaseDTO> testPlanTestCases = listTestCaseByPlanId(planId);
|
||||||
|
List<Issues> issues = new ArrayList<>();
|
||||||
for (TestPlanCaseDTO testCase : testPlanTestCases) {
|
for (TestPlanCaseDTO testCase : testPlanTestCases) {
|
||||||
|
List<Issues> issue = issuesService.getIssues(testCase.getCaseId());
|
||||||
|
if (issue.size() > 0) {
|
||||||
|
for (Issues i : issue) {
|
||||||
|
i.setModel(testCase.getModel());
|
||||||
|
}
|
||||||
|
issues.addAll(issue);
|
||||||
|
}
|
||||||
|
|
||||||
components.forEach(component -> {
|
components.forEach(component -> {
|
||||||
component.readRecord(testCase);
|
component.readRecord(testCase);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
TestCaseReportMetricDTO testCaseReportMetricDTO = new TestCaseReportMetricDTO();
|
TestCaseReportMetricDTO testCaseReportMetricDTO = new TestCaseReportMetricDTO();
|
||||||
components.forEach(component -> {
|
components.forEach(component -> {
|
||||||
component.afterBuild(testCaseReportMetricDTO);
|
component.afterBuild(testCaseReportMetricDTO);
|
||||||
});
|
});
|
||||||
|
testCaseReportMetricDTO.setIssues(issues);
|
||||||
return testCaseReportMetricDTO;
|
return testCaseReportMetricDTO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -202,7 +202,8 @@
|
||||||
},
|
},
|
||||||
getMetric() {
|
getMetric() {
|
||||||
this.result = this.$get('/test/plan/get/metric/' + this.planId, response => {
|
this.result = this.$get('/test/plan/get/metric/' + this.planId, response => {
|
||||||
this.metric = response.data;
|
this.metric = response.data
|
||||||
|
|
||||||
if (!this.metric.failureTestCases) {
|
if (!this.metric.failureTestCases) {
|
||||||
this.metric.failureTestCases = [];
|
this.metric.failureTestCases = [];
|
||||||
}
|
}
|
||||||
|
@ -213,7 +214,10 @@
|
||||||
this.metric.moduleExecuteResult = [];
|
this.metric.moduleExecuteResult = [];
|
||||||
}
|
}
|
||||||
/*缺陷列表*/
|
/*缺陷列表*/
|
||||||
this.metric.defectList = [];
|
if (!this.metric.issues) {
|
||||||
|
this.metric.issues = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (this.report.startTime) {
|
if (this.report.startTime) {
|
||||||
this.metric.startTime = new Date(this.report.startTime);
|
this.metric.startTime = new Date(this.report.startTime);
|
||||||
|
|
Loading…
Reference in New Issue