feat(性能测试): 支持选择线程组

This commit is contained in:
Captain.B 2021-03-05 16:43:21 +08:00
parent 53f173305c
commit a281f08422
3 changed files with 40 additions and 35 deletions

View File

@ -110,15 +110,6 @@ public class EngineFactory {
final JSONArray jsonArray = JSONObject.parseArray(loadTest.getLoadConfiguration());
for (int i = 0; i < jsonArray.size(); i++) {
if (jsonArray.get(i) instanceof Map) {
JSONObject o = jsonArray.getJSONObject(i);
String key = o.getString("key");
if ("TargetLevel".equals(key)) {
engineContext.addProperty(key, Math.round(((Integer) o.get("value")) * ratio));
} else {
engineContext.addProperty(key, o.get("value"));
}
}
if (jsonArray.get(i) instanceof List) {
JSONArray o = jsonArray.getJSONArray(i);
for (int j = 0; j < o.size(); j++) {

View File

@ -642,12 +642,12 @@ public class JmeterDocumentParser implements DocumentParser {
((List<?>) rampUps).remove(0);
rampUp = o.toString();
}
Object holds = context.getProperty("Hold");
String hold = "2";
if (holds instanceof List) {
Object o = ((List<?>) holds).get(0);
((List<?>) holds).remove(0);
hold = o.toString();
Object durations = context.getProperty("duration");
String duration = "2";
if (durations instanceof List) {
Object o = ((List<?>) durations).get(0);
((List<?>) durations).remove(0);
duration = o.toString();
}
Object deleteds = context.getProperty("deleted");
String deleted = "false";
@ -681,7 +681,7 @@ public class JmeterDocumentParser implements DocumentParser {
threadGroup.appendChild(createStringProp(document, "ThreadGroup.on_sample_error", "continue"));
threadGroup.appendChild(createStringProp(document, "ThreadGroup.num_threads", threads));
threadGroup.appendChild(createStringProp(document, "ThreadGroup.ramp_time", rampUp));
threadGroup.appendChild(createStringProp(document, "ThreadGroup.duration", hold));
threadGroup.appendChild(createStringProp(document, "ThreadGroup.duration", duration));
threadGroup.appendChild(createStringProp(document, "ThreadGroup.delay", "0"));
threadGroup.appendChild(createBoolProp(document, "ThreadGroup.scheduler", true));
threadGroup.appendChild(createBoolProp(document, "ThreadGroup.same_user_on_next_iteration", true));

View File

@ -49,6 +49,7 @@
size="mini"/>
</el-form-item>
<br>
<div v-if="threadGroup.tgType === 'com.blazemeter.jmeter.threads.concurrency.ConcurrencyThreadGroup'">
<el-form-item :label="$t('load_test.ramp_up_time_within')">
<el-input-number
:disabled="true"
@ -69,6 +70,19 @@
</el-form-item>
<el-form-item :label="$t('load_test.ramp_up_time_times')"/>
</div>
<div v-if="threadGroup.tgType === 'ThreadGroup'">
<el-form-item :label="$t('load_test.ramp_up_time_within')">
<el-input-number
:disabled="true"
:min="1"
v-model="threadGroup.rampUpTime"
size="mini"/>
</el-form-item>
<el-form-item :label="$t('load_test.ramp_up_time_seconds')"/>
</div>
</div>
<div v-if="threadGroup.threadType === 'ITERATION'">
<el-form-item :label="$t('load_test.iterate_num')">
<el-input-number