feat(性能测试): 压力配置提供测试取样失败后的执行动作
--bug=1009132 --user=刘瑞斌 [github#8663]失败后不继续,在性能测试中不生效 https://www.tapd.cn/55049933/s/1084983 Closes #8663
This commit is contained in:
parent
d6cbeb13d0
commit
24fa777ed0
|
@ -849,6 +849,13 @@ public class JmeterDocumentParser implements DocumentParser {
|
|||
((List<?>) durations).remove(0);
|
||||
duration = o.toString();
|
||||
}
|
||||
Object onSampleErrors = context.getProperty("onSampleError");
|
||||
String onSampleError = "continue";
|
||||
if (onSampleErrors instanceof List) {
|
||||
Object o = ((List<?>) onSampleErrors).get(0);
|
||||
((List<?>) onSampleErrors).remove(0);
|
||||
onSampleError = o.toString();
|
||||
}
|
||||
Object units = context.getProperty("unit");
|
||||
if (units instanceof List) {
|
||||
Object o = ((List<?>) units).get(0);
|
||||
|
@ -882,7 +889,7 @@ public class JmeterDocumentParser implements DocumentParser {
|
|||
elementProp.appendChild(createBoolProp(document, "LoopController.continue_forever", false));
|
||||
elementProp.appendChild(createStringProp(document, "LoopController.loops", "-1"));
|
||||
threadGroup.appendChild(elementProp);
|
||||
threadGroup.appendChild(createStringProp(document, "ThreadGroup.on_sample_error", "continue"));
|
||||
threadGroup.appendChild(createStringProp(document, "ThreadGroup.on_sample_error", onSampleError));
|
||||
threadGroup.appendChild(createStringProp(document, "ThreadGroup.num_threads", threads));
|
||||
threadGroup.appendChild(createStringProp(document, "ThreadGroup.ramp_time", rampUp));
|
||||
threadGroup.appendChild(createStringProp(document, "ThreadGroup.duration", duration));
|
||||
|
@ -951,6 +958,13 @@ public class JmeterDocumentParser implements DocumentParser {
|
|||
((List<?>) holds).remove(0);
|
||||
hold = o.toString();
|
||||
}
|
||||
Object onSampleErrors = context.getProperty("onSampleError");
|
||||
String onSampleError = "continue";
|
||||
if (onSampleErrors instanceof List) {
|
||||
Object o = ((List<?>) onSampleErrors).get(0);
|
||||
((List<?>) onSampleErrors).remove(0);
|
||||
onSampleError = o.toString();
|
||||
}
|
||||
Object units = context.getProperty("unit");
|
||||
if (units instanceof List) {
|
||||
Object o = ((List<?>) units).get(0);
|
||||
|
@ -979,7 +993,7 @@ public class JmeterDocumentParser implements DocumentParser {
|
|||
elementProp.setAttribute("name", "ThreadGroup.main_controller");
|
||||
elementProp.setAttribute("elementType", "com.blazemeter.jmeter.control.VirtualUserController");
|
||||
threadGroup.appendChild(elementProp);
|
||||
threadGroup.appendChild(createStringProp(document, "ThreadGroup.on_sample_error", "continue"));
|
||||
threadGroup.appendChild(createStringProp(document, "ThreadGroup.on_sample_error", onSampleError));
|
||||
threadGroup.appendChild(createStringProp(document, "TargetLevel", threads));
|
||||
threadGroup.appendChild(createStringProp(document, "RampUp", rampUp));
|
||||
threadGroup.appendChild(createStringProp(document, "Steps", step));
|
||||
|
@ -1074,6 +1088,13 @@ public class JmeterDocumentParser implements DocumentParser {
|
|||
((List<?>) iterateNum).remove(0);
|
||||
loops = o.toString();
|
||||
}
|
||||
Object onSampleErrors = context.getProperty("onSampleError");
|
||||
String onSampleError = "continue";
|
||||
if (onSampleErrors instanceof List) {
|
||||
Object o = ((List<?>) onSampleErrors).get(0);
|
||||
((List<?>) onSampleErrors).remove(0);
|
||||
onSampleError = o.toString();
|
||||
}
|
||||
Object rampUps = context.getProperty("iterateRampUpTime");
|
||||
String rampUp = "10";
|
||||
if (rampUps instanceof List) {
|
||||
|
@ -1110,7 +1131,7 @@ public class JmeterDocumentParser implements DocumentParser {
|
|||
elementProp.appendChild(createStringProp(document, "LoopController.loops", loops));
|
||||
threadGroup.appendChild(elementProp);
|
||||
|
||||
threadGroup.appendChild(createStringProp(document, "ThreadGroup.on_sample_error", "continue"));
|
||||
threadGroup.appendChild(createStringProp(document, "ThreadGroup.on_sample_error", onSampleError));
|
||||
threadGroup.appendChild(createStringProp(document, "ThreadGroup.num_threads", threads));
|
||||
threadGroup.appendChild(createStringProp(document, "ThreadGroup.ramp_time", rampUp));
|
||||
threadGroup.appendChild(createBoolProp(document, "ThreadGroup.scheduler", false)); // 不指定执行时间
|
||||
|
|
|
@ -69,6 +69,16 @@
|
|||
:max="maxThreadNumbers"
|
||||
size="mini"/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('load_test.on_sample_error')">
|
||||
<el-select v-model="threadGroup.onSampleError" :disabled="isReadOnly" size="mini">
|
||||
<el-option
|
||||
v-for="item in onSampleErrors"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<br>
|
||||
<el-form-item>
|
||||
<el-radio-group v-model="threadGroup.threadType" @change="calculateTotalChart()">
|
||||
|
@ -196,6 +206,7 @@ import {hasPermission} from "@/common/js/utils";
|
|||
|
||||
const HANDLER = "handler";
|
||||
const THREAD_GROUP_TYPE = "tgType";
|
||||
const ON_SAMPLE_ERROR = "onSampleError";
|
||||
const SERIALIZE_THREAD_GROUPS = "serializeThreadGroups";
|
||||
const AUTO_STOP = "autoStop";
|
||||
const AUTO_STOP_DELAY = "autoStopDelay";
|
||||
|
@ -255,6 +266,17 @@ export default {
|
|||
rampUpTimeVisible: true,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
onSampleErrors() {
|
||||
return [
|
||||
{value: 'continue', label: this.$t('load_test.continue')},
|
||||
{value: 'startnextloop', label: this.$t('load_test.startnextloop')},
|
||||
{value: 'stopthread', label: this.$t('load_test.stopthread')},
|
||||
{value: 'stoptest', label: this.$t('load_test.stoptest')},
|
||||
{value: 'stoptestnow', label: this.$t('load_test.stoptestnow')},
|
||||
];
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
if (this.testId) {
|
||||
this.getJmxContent();
|
||||
|
@ -344,6 +366,9 @@ export default {
|
|||
case THREAD_GROUP_TYPE:
|
||||
this.threadGroups[i].tgType = item.value;
|
||||
break;
|
||||
case ON_SAMPLE_ERROR:
|
||||
this.threadGroups[i].onSampleError = item.value;
|
||||
break;
|
||||
case SERIALIZE_THREAD_GROUPS:
|
||||
this.serializeThreadGroups = item.value;// 所有的线程组值一样
|
||||
break;
|
||||
|
@ -363,6 +388,7 @@ export default {
|
|||
this.$set(this.threadGroups[i], "iterateRampUp", this.threadGroups[i].iterateRampUp || 10);
|
||||
this.$set(this.threadGroups[i], "enabled", this.threadGroups[i].enabled || 'true');
|
||||
this.$set(this.threadGroups[i], "deleted", this.threadGroups[i].deleted || 'false');
|
||||
this.$set(this.threadGroups[i], "onSampleError", this.threadGroups[i].onSampleError || 'continue');
|
||||
});
|
||||
}
|
||||
for (let i = 0; i < this.threadGroups.length; i++) {
|
||||
|
@ -650,6 +676,7 @@ export default {
|
|||
{key: ITERATE_RAMP_UP, value: this.threadGroups[i].iterateRampUp},
|
||||
{key: ENABLED, value: this.threadGroups[i].enabled},
|
||||
{key: DELETED, value: this.threadGroups[i].deleted},
|
||||
{key: ON_SAMPLE_ERROR, value: this.threadGroups[i].onSampleError},
|
||||
{key: THREAD_GROUP_TYPE, value: this.threadGroups[i].tgType},
|
||||
{key: SERIALIZE_THREAD_GROUPS, value: this.serializeThreadGroups},
|
||||
{key: AUTO_STOP, value: this.autoStop},
|
||||
|
|
|
@ -51,6 +51,12 @@ export function findThreadGroup(jmxContent, handler) {
|
|||
});
|
||||
});
|
||||
threadGroups.forEach(tg => {
|
||||
for (let i = 0; i < tg.elements.length; i++) {
|
||||
if (tg.elements[i].attributes.name === 'ThreadGroup.on_sample_error') {
|
||||
tg.onSampleError = tg.elements[i].elements[0].text;
|
||||
break;
|
||||
}
|
||||
}
|
||||
tg.deleted = 'false';
|
||||
tg.handler = handler;
|
||||
tg.enabled = tg.attributes.enabled;
|
||||
|
|
|
@ -666,6 +666,12 @@ export default {
|
|||
project_file_update_type_error: 'Updated file types must be consistent',
|
||||
csv_has_header: 'Contains Title',
|
||||
csv_split: 'CSV Split',
|
||||
on_sample_error: 'After a Sampler error',
|
||||
continue:'Continue',
|
||||
startnextloop:'Start the next loop',
|
||||
stopthread:'Stop thread',
|
||||
stoptest:'Stop test',
|
||||
stoptestnow:'Stop the test immediately',
|
||||
report: {
|
||||
diff: "Compare"
|
||||
},
|
||||
|
|
|
@ -665,6 +665,12 @@ export default {
|
|||
project_file_exist: "项目中已存在该文件,请直接引用",
|
||||
csv_has_header: '包含表头',
|
||||
csv_split: 'CSV分割',
|
||||
on_sample_error: '取样器错误后',
|
||||
continue: '继续',
|
||||
startnextloop: '启动下一次循环',
|
||||
stopthread: '停止线程',
|
||||
stoptest: '停止测试',
|
||||
stoptestnow: '立即停止测试',
|
||||
report: {
|
||||
diff: "对比"
|
||||
},
|
||||
|
|
|
@ -665,6 +665,12 @@ export default {
|
|||
project_file_exist: "項目中已存在該文件,請直接引用",
|
||||
csv_has_header: '包含表头',
|
||||
csv_split: 'CSV分割',
|
||||
on_sample_error: '取樣器錯誤後',
|
||||
continue: '繼續',
|
||||
startnextloop: '啟動下一次循環',
|
||||
stopthread: '停止線程',
|
||||
stoptest: '停止測試',
|
||||
stoptestnow: '立即停止測試',
|
||||
report: {
|
||||
diff: "對比"
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue