From 5cc2cdfc342e510e80be3479380c333b86d34ec2 Mon Sep 17 00:00:00 2001 From: pfl <14579250+shadowman1@user.noreply.gitee.com> Date: Fri, 6 Jun 2025 17:19:18 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E8=AE=A1=E5=88=92=E6=A6=82?= =?UTF-8?q?=E8=A7=88=E5=89=8D=E7=AB=AF=E5=8F=8A=E5=90=8E=E7=AB=AF=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../test/controller/TestPlanController.java | 19 + .../vo/TestPlanOverviewTrendDataVO.java | 22 + .../test/domain/vo/TestPlanOverviewVO.java | 146 ++++++ .../com/test/test/mapper/TestPlanMapper.java | 17 +- .../test/test/service/ITestPlanService.java | 16 + .../service/impl/TestPlanServiceImpl.java | 40 ++ .../resources/mapper/test/TestPlanMapper.xml | 52 ++ test-ui/package.json | 1 + test-ui/src/api/test/testPlan.js | 20 +- test-ui/src/views/test/testplan/index.vue | 3 + test-ui/src/views/test/testplan/overview.vue | 8 +- .../testplan/probablyView/probablyView.vue | 447 ++++++++++++++---- 12 files changed, 708 insertions(+), 83 deletions(-) create mode 100644 test-test/src/main/java/com/test/test/domain/vo/TestPlanOverviewTrendDataVO.java create mode 100644 test-test/src/main/java/com/test/test/domain/vo/TestPlanOverviewVO.java diff --git a/test-test/src/main/java/com/test/test/controller/TestPlanController.java b/test-test/src/main/java/com/test/test/controller/TestPlanController.java index 116a52b..bd43137 100644 --- a/test-test/src/main/java/com/test/test/controller/TestPlanController.java +++ b/test-test/src/main/java/com/test/test/controller/TestPlanController.java @@ -10,9 +10,12 @@ import com.test.test.domain.qo.IDQO; import com.test.test.domain.qo.TestPlanAddQO; import com.test.test.domain.qo.TestPlanListQO; import com.test.test.domain.vo.TestPlanListVO; +import com.test.test.domain.vo.TestPlanOverviewTrendDataVO; +import com.test.test.domain.vo.TestPlanOverviewVO; import com.test.test.service.ITestPlanService; import jakarta.annotation.Resource; import java.util.List; +import java.util.Map; import lombok.extern.slf4j.Slf4j; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.GetMapping; @@ -79,4 +82,20 @@ public class TestPlanController extends BaseController { public AjaxResult edit(@RequestBody TestPlan testPlan) { return toAjax(testPlanService.updateTestPlan(testPlan)); } + + /** + * 获取测试计划概览信息 + */ + @PostMapping("/planOverview") + public TestPlanOverviewVO selectPlanOverview(@RequestBody IDQO qo) { + return testPlanService.selectPlanOverview(qo.getId()); + } + + /** + * 获取测试计划用例执行趋势数据 + */ + @PostMapping("/planCaseTrendData") + public List getPlanCaseTrendData(@RequestBody IDQO qo) { + return testPlanService.getCaseTrendData(qo.getId()); + } } diff --git a/test-test/src/main/java/com/test/test/domain/vo/TestPlanOverviewTrendDataVO.java b/test-test/src/main/java/com/test/test/domain/vo/TestPlanOverviewTrendDataVO.java new file mode 100644 index 0000000..d78f537 --- /dev/null +++ b/test-test/src/main/java/com/test/test/domain/vo/TestPlanOverviewTrendDataVO.java @@ -0,0 +1,22 @@ +package com.test.test.domain.vo; + +import java.io.Serializable; +import lombok.Data; + +@Data +public class TestPlanOverviewTrendDataVO implements Serializable { + + private static final long serialVersionUID = -6444876575138174061L; + + private String caseTrendDates; + + private Integer notExecuted; + + private Integer passed; + + private Integer failed; + + private Integer blocked; + + private Integer skipped; +} diff --git a/test-test/src/main/java/com/test/test/domain/vo/TestPlanOverviewVO.java b/test-test/src/main/java/com/test/test/domain/vo/TestPlanOverviewVO.java new file mode 100644 index 0000000..46fe4ef --- /dev/null +++ b/test-test/src/main/java/com/test/test/domain/vo/TestPlanOverviewVO.java @@ -0,0 +1,146 @@ +package com.test.test.domain.vo; + +import java.io.Serializable; +import java.util.List; +import lombok.Data; + +@Data +public class TestPlanOverviewVO implements Serializable { + + private static final long serialVersionUID = -2634301979620606338L; + + /** + * 用例总数 + */ + private Integer caseCount; + + /** + * 已执行用例数 + */ + private Integer executedCaseCount; + + /** + * 用例通过数 + */ + private Integer passedCaseCount; + + /** + * 用例失败数 + */ + private Integer failedCaseCount; + + /** + * 用例阻塞数 + */ + private Integer blockedCaseCount; + + /** + * 用例跳过数 + */ + private Integer skippedCaseCount; + + /** + * 用例未执行数 + */ + private Integer notExecutedCaseCount; + + /** + * 缺陷数 + */ + private Integer defectCount; + + /** + * 待确认缺陷状态数 + */ + private Integer unconfirmedDefectCount; + + /** + * 修复中缺陷状态数 + */ + private Integer fixingDefectCount; + + /** + * 待验证缺陷状态数 + */ + private Integer unverifiedDefectCount; + + /** + * 无效缺陷状态数 + */ + private Integer invalidDefectCount; + + /** + * 挂起缺陷状态数 + */ + private Integer suspendedDefectCount; + + /** + * 无效等级缺陷数 + */ + private Integer invalidLevelDefectCount; + + /** + * 轻微等级缺陷数 + */ + private Integer minorLevelDefectCount; + + /** + * 一般等级缺陷数 + */ + private Integer normalLevelDefectCount; + + /** + * 严重等级缺陷数 + */ + private Integer seriousLevelDefectCount; + + /** + * 致命等级缺陷数 + */ + private Integer fatalLevelDefectCount; + + /** + * 功能逻辑类型缺陷数 + */ + private Integer logicDefectCount; + + /** + * UI交互类型缺陷数 + */ + private Integer uiDefectCount; + + /** + * 性能问题类型缺陷数 + */ + private Integer performanceDefectCount; + + /** + * 兼容性问题类型缺陷数 + */ + private Integer compatibilityDefectCount; + + /** + * 配置错误类型缺陷数 + */ + private Integer configurationDefectCount; + + /** + * 安全问题类型缺陷数 + */ + private Integer securityDefectCount; + + /** + * 安装部署类型缺陷数 + */ + private Integer installationDefectCount; + + /** + * 其他类型缺陷数 + */ + private Integer otherDefectCount; + + /** + * 用例执行时间 + */ + private List caseTrendDates; +} diff --git a/test-test/src/main/java/com/test/test/mapper/TestPlanMapper.java b/test-test/src/main/java/com/test/test/mapper/TestPlanMapper.java index b1e99e5..06ebb16 100644 --- a/test-test/src/main/java/com/test/test/mapper/TestPlanMapper.java +++ b/test-test/src/main/java/com/test/test/mapper/TestPlanMapper.java @@ -3,8 +3,9 @@ package com.test.test.mapper; import com.test.test.domain.TestPlan; import com.test.test.domain.qo.TestPlanListQO; import com.test.test.domain.vo.TestPlanListVO; +import com.test.test.domain.vo.TestPlanOverviewTrendDataVO; +import com.test.test.domain.vo.TestPlanOverviewVO; import java.util.List; - public interface TestPlanMapper { /** @@ -41,4 +42,18 @@ public interface TestPlanMapper { * @return */ Long selectPlanId(String serialNumber); + + /** + * 查询测试计划概览信息 + * @param id + * @return + */ + TestPlanOverviewVO selectPlanOverview(Long id); + + /** + * 查询测试计划用例执行趋势数据 + * @param id + * @return + */ + List getCaseTrendData(Long id); } diff --git a/test-test/src/main/java/com/test/test/service/ITestPlanService.java b/test-test/src/main/java/com/test/test/service/ITestPlanService.java index d353279..a6c1cd1 100644 --- a/test-test/src/main/java/com/test/test/service/ITestPlanService.java +++ b/test-test/src/main/java/com/test/test/service/ITestPlanService.java @@ -4,6 +4,8 @@ import com.test.test.domain.TestPlan; import com.test.test.domain.qo.TestPlanAddQO; import com.test.test.domain.qo.TestPlanListQO; import com.test.test.domain.vo.TestPlanListVO; +import com.test.test.domain.vo.TestPlanOverviewTrendDataVO; +import com.test.test.domain.vo.TestPlanOverviewVO; import java.util.List; /** @@ -41,4 +43,18 @@ public interface ITestPlanService { * @return */ public int updateTestPlan(TestPlan testPlan); + + /** + * 获取测试计划概览信息 + * @param id + * @return + */ + TestPlanOverviewVO selectPlanOverview(Long id); + + /** + * 获取测试计划用例趋势数据 + * @param id + * @return + */ + List getCaseTrendData(Long id); } diff --git a/test-test/src/main/java/com/test/test/service/impl/TestPlanServiceImpl.java b/test-test/src/main/java/com/test/test/service/impl/TestPlanServiceImpl.java index e767dd2..69c5000 100644 --- a/test-test/src/main/java/com/test/test/service/impl/TestPlanServiceImpl.java +++ b/test-test/src/main/java/com/test/test/service/impl/TestPlanServiceImpl.java @@ -6,10 +6,15 @@ import com.test.test.domain.TestPlan; import com.test.test.domain.qo.TestPlanAddQO; import com.test.test.domain.qo.TestPlanListQO; import com.test.test.domain.vo.TestPlanListVO; +import com.test.test.domain.vo.TestPlanOverviewTrendDataVO; +import com.test.test.domain.vo.TestPlanOverviewVO; import com.test.test.mapper.TestPlanMapper; import com.test.test.mapper.TestProjectPlanMapper; import com.test.test.service.ITestPlanService; import jakarta.annotation.Resource; +import java.time.LocalDate; +import java.time.format.DateTimeFormatter; +import java.util.ArrayList; import java.util.List; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -82,4 +87,39 @@ public class TestPlanServiceImpl implements ITestPlanService { testPlan.setUpdateTime(DateUtils.getNowDate()); return testPlanMapper.updateTestPlan(testPlan); } + + /** + * 获取测试计划概览信息 + * @param id + * @return + */ + @Override + public TestPlanOverviewVO selectPlanOverview(Long id) { + TestPlanOverviewVO overviewVO = testPlanMapper.selectPlanOverview(id); + overviewVO.setCaseTrendDates(getCaseTrendDates()); + return overviewVO; + } + + /** + * 获取测试计划用例趋势数据 + * @param id + * @return + */ + @Override + public List getCaseTrendData(Long id) { + return testPlanMapper.getCaseTrendData(id); + } + + private List getCaseTrendDates() { + List dates = new ArrayList<>(); + LocalDate today = LocalDate.now(); + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); + + for (int i = 6; i >= 0; i--) { + LocalDate date = today.minusDays(i); + dates.add(date.format(formatter)); + } + + return dates; + } } diff --git a/test-test/src/main/resources/mapper/test/TestPlanMapper.xml b/test-test/src/main/resources/mapper/test/TestPlanMapper.xml index 3d553b7..ba252cf 100644 --- a/test-test/src/main/resources/mapper/test/TestPlanMapper.xml +++ b/test-test/src/main/resources/mapper/test/TestPlanMapper.xml @@ -203,4 +203,56 @@ + + + + + \ No newline at end of file diff --git a/test-ui/package.json b/test-ui/package.json index 1d7e924..d2a1ac9 100644 --- a/test-ui/package.json +++ b/test-ui/package.json @@ -46,6 +46,7 @@ "js-cookie": "3.0.1", "jsencrypt": "3.0.0-rc.1", "json-editor-vue": "^0.17.3", + "moment": "^2.30.1", "nprogress": "0.2.0", "quill": "2.0.2", "screenfull": "5.0.2", diff --git a/test-ui/src/api/test/testPlan.js b/test-ui/src/api/test/testPlan.js index 72a2e70..a1272b6 100644 --- a/test-ui/src/api/test/testPlan.js +++ b/test-ui/src/api/test/testPlan.js @@ -8,7 +8,9 @@ const api = { testPlanDetail: 'test/testPlan/planDetail', testPlanProjectList: '/test/testPlanProject/list', addTestReport: 'test/testReport/addTestReport', - getTestReportList: 'test/testReport/reportList' + getTestReportList: 'test/testReport/reportList', + getPlanOverview:'test/testPlan/planOverview', + getPlanCaseTrendData: 'test/testPlan/planCaseTrendData', } export function getTestPlanList(data) { @@ -74,3 +76,19 @@ export function getTestReportList(data) { params: data }) } + +export function getPlanOverview(id) { + return request({ + url: api.getPlanOverview, + method: 'post', + data: {id} + }) +} + +export function getPlanCaseTrendData(id) { + return request({ + url: api.getPlanCaseTrendData, + method: 'post', + data: {id} + }) +} diff --git a/test-ui/src/views/test/testplan/index.vue b/test-ui/src/views/test/testplan/index.vue index e7429ab..5bdf609 100644 --- a/test-ui/src/views/test/testplan/index.vue +++ b/test-ui/src/views/test/testplan/index.vue @@ -375,6 +375,9 @@ export default { {id: row.id, name: row.name, testStatus: row.status, + startPlanTime: row.startPlanTime, + endPlanTime: row.endPlanTime, + manager: row.manager, }); }, handleTabClick(tab) { diff --git a/test-ui/src/views/test/testplan/overview.vue b/test-ui/src/views/test/testplan/overview.vue index 06b618b..b0ad78b 100644 --- a/test-ui/src/views/test/testplan/overview.vue +++ b/test-ui/src/views/test/testplan/overview.vue @@ -30,7 +30,7 @@ - + @@ -66,6 +66,7 @@ export default { '3': '已终止' }, planId: '', + overViewData: {}, testStatus: '', testTitle: '', activeTab: 'overview',// 默认选中的标签页 @@ -114,6 +115,11 @@ export default { this.planId = this.$route.query.id; this.testTitle = this.$route.query.name this.testStatus = this.$route.query.testStatus + this.overViewData = { + startTime: this.$route.query.startPlanTime, + endTime: this.$route.query.endPlanTime, + manager: this.$route.query.manager + } } }; diff --git a/test-ui/src/views/test/testplan/probablyView/probablyView.vue b/test-ui/src/views/test/testplan/probablyView/probablyView.vue index d727bb6..14ffbd2 100644 --- a/test-ui/src/views/test/testplan/probablyView/probablyView.vue +++ b/test-ui/src/views/test/testplan/probablyView/probablyView.vue @@ -17,14 +17,13 @@ - - 起止时间:2020-04-01 ~ 2020-04-30 + 起止时间:{{ overViewData.startTime }} ~ {{ overViewData.endTime }} - 当前测试计划已经开始 3 天,距离截止时间还有 52 天 + 当前测试计划已经开始 {{ daysElapsed }} 天,距离截止时间还有 {{ daysRemaining }} 天 - 负责人:{{ }} + 负责人:{{ overViewData.manager }} @@ -34,10 +33,10 @@
-

100%

+

{{ executionProgress || 0 }}%

执行进度

-

用例总数 1

-

已执行用例 1

+

用例总数 {{ viewData.caseCount }}

+

已执行用例 {{ viewData.executedCaseCount }}

@@ -47,13 +46,13 @@
-

100%

- +

{{ executionPassRate || 0 }}%

+

执行用例通过率

-

100%

- +

{{ overallPassRate || 0 }}%

+

总体用例通过率

@@ -64,14 +63,14 @@
-

0

+

{{ viewData.defectCount }}

缺陷数

- 0 - 0 - 0 - 0 - 0 + {{ viewData.unconfirmedDefectCount }} + {{ viewData.fixingDefectCount }} + {{ viewData.unverifiedDefectCount }} + {{ viewData.invalidDefectCount }} + {{ viewData.suspendedDefectCount }} 待确认 @@ -98,13 +97,13 @@
- +
-

通过 1

-

失败 0

-

阻塞 0

-

跳过 0

-

未执行 0

+

通过 {{ viewData.passedCaseCount }}

+

失败 {{ viewData.failedCaseCount }}

+

阻塞 {{ viewData.blockedCaseCount }}

+

跳过 {{ viewData.skippedCaseCount }}

+

未执行 {{ viewData.notExecutedCaseCount }}

@@ -117,12 +116,34 @@
- +
+ + + +
+ 缺陷等级分布 +
+ +
+
+
+
+ + +
+ 缺陷类型分布 +
+ +
+
+
+
+
关联需求信息 @@ -160,25 +181,29 @@