fix: 失败继续无效
This commit is contained in:
parent
dc0bd51ab9
commit
556e4b1d0e
|
@ -62,7 +62,7 @@ public class MsScenario extends MsTestElement {
|
|||
private Map<String, String> environmentMap;
|
||||
|
||||
@JSONField(ordinal = 24)
|
||||
private boolean onSampleError;
|
||||
private Boolean onSampleError;
|
||||
|
||||
private static final String BODY_FILE_DIR = FileUtils.BODY_FILE_DIR;
|
||||
|
||||
|
|
|
@ -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<MsTestElement> 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);
|
||||
|
|
|
@ -33,7 +33,7 @@ public class ParameterConfig {
|
|||
/**
|
||||
* 是否停止继续
|
||||
*/
|
||||
private boolean onSampleError;
|
||||
private Boolean onSampleError;
|
||||
|
||||
/**
|
||||
* 是否是导入/导出操作
|
||||
|
|
|
@ -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<MsTestElement>() {{
|
||||
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<MsTestElement> scenarios = new LinkedList<>();
|
||||
scenarios.add(scenario);
|
||||
// 创建场景报告
|
||||
|
|
|
@ -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<MsTestElement> elements = mapper.readValue(element.getString("hashTree"),
|
||||
|
|
Loading…
Reference in New Issue