diff --git a/backend/src/main/java/io/metersphere/track/domain/ReportComponent.java b/backend/src/main/java/io/metersphere/track/domain/ReportComponent.java index 8f734dfa3d..924ae232f4 100644 --- a/backend/src/main/java/io/metersphere/track/domain/ReportComponent.java +++ b/backend/src/main/java/io/metersphere/track/domain/ReportComponent.java @@ -6,6 +6,7 @@ import io.metersphere.commons.constants.APITestStatus; import io.metersphere.track.dto.TestCaseReportMetricDTO; import io.metersphere.track.dto.TestPlanCaseDTO; import io.metersphere.track.dto.TestPlanDTO; +import io.metersphere.track.dto.TestPlanLoadCaseDTO; import org.apache.commons.lang3.StringUtils; public abstract class ReportComponent { @@ -26,4 +27,7 @@ public abstract class ReportComponent { public void readRecord(ApiScenarioDTO testCase) { } + public void readRecord(TestPlanLoadCaseDTO testCase) { + } + } diff --git a/backend/src/main/java/io/metersphere/track/domain/ReportFailureAdvanceResultComponent.java b/backend/src/main/java/io/metersphere/track/domain/ReportFailureAdvanceResultComponent.java index 180f2c0001..6ab3b4a1e4 100644 --- a/backend/src/main/java/io/metersphere/track/domain/ReportFailureAdvanceResultComponent.java +++ b/backend/src/main/java/io/metersphere/track/domain/ReportFailureAdvanceResultComponent.java @@ -4,10 +4,7 @@ import io.metersphere.api.dto.automation.ApiScenarioDTO; import io.metersphere.api.dto.automation.ScenarioStatus; import io.metersphere.api.dto.definition.TestPlanApiCaseDTO; import io.metersphere.commons.constants.TestPlanTestCaseStatus; -import io.metersphere.track.dto.FailureTestCasesAdvanceDTO; -import io.metersphere.track.dto.TestCaseReportMetricDTO; -import io.metersphere.track.dto.TestPlanCaseDTO; -import io.metersphere.track.dto.TestPlanDTO; +import io.metersphere.track.dto.*; import org.apache.commons.lang3.StringUtils; import java.util.ArrayList; @@ -17,6 +14,7 @@ public class ReportFailureAdvanceResultComponent extends ReportComponent { private List functionalTestCases = new ArrayList<>(); private List apiTestCases = new ArrayList<>(); private List scenarioTestCases = new ArrayList<>(); + private List loadTestCases = new ArrayList<>(); public ReportFailureAdvanceResultComponent(TestPlanDTO testPlan) { super(testPlan); @@ -44,12 +42,20 @@ public class ReportFailureAdvanceResultComponent extends ReportComponent { } } + @Override + public void readRecord(TestPlanLoadCaseDTO testCase) { + if (StringUtils.equals(testCase.getCaseStatus(), "error")) { + this.loadTestCases.add(testCase); + } + } + @Override public void afterBuild(TestCaseReportMetricDTO testCaseReportMetric) { FailureTestCasesAdvanceDTO failureTestCasesAdvanceDTO = new FailureTestCasesAdvanceDTO(); failureTestCasesAdvanceDTO.setFunctionalTestCases(functionalTestCases); failureTestCasesAdvanceDTO.setApiTestCases(apiTestCases); failureTestCasesAdvanceDTO.setScenarioTestCases(scenarioTestCases); + failureTestCasesAdvanceDTO.setLoadTestCases(loadTestCases); testCaseReportMetric.setFailureTestCases(failureTestCasesAdvanceDTO); } } diff --git a/backend/src/main/java/io/metersphere/track/domain/ReportResultAdvancedChartComponent.java b/backend/src/main/java/io/metersphere/track/domain/ReportResultAdvancedChartComponent.java index 3c465d9079..d05293cfe0 100644 --- a/backend/src/main/java/io/metersphere/track/domain/ReportResultAdvancedChartComponent.java +++ b/backend/src/main/java/io/metersphere/track/domain/ReportResultAdvancedChartComponent.java @@ -16,15 +16,19 @@ public class ReportResultAdvancedChartComponent extends ReportComponent { Map functionalStatusResultMap = new HashMap<>(); Map apiStatusResultMap = new HashMap<>(); Map scenarioStatusResultMap = new HashMap<>(); + Map loadStatusResultMap = new HashMap<>(); private static Map apiResultMap = new HashMap<>(); private static Map scenarioResultMap = new HashMap<>(); + private static Map loadResultMap = new HashMap<>(); static { apiResultMap.put("success", TestPlanTestCaseStatus.Pass.name()); apiResultMap.put("error", TestPlanTestCaseStatus.Failure.name()); scenarioResultMap.put(ScenarioStatus.Success.name(), TestPlanTestCaseStatus.Pass.name()); scenarioResultMap.put(ScenarioStatus.Fail.name(), TestPlanTestCaseStatus.Failure.name()); + loadResultMap.put("success", TestPlanTestCaseStatus.Pass.name()); + loadResultMap.put("error", TestPlanTestCaseStatus.Failure.name()); } public ReportResultAdvancedChartComponent(TestPlanDTO testPlan) { @@ -47,6 +51,11 @@ public class ReportResultAdvancedChartComponent extends ReportComponent { getStatusResultMap(scenarioStatusResultMap, scenarioResultMap.get(testCase.getLastResult())); } + @Override + public void readRecord(TestPlanLoadCaseDTO testCase) { + getStatusResultMap(loadStatusResultMap, loadResultMap.get(testCase.getCaseStatus())); + } + @Override public void afterBuild(TestCaseReportMetricDTO testCaseReportMetric) { testCaseReportMetric.setExecuteResult(getReportStatusResult()); @@ -57,6 +66,7 @@ public class ReportResultAdvancedChartComponent extends ReportComponent { buildFunctionalStatusResult(reportStatusResult); buildApiStatusResult(reportStatusResult); buildScenarioStatusResult(reportStatusResult); + buildLoadStatusResult(reportStatusResult); return reportStatusResult; } @@ -87,6 +97,14 @@ public class ReportResultAdvancedChartComponent extends ReportComponent { reportStatusResult.setScenarioResult(scenarioStatusResult); } + private void buildLoadStatusResult(TestCaseReportAdvanceStatusResultDTO reportStatusResult) { + List loadStatusResult = new ArrayList<>(); + addToReportStatusResultList(loadStatusResultMap, loadStatusResult, TestPlanTestCaseStatus.Pass.name()); + addToReportStatusResultList(loadStatusResultMap, loadStatusResult, TestPlanTestCaseStatus.Failure.name()); + addToReportStatusResultList(loadStatusResultMap, loadStatusResult, TestPlanTestCaseStatus.Underway.name()); + reportStatusResult.setLoadResult(loadStatusResult); + } + private void addToReportStatusResultList(Map resultMap, List reportStatusResultList, String status) { if (resultMap.get(status) != null) { reportStatusResultList.add(resultMap.get(status)); diff --git a/backend/src/main/java/io/metersphere/track/dto/FailureTestCasesAdvanceDTO.java b/backend/src/main/java/io/metersphere/track/dto/FailureTestCasesAdvanceDTO.java index ba39267353..3688014bb9 100644 --- a/backend/src/main/java/io/metersphere/track/dto/FailureTestCasesAdvanceDTO.java +++ b/backend/src/main/java/io/metersphere/track/dto/FailureTestCasesAdvanceDTO.java @@ -13,4 +13,5 @@ public class FailureTestCasesAdvanceDTO { private List functionalTestCases; private List apiTestCases; private List scenarioTestCases; + private List loadTestCases; } diff --git a/backend/src/main/java/io/metersphere/track/dto/TestCaseReportAdvanceStatusResultDTO.java b/backend/src/main/java/io/metersphere/track/dto/TestCaseReportAdvanceStatusResultDTO.java index a092ebd190..3b79964746 100644 --- a/backend/src/main/java/io/metersphere/track/dto/TestCaseReportAdvanceStatusResultDTO.java +++ b/backend/src/main/java/io/metersphere/track/dto/TestCaseReportAdvanceStatusResultDTO.java @@ -11,5 +11,6 @@ public class TestCaseReportAdvanceStatusResultDTO { private List functionalResult; private List apiResult; private List scenarioResult; + private List loadResult; } diff --git a/backend/src/main/java/io/metersphere/track/service/TestPlanService.java b/backend/src/main/java/io/metersphere/track/service/TestPlanService.java index 24521392db..d9c6519a1e 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestPlanService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestPlanService.java @@ -26,13 +26,11 @@ import io.metersphere.notice.service.NoticeSendService; import io.metersphere.service.SystemParameterService; import io.metersphere.track.Factory.ReportComponentFactory; import io.metersphere.track.domain.ReportComponent; -import io.metersphere.track.dto.TestCaseReportMetricDTO; -import io.metersphere.track.dto.TestPlanCaseDTO; -import io.metersphere.track.dto.TestPlanDTO; -import io.metersphere.track.dto.TestPlanDTOWithMetric; +import io.metersphere.track.dto.*; import io.metersphere.track.request.testcase.PlanCaseRelevanceRequest; import io.metersphere.track.request.testcase.QueryTestPlanRequest; import io.metersphere.track.request.testplan.AddTestPlanRequest; +import io.metersphere.track.request.testplan.LoadCaseRequest; import io.metersphere.track.request.testplancase.QueryTestPlanCaseRequest; import org.apache.commons.lang3.StringUtils; import org.apache.ibatis.annotations.Param; @@ -649,6 +647,7 @@ public class TestPlanService { List issues = buildFunctionalCaseReport(planId, components); buildApiCaseReport(planId, components); buildScenarioCaseReport(planId, components); + buildLoadCaseReport(planId, components); TestCaseReportMetricDTO testCaseReportMetricDTO = new TestCaseReportMetricDTO(); components.forEach(component -> { @@ -680,6 +679,17 @@ public class TestPlanService { } } + public void buildLoadCaseReport(String planId, List components) { + LoadCaseRequest request = new LoadCaseRequest(); + request.setTestPlanId(planId); + List loadDTOs = testPlanLoadCaseService.list(request); + for (TestPlanLoadCaseDTO item : loadDTOs) { + for (ReportComponent component : components) { + component.readRecord(item); + } + } + } + public List buildFunctionalCaseReport(String planId, List components) { IssuesService issuesService = (IssuesService) CommonBeanFactory.getBean("issuesService"); List testPlanTestCases = listTestCaseByPlanId(planId); diff --git a/frontend/src/business/components/track/plan/view/comonents/load/TestPlanLoadCaseList.vue b/frontend/src/business/components/track/plan/view/comonents/load/TestPlanLoadCaseList.vue index 5f9dc9a788..77edb55906 100644 --- a/frontend/src/business/components/track/plan/view/comonents/load/TestPlanLoadCaseList.vue +++ b/frontend/src/business/components/track/plan/view/comonents/load/TestPlanLoadCaseList.vue @@ -184,6 +184,7 @@ export default { }, methods: { initTable() { + console.log('init') this.selectRows = new Set(); let param = {}; param.testPlanId = this.planId; @@ -198,7 +199,7 @@ export default { }, refreshStatus() { this.refreshScheduler = setInterval(() => { - let arr = this.tableData.filter(data => data.status !== 'Completed' && data.status !== 'Error'); + let arr = this.tableData.filter(data => data.status !== 'Completed' && data.status !== 'Error' && data.status !== "Saved"); if (arr.length > 0) { this.initTable(); } else { diff --git a/frontend/src/business/components/track/plan/view/comonents/report/TemplateComponent/FailureResultAdvanceComponent.vue b/frontend/src/business/components/track/plan/view/comonents/report/TemplateComponent/FailureResultAdvanceComponent.vue index f2d1156cb2..dc99df61ba 100644 --- a/frontend/src/business/components/track/plan/view/comonents/report/TemplateComponent/FailureResultAdvanceComponent.vue +++ b/frontend/src/business/components/track/plan/view/comonents/report/TemplateComponent/FailureResultAdvanceComponent.vue @@ -4,6 +4,7 @@ + @@ -18,13 +19,15 @@ import FunctionalFailureCasesList from "./component/FunctionalFailureCasesList"; import ApiFailureCasesList from "./component/ApiFailureCasesList"; import ScenarioFailureCasesList from "./component/ScenarioFailureCasesList"; + import LoadFailureCasesList + from "@/business/components/track/plan/view/comonents/report/TemplateComponent/component/LoadFailureCasesList"; export default { name: "FailureResultAdvanceComponent", components: { ScenarioFailureCasesList, ApiFailureCasesList, FunctionalFailureCasesList, - StatusTableItem, MethodTableItem, TypeTableItem, PriorityTableItem, CommonComponent}, + StatusTableItem, MethodTableItem, TypeTableItem, PriorityTableItem, CommonComponent, LoadFailureCasesList}, props: { failureTestCases: { type: Object, @@ -73,6 +76,15 @@ lastResult: "Failure", updateTime: new Date(), } + ], + loadTestCases: [ + { + caseName: 'testCase4', + projectName: 'P3', + userName: '/module1/module2', + createTime: new Date(), + status: 'error', + } ] } } @@ -80,14 +92,18 @@ }, computed: { showFunctional() { - return this.failureTestCases.functionalTestCases.length > 0 || (this.failureTestCases.apiTestCases.length <= 0 && this.failureTestCases.scenarioTestCases.length <= 0); + return this.failureTestCases.functionalTestCases.length > 0 + || (this.failureTestCases.apiTestCases.length <= 0 && this.failureTestCases.scenarioTestCases.length <= 0 && this.failureTestCases.loadTestCases.length <= 0); }, showApi() { return this.failureTestCases.apiTestCases.length > 0; }, showScenario() { return this.failureTestCases.scenarioTestCases.length > 0; - } + }, + showLoad() { + return this.failureTestCases.loadTestCases.length > 0; + }, }, methods: { goFailureTestCase(row) { diff --git a/frontend/src/business/components/track/plan/view/comonents/report/TemplateComponent/TestResultAdvanceChartComponent.vue b/frontend/src/business/components/track/plan/view/comonents/report/TemplateComponent/TestResultAdvanceChartComponent.vue index 6ded785208..f587d05600 100644 --- a/frontend/src/business/components/track/plan/view/comonents/report/TemplateComponent/TestResultAdvanceChartComponent.vue +++ b/frontend/src/business/components/track/plan/view/comonents/report/TemplateComponent/TestResultAdvanceChartComponent.vue @@ -17,6 +17,11 @@ + +
+ +
@@ -43,6 +48,7 @@ functionalCharData: [], apiCharData: [], scenarioCharData: [], + loadCharData: [], isShow: true } }, @@ -69,19 +75,28 @@ {status: 'Failure', count: '350'}, {status: 'Underway', count: '110'}, ], + loadResult: [ + {status: 'Pass', count: '205'}, + {status: 'Failure', count: '350'}, + {status: 'Underway', count: '110'}, + ], } } } }, computed: { showFunctional() { - return this.executeResult.functionalResult.length > 0 || (this.executeResult.apiResult.length <= 0 && this.executeResult.scenarioResult.length <= 0); + return this.executeResult.functionalResult.length > 0 + || (this.executeResult.apiResult.length <= 0 && this.executeResult.scenarioResult.length <= 0 && this.executeResult.loadResult.length <= 0); }, showApi() { return this.executeResult.apiResult.length > 0; }, showScenario() { return this.executeResult.scenarioResult.length > 0; + }, + showLoad() { + return this.executeResult.loadResult.length > 0; } }, watch: { @@ -97,6 +112,7 @@ this.getFunctionalCharData(); this.getApiCharData(); this.getScenarioCharData(); + this.getLoadCharData(); this.reload(); }, getFunctionalCharData() { @@ -129,6 +145,16 @@ }); } }, + getLoadCharData() { + this.loadCharData = []; + if (this.executeResult.loadResult) { + this.executeResult.loadResult.forEach(item => { + let data = this.dataMap.get(item.status); + data.value = item.count; + this.loadCharData.push(data); + }); + } + }, reload() { this.isShow = false; this.$nextTick(function () { diff --git a/frontend/src/business/components/track/plan/view/comonents/report/TemplateComponent/component/LoadFailureCasesList.vue b/frontend/src/business/components/track/plan/view/comonents/report/TemplateComponent/component/LoadFailureCasesList.vue new file mode 100644 index 0000000000..a2cb727759 --- /dev/null +++ b/frontend/src/business/components/track/plan/view/comonents/report/TemplateComponent/component/LoadFailureCasesList.vue @@ -0,0 +1,96 @@ + + + + + diff --git a/frontend/src/business/components/track/plan/view/comonents/test/PerformanceTestResult.vue b/frontend/src/business/components/track/plan/view/comonents/test/PerformanceTestResult.vue index 46b2f6e11e..603cb83b90 100644 --- a/frontend/src/business/components/track/plan/view/comonents/test/PerformanceTestResult.vue +++ b/frontend/src/business/components/track/plan/view/comonents/test/PerformanceTestResult.vue @@ -205,11 +205,13 @@ export default { if (this.reportId) { this.result = this.$get("/performance/report/" + this.reportId, res => { let data = res.data; - this.status = data.status; - this.$set(this.report, "id", this.reportId); - this.$set(this.report, "status", data.status); - if (this.status === "Completed") { - this.initReportTimeInfo(); + if (data) { + this.status = data.status; + this.$set(this.report, "id", this.reportId); + this.$set(this.report, "status", data.status); + if (this.status === "Completed") { + this.initReportTimeInfo(); + } } }); }