From ead49634135c7ffdd5b32ae299d4a76140803747 Mon Sep 17 00:00:00 2001 From: shiziyuan9527 Date: Wed, 27 Jan 2021 14:56:33 +0800 Subject: [PATCH 1/9] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E5=AE=9A=E4=B9=89):?= =?UTF-8?q?=20=E4=BF=AE=E5=A4=8D=E7=94=A8=E4=BE=8B=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E6=96=B0=E5=BB=BA=E7=94=A8=E4=BE=8B=E6=97=B6=E6=A0=87=E7=AD=BE?= =?UTF-8?q?=E6=9C=AA=E6=B8=85=E7=A9=BA=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/definition/components/case/ApiCaseItem.vue | 3 ++- .../api/definition/components/case/ApiCaseList.vue | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/frontend/src/business/components/api/definition/components/case/ApiCaseItem.vue b/frontend/src/business/components/api/definition/components/case/ApiCaseItem.vue index 231fbc59b4..7fcfa5c573 100644 --- a/frontend/src/business/components/api/definition/components/case/ApiCaseItem.vue +++ b/frontend/src/business/components/api/definition/components/case/ApiCaseItem.vue @@ -212,7 +212,8 @@ this.$emit('singleRun', data); }, copyCase(data) { - let obj = {name: "copy_" + data.name, priority: data.priority, active: true, request: data.request}; + let uuid = getUUID(); + let obj = {name: "copy_" + data.name, priority: data.priority, active: true, request: data.request, uuid: uuid}; this.$emit('copyCase', obj); }, selectTestCase(item, $event) { diff --git a/frontend/src/business/components/api/definition/components/case/ApiCaseList.vue b/frontend/src/business/components/api/definition/components/case/ApiCaseList.vue index 0ca8e31d57..08f54fca93 100644 --- a/frontend/src/business/components/api/definition/components/case/ApiCaseList.vue +++ b/frontend/src/business/components/api/definition/components/case/ApiCaseList.vue @@ -20,7 +20,7 @@ -
+
Date: Wed, 27 Jan 2021 15:16:33 +0800 Subject: [PATCH 2/9] =?UTF-8?q?fix:=20=E6=B5=8B=E8=AF=95=E8=AE=A1=E5=88=92?= =?UTF-8?q?-=E5=BC=80=E5=90=AF=E5=AE=9A=E6=97=B6=E6=89=A7=E8=A1=8C?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E7=96=91=E4=BC=BC=E6=9C=AA=E6=89=A7=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复测试计划-开启定时执行任务未执行的问题 : 性能测试在定时任务执行完成后进行报告ID的更新、修复了没有情景案例的情况下不执行性能测试的问题 --- .../job/sechedule/TestPlanTestJob.java | 38 ++++++++++--------- .../track/service/TestPlanReportService.java | 12 ++++++ 2 files changed, 32 insertions(+), 18 deletions(-) diff --git a/backend/src/main/java/io/metersphere/job/sechedule/TestPlanTestJob.java b/backend/src/main/java/io/metersphere/job/sechedule/TestPlanTestJob.java index 264a66f673..aad6505a13 100644 --- a/backend/src/main/java/io/metersphere/job/sechedule/TestPlanTestJob.java +++ b/backend/src/main/java/io/metersphere/job/sechedule/TestPlanTestJob.java @@ -105,25 +105,27 @@ public class TestPlanTestJob extends MsScheduleJob { //需要更新这里来保证PlanCase的状态能正常更改 apiTestCaseService.run(blobs,UUID.randomUUID().toString(),testPlanReport.getId(),this.resourceId,ApiRunMode.SCHEDULE_API_PLAN.name()); } - LogUtil.info("-------------- testplan schedule ---------- api case over -----------------"); - //执行场景执行任务 - SchedulePlanScenarioExecuteRequest scenarioRequest = new SchedulePlanScenarioExecuteRequest(); - String senarionReportID = UUID.randomUUID().toString(); - scenarioRequest.setId(senarionReportID); - scenarioRequest.setReportId(senarionReportID); - scenarioRequest.setProjectId(projectID); - scenarioRequest.setTriggerMode(ReportTriggerMode.SCHEDULE.name()); - scenarioRequest.setExecuteType(ExecuteType.Saved.name()); - Map> testPlanScenarioIdMap = new HashMap<>(); - testPlanScenarioIdMap.put(resourceId, this.planScenarioIdMap); - scenarioRequest.setTestPlanScenarioIDMap(testPlanScenarioIdMap); - scenarioRequest.setReportUserID(this.userId); - scenarioRequest.setTestPlanID(this.resourceId); - scenarioRequest.setRunMode(ApiRunMode.SCHEDULE_SCENARIO_PLAN.name()); - scenarioRequest.setTestPlanReportId(testPlanReport.getId()); - testPlanService.runScenarioCase(scenarioRequest); - LogUtil.info("-------------- testplan schedule ---------- scenario case over -----------------"); + //执行场景执行任务 + if(!planScenarioIdMap.isEmpty()){ + LogUtil.info("-------------- testplan schedule ---------- api case over -----------------"); + SchedulePlanScenarioExecuteRequest scenarioRequest = new SchedulePlanScenarioExecuteRequest(); + String senarionReportID = UUID.randomUUID().toString(); + scenarioRequest.setId(senarionReportID); + scenarioRequest.setReportId(senarionReportID); + scenarioRequest.setProjectId(projectID); + scenarioRequest.setTriggerMode(ReportTriggerMode.SCHEDULE.name()); + scenarioRequest.setExecuteType(ExecuteType.Saved.name()); + Map> testPlanScenarioIdMap = new HashMap<>(); + testPlanScenarioIdMap.put(resourceId, this.planScenarioIdMap); + scenarioRequest.setTestPlanScenarioIDMap(testPlanScenarioIdMap); + scenarioRequest.setReportUserID(this.userId); + scenarioRequest.setTestPlanID(this.resourceId); + scenarioRequest.setRunMode(ApiRunMode.SCHEDULE_SCENARIO_PLAN.name()); + scenarioRequest.setTestPlanReportId(testPlanReport.getId()); + testPlanService.runScenarioCase(scenarioRequest); + LogUtil.info("-------------- testplan schedule ---------- scenario case over -----------------"); + } //执行性能测试任务 List performaneReportIDList = new ArrayList<>(); for (Map.Entry entry: this.performanceIdMap.entrySet()) { diff --git a/backend/src/main/java/io/metersphere/track/service/TestPlanReportService.java b/backend/src/main/java/io/metersphere/track/service/TestPlanReportService.java index 2064106194..d1d172ff8e 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestPlanReportService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestPlanReportService.java @@ -281,6 +281,18 @@ public class TestPlanReportService { component.afterBuild(testCaseReportMetricDTO); }); + if (StringUtils.equals(ReportTriggerMode.SCHEDULE.name(),triggerMode) + &&StringUtils.equals(resourceRunMode, ApiRunMode.SCHEDULE_PERFORMANCE_TEST.name())) { + //如果是性能测试作为触发,由于延迟原因可能会出现报告已经结束但是状态还是进行中的状态 + List loadResult = testCaseReportMetricDTO.getExecuteResult().getLoadResult(); + for (TestCaseReportStatusResultDTO dto: loadResult) { + if(StringUtils.equals(dto.getStatus(),TestPlanTestCaseStatus.Underway.name())){ + dto.setStatus(TestPlanTestCaseStatus.Pass.name()); + } + } + testCaseReportMetricDTO.getExecuteResult().setLoadResult(loadResult); + } + TestPlanReportDataExample example = new TestPlanReportDataExample(); example.createCriteria().andTestPlanReportIdEqualTo(planReportId); List testPlanReportDataList = testPlanReportDataMapper.selectByExampleWithBLOBs(example); From 77fcc6907d671fa50fdd17f1f070bef53142eda7 Mon Sep 17 00:00:00 2001 From: "song.tianyang" Date: Wed, 27 Jan 2021 15:34:15 +0800 Subject: [PATCH 3/9] =?UTF-8?q?fix:=20=E6=B5=8B=E8=AF=95=E8=AE=A1=E5=88=92?= =?UTF-8?q?-=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95=E7=94=A8=E4=BE=8B-?= =?UTF-8?q?=E6=89=8B=E5=8A=A8=E5=8D=95=E4=B8=AA=E6=89=A7=E8=A1=8C=E7=94=A8?= =?UTF-8?q?=E4=BE=8B=E5=90=8E=E6=89=A7=E8=A1=8C=E6=97=B6=E9=97=B4=E6=9C=AA?= =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复测试计划-接口测试用例-手动单个执行用例后执行时间未更新试的问题 --- .../io/metersphere/track/service/TestPlanApiCaseService.java | 1 + .../io/metersphere/track/service/TestPlanReportService.java | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/backend/src/main/java/io/metersphere/track/service/TestPlanApiCaseService.java b/backend/src/main/java/io/metersphere/track/service/TestPlanApiCaseService.java index afdce0e41c..17ae51df69 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestPlanApiCaseService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestPlanApiCaseService.java @@ -115,6 +115,7 @@ public class TestPlanApiCaseService { TestPlanApiCase apiCase = new TestPlanApiCase(); apiCase.setId(id); apiCase.setStatus(status); + apiCase.setUpdateTime(System.currentTimeMillis()); testPlanApiCaseMapper.updateByPrimaryKeySelective(apiCase); } diff --git a/backend/src/main/java/io/metersphere/track/service/TestPlanReportService.java b/backend/src/main/java/io/metersphere/track/service/TestPlanReportService.java index d1d172ff8e..1e1e9ccbcc 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestPlanReportService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestPlanReportService.java @@ -449,7 +449,7 @@ public class TestPlanReportService { if(loadTestReportFromDatabase == null){ //检查错误数据 if(errorDataCheckMap.containsKey(loadTestReportId)){ - if(errorDataCheckMap.get(loadTestReportId)>20){ + if(errorDataCheckMap.get(loadTestReportId)>10){ performaneReportIDList.remove(loadTestReportId); }else { errorDataCheckMap.put(loadTestReportId,errorDataCheckMap.get(loadTestReportId)+1); From 7eec10e634946e4d2db7a3d878cfec6e522bf612 Mon Sep 17 00:00:00 2001 From: shiziyuan9527 Date: Wed, 27 Jan 2021 15:38:12 +0800 Subject: [PATCH 4/9] =?UTF-8?q?refactor(=E6=B5=8B=E8=AF=95=E8=AE=A1?= =?UTF-8?q?=E5=88=92):=20=E5=8A=9F=E8=83=BD=E7=94=A8=E4=BE=8B=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E6=A0=87=E7=AD=BE=E5=88=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mapper/ext/ExtTestPlanTestCaseMapper.xml | 4 ++-- .../functional/FunctionalTestCaseList.vue | 16 +++++++++++++++- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanTestCaseMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanTestCaseMapper.xml index 9b56ef1f8d..fabf6ce1da 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanTestCaseMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanTestCaseMapper.xml @@ -122,7 +122,7 @@