From fd1d8e79efe0f6f3de6452aa813adaabc6eba514 Mon Sep 17 00:00:00 2001 From: song-tianyang Date: Mon, 19 Sep 2022 19:12:51 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=8E=A5=E5=8F=A3=E5=9C=BA=E6=99=AF=E5=AF=BC?= =?UTF-8?q?=E5=85=A5=E6=97=B6=E4=BC=9A=E4=BF=9D=E7=95=99=E4=B9=8B=E5=89=8D?= =?UTF-8?q?=E6=89=A7=E8=A1=8C=E6=AC=A1=E6=95=B0=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1016877 --user=宋天阳 【接口测试】导入的场景,首页统计的通过率、执行次数不对 https://www.tapd.cn/55049933/s/1245892 --- .../automation/parse/MsScenarioParser.java | 31 ++----------------- 1 file changed, 2 insertions(+), 29 deletions(-) diff --git a/backend/src/main/java/io/metersphere/api/dto/automation/parse/MsScenarioParser.java b/backend/src/main/java/io/metersphere/api/dto/automation/parse/MsScenarioParser.java index 19fedda5ed..8e7891d165 100644 --- a/backend/src/main/java/io/metersphere/api/dto/automation/parse/MsScenarioParser.java +++ b/backend/src/main/java/io/metersphere/api/dto/automation/parse/MsScenarioParser.java @@ -65,26 +65,10 @@ public class MsScenarioParser extends MsAbstractParser { ScenarioImport scenarioImport = JSON.parseObject(testStr, ScenarioImport.class, Feature.DisableSpecialKeyDetect); List data = scenarioImport.getData(); - /*Set moduleIdSet = scenarioImport.getData().stream() - .map(ApiScenarioWithBLOBs::getApiScenarioModuleId).collect(Collectors.toSet());*/ - -/* - Map nodeMap = null; -*/ -/* - List nodeTree = scenarioImport.getNodeTree(); -*/ - /*if (CollectionUtils.isNotEmpty(nodeTree)) { - cutDownTree(nodeTree, moduleIdSet); - ApiScenarioImportUtil.createNodeTree(nodeTree, projectId, importRequest.getModuleId()); - nodeMap = getNodeMap(nodeTree); - }*/ - if (CollectionUtils.isNotEmpty(data)) { -/* - Map finalNodeMap = nodeMap; -*/ data.forEach(item -> { + //导入的用例,执行次数应当归零,否则会影响到首页的统计 + item.setExecuteTimes(0); String scenarioDefinitionStr = item.getScenarioDefinition(); if (StringUtils.isNotBlank(scenarioDefinitionStr)) { JSONObject scenarioDefinition = JSONObject.parseObject(scenarioDefinitionStr, Feature.DisableSpecialKeyDetect); @@ -101,17 +85,6 @@ public class MsScenarioParser extends MsAbstractParser { } } - /*if (finalNodeMap != null && finalNodeMap.get(item.getApiScenarioModuleId()) != null) { - NodeTree node = finalNodeMap.get(item.getApiScenarioModuleId()); - item.setApiScenarioModuleId(node.getNewId()); - item.setModulePath(node.getPath()); - } else { - if (StringUtils.isBlank(item.getModulePath())) { - item.setApiScenarioModuleId(null); - } - // 旧版本未导出模块 - parseModule(item.getModulePath(), importRequest, item); - }*/ item.setProjectId(this.projectId); }); }