fix(接口自动化): 执行场景没有步骤时保护

This commit is contained in:
fit2-zhao 2020-12-29 15:17:55 +08:00
parent 88a633237f
commit fb8abc6c18
4 changed files with 9 additions and 4 deletions

View File

@ -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());

View File

@ -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

View File

@ -177,4 +177,5 @@ task_notification_jenkins=jenkins任务通知
task_notification=任务通知
message_task_already_exists=任务接收人已经存在
#automation
automation_name_already_exists=同一个项目和模块下,场景名称不能重复
automation_name_already_exists=同一个项目和模块下,场景名称不能重复
automation_exec_info=没有测试步骤,无法执行

View File

@ -179,3 +179,4 @@ api_definition_url_not_repeating=接口請求地址已經存在
message_task_already_exists=任務接收人已經存在
#automation
automation_name_already_exists=同一個項目和模塊下,場景名稱不能重複
automation_exec_info=沒有測試步驟,無法執行