From 7e4ad2384a7047da86d2c211ba3f2414d5893f47 Mon Sep 17 00:00:00 2001 From: fit2-zhao Date: Tue, 5 Jan 2021 15:33:47 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=8C=96):=20=E5=9C=BA=E6=99=AF=E6=89=B9=E9=87=8F=E6=89=A7?= =?UTF-8?q?=E8=A1=8C=EF=BC=8C=E6=97=A0=E6=AD=A5=E9=AA=A4=E7=9A=84=E5=9C=BA?= =?UTF-8?q?=E6=99=AF=E8=B7=B3=E8=BF=87=EF=BC=8C=E6=AD=A3=E5=B8=B8=E7=9A=84?= =?UTF-8?q?=E7=BB=A7=E7=BB=AD=E6=89=A7=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/service/ApiAutomationService.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java b/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java index 9465a3caea..de677f4a50 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java @@ -24,6 +24,7 @@ import io.metersphere.base.mapper.ext.ExtTestPlanScenarioCaseMapper; import io.metersphere.commons.constants.*; import io.metersphere.commons.exception.MSException; import io.metersphere.commons.utils.DateUtils; +import io.metersphere.commons.utils.LogUtil; import io.metersphere.commons.utils.ServiceUtils; import io.metersphere.commons.utils.SessionUtils; import io.metersphere.i18n.Translator; @@ -316,8 +317,12 @@ public class ApiAutomationService { boolean isFirst = true; for (ApiScenarioWithBLOBs item : apiScenarios) { if (item.getStepTotal() == 0) { - MSException.throwException(item.getName() + "," + Translator.get("automation_exec_info")); - break; + // 只有一个场景且没有测试步骤,则提示 + if (apiScenarios.size() == 1) { + MSException.throwException((item.getName() + "," + Translator.get("automation_exec_info"))); + } + LogUtil.warn(item.getName() + "," + Translator.get("automation_exec_info")); + continue; } MsThreadGroup group = new MsThreadGroup(); group.setLabel(item.getName()); @@ -335,14 +340,12 @@ public class ApiAutomationService { // 多态JSON普通转换会丢失内容,需要通过 ObjectMapper 获取 if (element != null && StringUtils.isNotEmpty(element.getString("hashTree"))) { LinkedList elements = mapper.readValue(element.getString("hashTree"), - new TypeReference>() { - }); + new TypeReference>() {}); scenario.setHashTree(elements); } if (StringUtils.isNotEmpty(element.getString("variables"))) { LinkedList variables = mapper.readValue(element.getString("variables"), - new TypeReference>() { - }); + new TypeReference>() {}); scenario.setVariables(variables); } group.setEnableCookieShare(scenario.isEnableCookieShare());