fix: 修改场景自动化 失败继续
This commit is contained in:
parent
45478e153d
commit
d6a2fe52ca
|
@ -61,6 +61,9 @@ public class MsScenario extends MsTestElement {
|
||||||
@JSONField(ordinal = 27)
|
@JSONField(ordinal = 27)
|
||||||
private Map<String, String> environmentMap;
|
private Map<String, String> environmentMap;
|
||||||
|
|
||||||
|
@JSONField(ordinal = 24)
|
||||||
|
private Boolean onSampleError;
|
||||||
|
|
||||||
private static final String BODY_FILE_DIR = FileUtils.BODY_FILE_DIR;
|
private static final String BODY_FILE_DIR = FileUtils.BODY_FILE_DIR;
|
||||||
|
|
||||||
public MsScenario() {
|
public MsScenario() {
|
||||||
|
|
|
@ -66,7 +66,7 @@ public class MsThreadGroup extends MsTestElement {
|
||||||
threadGroup.setDuration(0);
|
threadGroup.setDuration(0);
|
||||||
threadGroup.setProperty(ThreadGroup.ON_SAMPLE_ERROR, ThreadGroup.ON_SAMPLE_ERROR_CONTINUE);
|
threadGroup.setProperty(ThreadGroup.ON_SAMPLE_ERROR, ThreadGroup.ON_SAMPLE_ERROR_CONTINUE);
|
||||||
threadGroup.setScheduler(false);
|
threadGroup.setScheduler(false);
|
||||||
if (onSampleError) {
|
if (!onSampleError) {
|
||||||
threadGroup.setProperty("ThreadGroup.on_sample_error", "stoptest");
|
threadGroup.setProperty("ThreadGroup.on_sample_error", "stoptest");
|
||||||
}
|
}
|
||||||
threadGroup.setSamplerController(loopController);
|
threadGroup.setSamplerController(loopController);
|
||||||
|
|
|
@ -30,6 +30,10 @@ public class ParameterConfig {
|
||||||
* 公共Cookie
|
* 公共Cookie
|
||||||
*/
|
*/
|
||||||
private boolean enableCookieShare;
|
private boolean enableCookieShare;
|
||||||
|
/**
|
||||||
|
* 是否停止继续
|
||||||
|
*/
|
||||||
|
private boolean onSampleError;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否是导入/导出操作
|
* 是否是导入/导出操作
|
||||||
|
|
|
@ -1079,6 +1079,7 @@ public class ApiAutomationService {
|
||||||
scenario.setVariables(variables);
|
scenario.setVariables(variables);
|
||||||
}
|
}
|
||||||
group.setEnableCookieShare(scenario.isEnableCookieShare());
|
group.setEnableCookieShare(scenario.isEnableCookieShare());
|
||||||
|
group.setOnSampleError(scenario.getOnSampleError());
|
||||||
LinkedList<MsTestElement> scenarios = new LinkedList<>();
|
LinkedList<MsTestElement> scenarios = new LinkedList<>();
|
||||||
scenarios.add(scenario);
|
scenarios.add(scenario);
|
||||||
// 创建场景报告
|
// 创建场景报告
|
||||||
|
|
|
@ -32,11 +32,13 @@ import {saveScenario} from "@/business/components/api/automation/api-automation"
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
run() {
|
run() {
|
||||||
|
console.log(this.runData.onSampleError);
|
||||||
let testPlan = createComponent('TestPlan');
|
let testPlan = createComponent('TestPlan');
|
||||||
let threadGroup = createComponent('ThreadGroup');
|
let threadGroup = createComponent('ThreadGroup');
|
||||||
threadGroup.hashTree = [];
|
threadGroup.hashTree = [];
|
||||||
threadGroup.name = this.reportId;
|
threadGroup.name = this.reportId;
|
||||||
threadGroup.enableCookieShare = this.runData.enableCookieShare;
|
threadGroup.enableCookieShare = this.runData.enableCookieShare;
|
||||||
|
threadGroup.onSampleError = this.runData.onSampleError;
|
||||||
let map = this.environment;
|
let map = this.environment;
|
||||||
this.runData.projectId = getCurrentProjectID();
|
this.runData.projectId = getCurrentProjectID();
|
||||||
threadGroup.hashTree.push(this.runData);
|
threadGroup.hashTree.push(this.runData);
|
||||||
|
|
|
@ -140,8 +140,8 @@
|
||||||
:isReadOnly="scenarioDefinition.length < 1" @showPopover="showPopover"
|
:isReadOnly="scenarioDefinition.length < 1" @showPopover="showPopover"
|
||||||
:project-list="projectList" ref="envPopover"/>
|
:project-list="projectList" ref="envPopover"/>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="2" class="ms-col-one ms-font">
|
<el-col :span="3" class="ms-col-one ms-font">
|
||||||
<el-checkbox v-model="enableContinues">{{ $t('commons.failure_continues') }}</el-checkbox>
|
<el-checkbox v-model="onSampleError">{{ $t('commons.failure_continues') }}</el-checkbox>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="4">
|
<el-col :span="4">
|
||||||
<el-button :disabled="scenarioDefinition.length < 1" size="mini" type="primary" v-prevent-re-click
|
<el-button :disabled="scenarioDefinition.length < 1" size="mini" type="primary" v-prevent-re-click
|
||||||
|
@ -317,8 +317,7 @@ export default {
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
enableContinues: false,
|
onSampleError: false,
|
||||||
showConfigButtonWithOutPermission:false,
|
|
||||||
props: {
|
props: {
|
||||||
label: "label",
|
label: "label",
|
||||||
children: "hashTree"
|
children: "hashTree"
|
||||||
|
@ -390,6 +389,7 @@ export default {
|
||||||
this.getMaintainerOptions();
|
this.getMaintainerOptions();
|
||||||
this.getApiScenario();
|
this.getApiScenario();
|
||||||
this.addListener(); // 添加 ctrl s 监听
|
this.addListener(); // 添加 ctrl s 监听
|
||||||
|
|
||||||
},
|
},
|
||||||
directives: {OutsideClick},
|
directives: {OutsideClick},
|
||||||
computed: {
|
computed: {
|
||||||
|
@ -873,7 +873,8 @@ export default {
|
||||||
enableCookieShare: this.enableCookieShare,
|
enableCookieShare: this.enableCookieShare,
|
||||||
headers: this.currentScenario.headers,
|
headers: this.currentScenario.headers,
|
||||||
environmentMap: this.projectEnvMap,
|
environmentMap: this.projectEnvMap,
|
||||||
hashTree: this.scenarioDefinition
|
hashTree: this.scenarioDefinition,
|
||||||
|
onSampleError: this.onSampleError,
|
||||||
};
|
};
|
||||||
this.reportId = getUUID().substring(0, 8);
|
this.reportId = getUUID().substring(0, 8);
|
||||||
// this.editScenario().then(() => {
|
// this.editScenario().then(() => {
|
||||||
|
@ -1033,6 +1034,7 @@ export default {
|
||||||
this.currentScenario.headers = obj.headers;
|
this.currentScenario.headers = obj.headers;
|
||||||
}
|
}
|
||||||
this.enableCookieShare = obj.enableCookieShare;
|
this.enableCookieShare = obj.enableCookieShare;
|
||||||
|
this.onSampleError = obj.onSampleError;
|
||||||
if (obj.hashTree) {
|
if (obj.hashTree) {
|
||||||
obj.hashTree.forEach(item => {
|
obj.hashTree.forEach(item => {
|
||||||
if (!item.hashTree) {
|
if (!item.hashTree) {
|
||||||
|
@ -1066,7 +1068,9 @@ export default {
|
||||||
referenced: 'Created',
|
referenced: 'Created',
|
||||||
environmentMap: strMapToObj(this.projectEnvMap),
|
environmentMap: strMapToObj(this.projectEnvMap),
|
||||||
hashTree: this.scenarioDefinition,
|
hashTree: this.scenarioDefinition,
|
||||||
|
onSampleError: this.onSampleError,
|
||||||
projectId: this.projectId,
|
projectId: this.projectId,
|
||||||
|
|
||||||
};
|
};
|
||||||
this.currentScenario.scenarioDefinition = scenario;
|
this.currentScenario.scenarioDefinition = scenario;
|
||||||
if (this.currentScenario.tags instanceof Array) {
|
if (this.currentScenario.tags instanceof Array) {
|
||||||
|
|
Loading…
Reference in New Issue