fix: 修改场景自动化 失败继续

This commit is contained in:
wenyann 2021-06-14 16:27:00 +08:00 committed by 刘瑞斌
parent 45478e153d
commit d6a2fe52ca
6 changed files with 20 additions and 6 deletions

View File

@ -61,6 +61,9 @@ public class MsScenario extends MsTestElement {
@JSONField(ordinal = 27)
private Map<String, String> environmentMap;
@JSONField(ordinal = 24)
private Boolean onSampleError;
private static final String BODY_FILE_DIR = FileUtils.BODY_FILE_DIR;
public MsScenario() {

View File

@ -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) {
threadGroup.setProperty("ThreadGroup.on_sample_error", "stoptest");
}
threadGroup.setSamplerController(loopController);

View File

@ -30,6 +30,10 @@ public class ParameterConfig {
* 公共Cookie
*/
private boolean enableCookieShare;
/**
* 是否停止继续
*/
private boolean onSampleError;
/**
* 是否是导入/导出操作

View File

@ -1079,6 +1079,7 @@ public class ApiAutomationService {
scenario.setVariables(variables);
}
group.setEnableCookieShare(scenario.isEnableCookieShare());
group.setOnSampleError(scenario.getOnSampleError());
LinkedList<MsTestElement> scenarios = new LinkedList<>();
scenarios.add(scenario);
// 创建场景报告

View File

@ -32,11 +32,13 @@ import {saveScenario} from "@/business/components/api/automation/api-automation"
},
methods: {
run() {
console.log(this.runData.onSampleError);
let testPlan = createComponent('TestPlan');
let threadGroup = createComponent('ThreadGroup');
threadGroup.hashTree = [];
threadGroup.name = this.reportId;
threadGroup.enableCookieShare = this.runData.enableCookieShare;
threadGroup.onSampleError = this.runData.onSampleError;
let map = this.environment;
this.runData.projectId = getCurrentProjectID();
threadGroup.hashTree.push(this.runData);

View File

@ -140,8 +140,8 @@
:isReadOnly="scenarioDefinition.length < 1" @showPopover="showPopover"
:project-list="projectList" ref="envPopover"/>
</el-col>
<el-col :span="2" class="ms-col-one ms-font">
<el-checkbox v-model="enableContinues">{{ $t('commons.failure_continues') }}</el-checkbox>
<el-col :span="3" class="ms-col-one ms-font">
<el-checkbox v-model="onSampleError">{{ $t('commons.failure_continues') }}</el-checkbox>
</el-col>
<el-col :span="4">
<el-button :disabled="scenarioDefinition.length < 1" size="mini" type="primary" v-prevent-re-click
@ -317,8 +317,7 @@ export default {
},
data() {
return {
enableContinues: false,
showConfigButtonWithOutPermission:false,
onSampleError: false,
props: {
label: "label",
children: "hashTree"
@ -390,6 +389,7 @@ export default {
this.getMaintainerOptions();
this.getApiScenario();
this.addListener(); // ctrl s
},
directives: {OutsideClick},
computed: {
@ -873,7 +873,8 @@ export default {
enableCookieShare: this.enableCookieShare,
headers: this.currentScenario.headers,
environmentMap: this.projectEnvMap,
hashTree: this.scenarioDefinition
hashTree: this.scenarioDefinition,
onSampleError: this.onSampleError,
};
this.reportId = getUUID().substring(0, 8);
// this.editScenario().then(() => {
@ -1033,6 +1034,7 @@ export default {
this.currentScenario.headers = obj.headers;
}
this.enableCookieShare = obj.enableCookieShare;
this.onSampleError = obj.onSampleError;
if (obj.hashTree) {
obj.hashTree.forEach(item => {
if (!item.hashTree) {
@ -1066,7 +1068,9 @@ export default {
referenced: 'Created',
environmentMap: strMapToObj(this.projectEnvMap),
hashTree: this.scenarioDefinition,
onSampleError: this.onSampleError,
projectId: this.projectId,
};
this.currentScenario.scenarioDefinition = scenario;
if (this.currentScenario.tags instanceof Array) {