From fb8abc6c18c6bdc13f2261f3dfe9a63bdb226244 Mon Sep 17 00:00:00 2001 From: fit2-zhao Date: Tue, 29 Dec 2020 15:17:55 +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=E6=89=A7=E8=A1=8C=E5=9C=BA=E6=99=AF=E6=B2=A1?= =?UTF-8?q?=E6=9C=89=E6=AD=A5=E9=AA=A4=E6=97=B6=E4=BF=9D=E6=8A=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/metersphere/api/service/ApiAutomationService.java | 7 +++++-- backend/src/main/resources/i18n/messages_en_US.properties | 2 +- backend/src/main/resources/i18n/messages_zh_CN.properties | 3 ++- backend/src/main/resources/i18n/messages_zh_TW.properties | 1 + 4 files changed, 9 insertions(+), 4 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 19c1b0376d..8599652296 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java @@ -24,7 +24,6 @@ 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; @@ -310,6 +309,10 @@ public class ApiAutomationService { try { boolean isFirst = true; for (ApiScenarioWithBLOBs item : apiScenarios) { + if (item.getStepTotal() == 0) { + MSException.throwException(item.getName() + "," + Translator.get("automation_exec_info")); + break; + } MsThreadGroup group = new MsThreadGroup(); group.setLabel(item.getName()); group.setName(UUID.randomUUID().toString()); @@ -347,7 +350,7 @@ public class ApiAutomationService { } } catch (Exception ex) { - LogUtil.error(ex.getMessage()); + MSException.throwException(ex.getMessage()); } testPlan.toHashTree(jmeterHashTree, testPlan.getHashTree(), new ParameterConfig()); diff --git a/backend/src/main/resources/i18n/messages_en_US.properties b/backend/src/main/resources/i18n/messages_en_US.properties index ae2aa26f23..51f39e1c43 100644 --- a/backend/src/main/resources/i18n/messages_en_US.properties +++ b/backend/src/main/resources/i18n/messages_en_US.properties @@ -177,6 +177,6 @@ task_notification=Result notification message_task_already_exists=Task recipient already exists #automation automation_name_already_exists=the scenario already exists in the project and the module - +automation_exec_info=There are no test steps to execute diff --git a/backend/src/main/resources/i18n/messages_zh_CN.properties b/backend/src/main/resources/i18n/messages_zh_CN.properties index 983fac6be2..82313e0b5b 100644 --- a/backend/src/main/resources/i18n/messages_zh_CN.properties +++ b/backend/src/main/resources/i18n/messages_zh_CN.properties @@ -177,4 +177,5 @@ task_notification_jenkins=jenkins任务通知 task_notification=任务通知 message_task_already_exists=任务接收人已经存在 #automation -automation_name_already_exists=同一个项目和模块下,场景名称不能重复 \ No newline at end of file +automation_name_already_exists=同一个项目和模块下,场景名称不能重复 +automation_exec_info=没有测试步骤,无法执行 \ No newline at end of file diff --git a/backend/src/main/resources/i18n/messages_zh_TW.properties b/backend/src/main/resources/i18n/messages_zh_TW.properties index 97a457beb3..f3ddb7decc 100644 --- a/backend/src/main/resources/i18n/messages_zh_TW.properties +++ b/backend/src/main/resources/i18n/messages_zh_TW.properties @@ -179,3 +179,4 @@ api_definition_url_not_repeating=接口請求地址已經存在 message_task_already_exists=任務接收人已經存在 #automation automation_name_already_exists=同一個項目和模塊下,場景名稱不能重複 +automation_exec_info=沒有測試步驟,無法執行 \ No newline at end of file