提交 d9b3831b 编写于 作者: W wenyann

feat(测试跟踪): 新增缺陷列表,缺陷数

上级 6e8f7f47
package io.metersphere.base.domain;
import java.io.Serializable;
import lombok.Data;
@Data
......@@ -23,5 +24,7 @@ public class Issues implements Serializable {
private String description;
private String model;
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
......@@ -115,9 +115,10 @@
</select>
<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
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>
<if test="request.combine != null">
<include refid="combine">
......
package io.metersphere.track.domain;
import com.alibaba.fastjson.JSON;
import io.metersphere.base.domain.Issues;
import io.metersphere.base.domain.TestCaseNode;
import io.metersphere.base.domain.TestCaseNodeExample;
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.MathUtils;
import io.metersphere.track.dto.*;
import io.metersphere.track.service.IssuesService;
import io.metersphere.track.service.TestCaseNodeService;
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) {
IssuesService issuesService = (IssuesService) CommonBeanFactory.getBean("issuesService");
childIdMap.forEach((rootNodeId, childIds) -> {
if (childIds.contains(testCase.getNodeId())) {
TestCaseReportModuleResultDTO moduleResult = moduleResultMap.get(rootNodeId);
if (moduleResult == null) {
......@@ -112,15 +116,11 @@ public class ReportResultComponent extends ReportComponent {
if (StringUtils.equals(testCase.getStatus(), TestPlanTestCaseStatus.Blocking.name())) {
moduleResult.setBlockingCount(moduleResult.getBlockingCount() + 1);
}
if (StringUtils.isNotBlank(testCase.getIssues())) {
if (JSON.parseObject(testCase.getIssues()).getBoolean("hasIssues")) {
moduleResult.setIssuesCount(moduleResult.getIssuesCount() + 1);
}
;
}
moduleResult.setIssuesCount(moduleResult.getIssuesCount() + issuesService.getIssues(testCase.getCaseId()).size());
moduleResultMap.put(rootNodeId, moduleResult);
return;
}
});
}
}
package io.metersphere.track.dto;
import io.metersphere.base.domain.Issues;
import lombok.Getter;
import lombok.Setter;
......@@ -12,6 +13,7 @@ public class TestCaseReportMetricDTO {
private List<TestCaseReportStatusResultDTO> executeResult;
private List<TestCaseReportModuleResultDTO> moduleExecuteResult;
private List<TestPlanCaseDTO> failureTestCases;
private List<Issues> Issues;
private List<String> executors;
private String principal;
private Long startTime;
......
package io.metersphere.track.dto;
import io.metersphere.base.domain.Issues;
import lombok.Getter;
import lombok.Setter;
import java.util.List;
@Getter
@Setter
public class TestCaseReportModuleResultDTO {
......
......@@ -16,4 +16,5 @@ public class TestPlanCaseDTO extends TestCaseWithBLOBs {
private String caseId;
private String issues;
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.exception.MSException;
import io.metersphere.commons.user.SessionUser;
import io.metersphere.commons.utils.CommonBeanFactory;
import io.metersphere.commons.utils.MathUtils;
import io.metersphere.commons.utils.ServiceUtils;
import io.metersphere.commons.utils.SessionUtils;
......@@ -43,7 +44,6 @@ import java.util.stream.Collectors;
@Service
@Transactional(rollbackFor = Exception.class)
public class TestPlanService {
@Resource
TestPlanMapper testPlanMapper;
......@@ -252,7 +252,7 @@ public class TestPlanService {
}
public TestCaseReportMetricDTO getMetric(String planId) {
IssuesService issuesService = (IssuesService) CommonBeanFactory.getBean("issuesService");
QueryTestPlanRequest queryTestPlanRequest = new QueryTestPlanRequest();
queryTestPlanRequest.setId(planId);
......@@ -264,16 +264,25 @@ public class TestPlanService {
List<ReportComponent> components = ReportComponentFactory.createComponents(componentIds.toJavaList(String.class), testPlan);
List<TestPlanCaseDTO> testPlanTestCases = listTestCaseByPlanId(planId);
List<Issues> issues = new ArrayList<>();
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 -> {
component.readRecord(testCase);
});
}
TestCaseReportMetricDTO testCaseReportMetricDTO = new TestCaseReportMetricDTO();
components.forEach(component -> {
component.afterBuild(testCaseReportMetricDTO);
});
testCaseReportMetricDTO.setIssues(issues);
return testCaseReportMetricDTO;
}
......
......@@ -202,7 +202,8 @@
},
getMetric() {
this.result = this.$get('/test/plan/get/metric/' + this.planId, response => {
this.metric = response.data;
this.metric = response.data
if (!this.metric.failureTestCases) {
this.metric.failureTestCases = [];
}
......@@ -213,7 +214,10 @@
this.metric.moduleExecuteResult = [];
}
/*缺陷列表*/
this.metric.defectList = [];
if (!this.metric.issues) {
this.metric.issues = [];
}
if (this.report.startTime) {
this.metric.startTime = new Date(this.report.startTime);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册