diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/request/MsScenario.java b/backend/src/main/java/io/metersphere/api/dto/definition/request/MsScenario.java index 72432a510e..bb23ba172b 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/request/MsScenario.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/request/MsScenario.java @@ -62,7 +62,7 @@ public class MsScenario extends MsTestElement { private Map environmentMap; @JSONField(ordinal = 24) - private boolean onSampleError; + private Boolean onSampleError; private static final String BODY_FILE_DIR = FileUtils.BODY_FILE_DIR; diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/request/MsThreadGroup.java b/backend/src/main/java/io/metersphere/api/dto/definition/request/MsThreadGroup.java index 8960399233..3e194c35dd 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/request/MsThreadGroup.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/request/MsThreadGroup.java @@ -21,7 +21,7 @@ import java.util.List; public class MsThreadGroup extends MsTestElement { private String type = "ThreadGroup"; private boolean enableCookieShare; - private boolean onSampleError; + private Boolean onSampleError; @Override public void toHashTree(HashTree tree, List hashTree, ParameterConfig config) { @@ -66,7 +66,7 @@ public class MsThreadGroup extends MsTestElement { threadGroup.setDuration(0); threadGroup.setProperty(ThreadGroup.ON_SAMPLE_ERROR, ThreadGroup.ON_SAMPLE_ERROR_CONTINUE); threadGroup.setScheduler(false); - if (!onSampleError) { + if (onSampleError != null && !onSampleError) { threadGroup.setProperty("ThreadGroup.on_sample_error", "stoptest"); } threadGroup.setSamplerController(loopController); diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/request/ParameterConfig.java b/backend/src/main/java/io/metersphere/api/dto/definition/request/ParameterConfig.java index a4cca4b209..6ee7992ab3 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/request/ParameterConfig.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/request/ParameterConfig.java @@ -33,7 +33,7 @@ public class ParameterConfig { /** * 是否停止继续 */ - private boolean onSampleError; + private Boolean onSampleError; /** * 是否是导入/导出操作 @@ -62,4 +62,4 @@ public class ParameterConfig { return arguments; } -} \ No newline at end of file +} 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 9b796fd1c9..29538680d2 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java @@ -794,7 +794,7 @@ public class ApiAutomationService { group.setLabel(item.getName()); group.setName(reportId); MsScenario scenario = JSONObject.parseObject(item.getScenarioDefinition(), MsScenario.class); - group.setOnSampleError(scenario.isOnSampleError()); + group.setOnSampleError(scenario.getOnSampleError()); this.preduceMsScenario(scenario); if (planEnvMap.size() > 0) { scenario.setEnvironmentMap(planEnvMap); @@ -838,7 +838,7 @@ public class ApiAutomationService { group.setLabel(apiScenario.getName()); group.setName(apiScenario.getName()); group.setEnableCookieShare(scenario.isEnableCookieShare()); - group.setOnSampleError(scenario.isOnSampleError()); + group.setOnSampleError(scenario.getOnSampleError()); group.setHashTree(new LinkedList() {{ this.add(scenario); }}); @@ -1077,7 +1077,7 @@ public class ApiAutomationService { mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); JSONObject element = JSON.parseObject(item.getScenarioDefinition()); MsScenario scenario = JSONObject.parseObject(item.getScenarioDefinition(), MsScenario.class); - group.setOnSampleError(scenario.isOnSampleError()); + group.setOnSampleError(scenario.getOnSampleError()); this.preduceMsScenario(scenario); // 多态JSON普通转换会丢失内容,需要通过 ObjectMapper 获取 if (element != null && StringUtils.isNotEmpty(element.getString("hashTree"))) { @@ -1093,7 +1093,7 @@ public class ApiAutomationService { scenario.setVariables(variables); } group.setEnableCookieShare(scenario.isEnableCookieShare()); - group.setOnSampleError(scenario.isOnSampleError()); + group.setOnSampleError(scenario.getOnSampleError()); LinkedList scenarios = new LinkedList<>(); scenarios.add(scenario); // 创建场景报告 diff --git a/backend/src/main/java/io/metersphere/track/service/TestPlanService.java b/backend/src/main/java/io/metersphere/track/service/TestPlanService.java index 1f1cb5454a..5924c92a59 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestPlanService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestPlanService.java @@ -969,7 +969,7 @@ public class TestPlanService { mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); JSONObject element = JSON.parseObject(item.getScenarioDefinition()); MsScenario scenario = JSONObject.parseObject(item.getScenarioDefinition(), MsScenario.class); - group.setOnSampleError(scenario.isOnSampleError()); + group.setOnSampleError(scenario.getOnSampleError()); // 多态JSON普通转换会丢失内容,需要通过 ObjectMapper 获取 if (element != null && StringUtils.isNotEmpty(element.getString("hashTree"))) { LinkedList elements = mapper.readValue(element.getString("hashTree"),