refactor(性能测试): 修改按照迭代次数策略,使用JMeter默认策略来控制
This commit is contained in:
parent
c8377f3cd9
commit
612838d2b8
|
@ -13,9 +13,7 @@ import io.metersphere.performance.parse.EngineSourceParser;
|
|||
import io.metersphere.performance.parse.EngineSourceParserFactory;
|
||||
import io.metersphere.service.TestResourcePoolService;
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
||||
import org.apache.commons.lang3.ClassUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.reflect.MethodUtils;
|
||||
import org.dom4j.Document;
|
||||
import org.dom4j.Element;
|
||||
import org.dom4j.Node;
|
||||
|
@ -937,8 +935,10 @@ public class JmeterDocumentParser implements EngineSourceParser {
|
|||
// elementProp
|
||||
// 避免出现配置错位
|
||||
Object durations = context.getProperty("duration");
|
||||
String duration = "2";
|
||||
if (durations instanceof List) {
|
||||
((List<?>) durations).remove(0);
|
||||
Object o = ((List<?>) durations).remove(0);
|
||||
duration = o.toString();
|
||||
}
|
||||
Object units = context.getProperty("unit");
|
||||
if (units instanceof List) {
|
||||
|
@ -1015,10 +1015,10 @@ public class JmeterDocumentParser implements EngineSourceParser {
|
|||
appendStringProp(threadGroup, "ThreadGroup.on_sample_error", onSampleError);
|
||||
appendStringProp(threadGroup, "ThreadGroup.num_threads", threads);
|
||||
appendStringProp(threadGroup, "ThreadGroup.ramp_time", rampUp);
|
||||
appendBoolProp(threadGroup, "ThreadGroup.scheduler", false);
|
||||
appendBoolProp(threadGroup, "ThreadGroup.scheduler", true);
|
||||
appendStringProp(threadGroup, "Hold", "1");
|
||||
appendStringProp(threadGroup, "ThreadGroup.duration", "10");
|
||||
appendStringProp(threadGroup, "ThreadGroup.delay", "");
|
||||
appendStringProp(threadGroup, "ThreadGroup.duration", duration);
|
||||
appendStringProp(threadGroup, "ThreadGroup.delay", "0");
|
||||
appendBoolProp(threadGroup, "ThreadGroup.same_user_on_next_iteration", true);
|
||||
}
|
||||
|
||||
|
|
|
@ -97,53 +97,9 @@
|
|||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<div v-if="threadGroup.threadType === 'DURATION'">
|
||||
<el-form-item :label="$t('load_test.duration')">
|
||||
<el-input-number controls-position="right"
|
||||
|
||||
v-model="threadGroup.durationHours"
|
||||
:min="0"
|
||||
:max="9999"
|
||||
@change="calculateTotalChart()"
|
||||
size="mini"/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('load_test.hours')" label-width="20px"/>
|
||||
<el-form-item>
|
||||
<el-input-number controls-position="right"
|
||||
|
||||
v-model="threadGroup.durationMinutes"
|
||||
:min="0"
|
||||
:max="59"
|
||||
@change="calculateTotalChart()"
|
||||
size="mini"/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('load_test.minutes')" label-width="20px"/>
|
||||
<el-form-item>
|
||||
<el-input-number controls-position="right"
|
||||
|
||||
v-model="threadGroup.durationSeconds"
|
||||
:min="0"
|
||||
:max="59"
|
||||
@change="calculateTotalChart()"
|
||||
size="mini"/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('load_test.seconds')" label-width="20px"/>
|
||||
<br>
|
||||
<el-form-item :label="$t('load_test.rps_limit_enable')">
|
||||
<el-switch v-model="threadGroup.rpsLimitEnable" @change="calculateTotalChart()"/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('load_test.rps_limit')">
|
||||
<el-input-number controls-position="right"
|
||||
:disabled="isReadOnly || !threadGroup.rpsLimitEnable"
|
||||
v-model="threadGroup.rpsLimit"
|
||||
@change="calculateTotalChart()"
|
||||
:min="1"
|
||||
:max="99999"
|
||||
size="mini"/>
|
||||
</el-form-item>
|
||||
<div v-if="threadGroup.tgType === 'com.blazemeter.jmeter.threads.concurrency.ConcurrencyThreadGroup'">
|
||||
<el-form-item label="Ramp-Up">
|
||||
<el-input-number controls-position="right"
|
||||
|
||||
:min="1"
|
||||
v-if="rampUpTimeVisible"
|
||||
:max="getDuration(threadGroup)"
|
||||
|
@ -153,7 +109,6 @@
|
|||
</el-form-item>
|
||||
<el-form-item label="Step" label-width="50px">
|
||||
<el-input-number controls-position="right"
|
||||
|
||||
:min="1"
|
||||
:max="Math.min(threadGroup.threadNumber, threadGroup.rampUpTime)"
|
||||
v-model="threadGroup.step"
|
||||
|
@ -179,34 +134,66 @@
|
|||
<div v-if="threadGroup.threadType === 'ITERATION'">
|
||||
<el-form-item :label="$t('load_test.iterate_num')">
|
||||
<el-input-number controls-position="right"
|
||||
|
||||
v-model="threadGroup.iterateNum"
|
||||
:min="1"
|
||||
:max="9999999"
|
||||
@change="calculateTotalChart()"
|
||||
size="mini"/>
|
||||
size="mini"/>
|
||||
<el-tooltip :content="$t('load_test.by_iteration_tip')"
|
||||
effect="light"
|
||||
trigger="hover">
|
||||
<i class="el-icon-info"></i>
|
||||
</el-tooltip>
|
||||
</el-form-item>
|
||||
<br>
|
||||
<el-form-item :label="$t('load_test.rps_limit_enable')">
|
||||
<el-switch v-model="threadGroup.rpsLimitEnable" @change="calculateTotalChart()"/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('load_test.rps_limit')">
|
||||
<el-input-number controls-position="right"
|
||||
:disabled="isReadOnly || !threadGroup.rpsLimitEnable"
|
||||
v-model="threadGroup.rpsLimit"
|
||||
:min="1"
|
||||
:max="99999"
|
||||
size="mini"/>
|
||||
</el-form-item>
|
||||
<br>
|
||||
<el-form-item label="Ramp-Up">
|
||||
<el-input-number controls-position="right"
|
||||
|
||||
:min="1"
|
||||
v-model="threadGroup.iterateRampUp"
|
||||
size="mini"/>
|
||||
</el-form-item>
|
||||
<br>
|
||||
</div>
|
||||
<el-form-item :label="$t('load_test.duration')">
|
||||
<el-input-number controls-position="right"
|
||||
|
||||
v-model="threadGroup.durationHours"
|
||||
:min="0"
|
||||
:max="9999"
|
||||
@change="calculateTotalChart()"
|
||||
size="mini"/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('load_test.hours')" label-width="20px"/>
|
||||
<el-form-item>
|
||||
<el-input-number controls-position="right"
|
||||
|
||||
v-model="threadGroup.durationMinutes"
|
||||
:min="0"
|
||||
:max="59"
|
||||
@change="calculateTotalChart()"
|
||||
size="mini"/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('load_test.minutes')" label-width="20px"/>
|
||||
<el-form-item>
|
||||
<el-input-number controls-position="right"
|
||||
v-model="threadGroup.durationSeconds"
|
||||
:min="0"
|
||||
:max="59"
|
||||
@change="calculateTotalChart()"
|
||||
size="mini"/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('load_test.seconds')" label-width="20px"/>
|
||||
<br>
|
||||
<el-form-item :label="$t('load_test.rps_limit_enable')">
|
||||
<el-switch v-model="threadGroup.rpsLimitEnable" @change="calculateTotalChart()"/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('load_test.rps_limit')">
|
||||
<el-input-number controls-position="right"
|
||||
:disabled="isReadOnly || !threadGroup.rpsLimitEnable"
|
||||
v-model="threadGroup.rpsLimit"
|
||||
:min="1"
|
||||
:max="99999"
|
||||
size="mini"/>
|
||||
</el-form-item>
|
||||
<!-- 资源池自己配置各个节点的并发 -->
|
||||
<div v-if="resourcePoolType === 'NODE'">
|
||||
<el-form-item :label="$t('load_test.resource_strategy')">
|
||||
|
|
|
@ -89,56 +89,13 @@
|
|||
</el-select>
|
||||
</el-form-item>
|
||||
<br>
|
||||
<el-form-item label="执行方式">
|
||||
<el-form-item :label="$t('load_test.run_mode')">
|
||||
<el-radio-group v-model="threadGroup.threadType" @change="calculateTotalChart()" size="mini">
|
||||
<el-radio-button label="DURATION">{{ $t('load_test.by_duration') }}</el-radio-button>
|
||||
<el-radio-button label="ITERATION">{{ $t('load_test.by_iteration') }}</el-radio-button>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<div v-if="threadGroup.threadType === 'DURATION'">
|
||||
<el-form-item :label="$t('load_test.duration')">
|
||||
<el-input-number controls-position="right"
|
||||
:disabled="isReadOnly"
|
||||
v-model="threadGroup.durationHours"
|
||||
:min="0"
|
||||
:max="9999"
|
||||
@change="calculateTotalChart()"
|
||||
size="mini"/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('load_test.hours')" label-width="20px"/>
|
||||
<el-form-item>
|
||||
<el-input-number controls-position="right"
|
||||
:disabled="isReadOnly"
|
||||
v-model="threadGroup.durationMinutes"
|
||||
:min="0"
|
||||
:max="59"
|
||||
@change="calculateTotalChart()"
|
||||
size="mini"/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('load_test.minutes')" label-width="20px"/>
|
||||
<el-form-item>
|
||||
<el-input-number controls-position="right"
|
||||
:disabled="isReadOnly"
|
||||
v-model="threadGroup.durationSeconds"
|
||||
:min="0"
|
||||
:max="59"
|
||||
@change="calculateTotalChart()"
|
||||
size="mini"/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('load_test.seconds')" label-width="20px"/>
|
||||
<br>
|
||||
<el-form-item :label="$t('load_test.rps_limit_enable')">
|
||||
<el-switch v-model="threadGroup.rpsLimitEnable" @change="calculateTotalChart()"/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('load_test.rps_limit')">
|
||||
<el-input-number controls-position="right"
|
||||
:disabled="isReadOnly || !threadGroup.rpsLimitEnable"
|
||||
v-model="threadGroup.rpsLimit"
|
||||
@change="calculateTotalChart()"
|
||||
:min="1"
|
||||
:max="99999"
|
||||
size="mini"/>
|
||||
</el-form-item>
|
||||
<div v-if="threadGroup.tgType === 'com.blazemeter.jmeter.threads.concurrency.ConcurrencyThreadGroup'">
|
||||
<el-form-item label="Ramp-Up">
|
||||
<el-input-number controls-position="right"
|
||||
|
@ -183,21 +140,13 @@
|
|||
:min="1"
|
||||
:max="9999999"
|
||||
@change="calculateTotalChart()"
|
||||
size="mini"/>
|
||||
size="mini"/>
|
||||
<el-tooltip :content="$t('load_test.by_iteration_tip')"
|
||||
effect="light"
|
||||
trigger="hover">
|
||||
<i class="el-icon-info"></i>
|
||||
</el-tooltip>
|
||||
</el-form-item>
|
||||
<br>
|
||||
<el-form-item :label="$t('load_test.rps_limit_enable')">
|
||||
<el-switch v-model="threadGroup.rpsLimitEnable" @change="calculateTotalChart()"/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('load_test.rps_limit')">
|
||||
<el-input-number controls-position="right"
|
||||
:disabled="isReadOnly || !threadGroup.rpsLimitEnable"
|
||||
v-model="threadGroup.rpsLimit"
|
||||
:min="1"
|
||||
:max="99999"
|
||||
size="mini"/>
|
||||
</el-form-item>
|
||||
<br>
|
||||
<el-form-item label="Ramp-Up">
|
||||
<el-input-number controls-position="right"
|
||||
:disabled="isReadOnly"
|
||||
|
@ -206,6 +155,49 @@
|
|||
size="mini"/>
|
||||
</el-form-item>
|
||||
</div>
|
||||
<el-form-item :label="$t('load_test.duration')">
|
||||
<el-input-number controls-position="right"
|
||||
:disabled="isReadOnly"
|
||||
v-model="threadGroup.durationHours"
|
||||
:min="0"
|
||||
:max="9999"
|
||||
@change="calculateTotalChart()"
|
||||
size="mini"/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('load_test.hours')" label-width="20px"/>
|
||||
<el-form-item>
|
||||
<el-input-number controls-position="right"
|
||||
:disabled="isReadOnly"
|
||||
v-model="threadGroup.durationMinutes"
|
||||
:min="0"
|
||||
:max="59"
|
||||
@change="calculateTotalChart()"
|
||||
size="mini"/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('load_test.minutes')" label-width="20px"/>
|
||||
<el-form-item>
|
||||
<el-input-number controls-position="right"
|
||||
:disabled="isReadOnly"
|
||||
v-model="threadGroup.durationSeconds"
|
||||
:min="0"
|
||||
:max="59"
|
||||
@change="calculateTotalChart()"
|
||||
size="mini"/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('load_test.seconds')" label-width="20px"/>
|
||||
<br>
|
||||
<el-form-item :label="$t('load_test.rps_limit_enable')">
|
||||
<el-switch v-model="threadGroup.rpsLimitEnable" @change="calculateTotalChart()"/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('load_test.rps_limit')">
|
||||
<el-input-number controls-position="right"
|
||||
:disabled="isReadOnly || !threadGroup.rpsLimitEnable"
|
||||
v-model="threadGroup.rpsLimit"
|
||||
@change="calculateTotalChart()"
|
||||
:min="1"
|
||||
:max="99999"
|
||||
size="mini"/>
|
||||
</el-form-item>
|
||||
<!-- 资源池自己配置各个节点的并发 -->
|
||||
<div v-if="resourcePoolType === 'NODE'">
|
||||
<el-form-item :label="$t('load_test.resource_strategy')">
|
||||
|
|
|
@ -1036,6 +1036,7 @@ export default {
|
|||
ramp_up_tips: 'The RampUp is too large, the chart rendering will not be displayed, this does not affect the test execution, please refer to the actual results',
|
||||
iterate_num: 'Iterations',
|
||||
by_iteration: 'By iterations',
|
||||
by_iteration_tip: 'The execution time needs to be configured according to the number of iterations. JMeter will decide whether to end the test according to the number of iterations and the execution time',
|
||||
by_duration: 'By duration',
|
||||
ramp_up_time_times: 'add VUs',
|
||||
advanced_config_error: 'Advanced configuration verification failed',
|
||||
|
|
|
@ -1040,6 +1040,7 @@ export default {
|
|||
ramp_up_tips: 'RampUp 过大,图表渲染卡顿不予展示,这并不影响测试执行,请以实际结果为准',
|
||||
iterate_num: '迭代次数',
|
||||
by_iteration: '按迭代次数',
|
||||
by_iteration_tip: '按迭代次数执行需要配置执行时长,JMeter会按照迭代次数和执行时长来决定是否结束测试',
|
||||
by_duration: '按持续时间',
|
||||
ramp_up_time_times: '次增加并发用户',
|
||||
advanced_config_error: '高级配置校验失败',
|
||||
|
|
|
@ -1039,7 +1039,8 @@ export default {
|
|||
ramp_up_time_seconds: '秒內增加並發用戶',
|
||||
ramp_up_tips: 'RampUp 過大,圖表渲染卡頓不予展示,這並不影響測試執行,請以實際結果為準',
|
||||
iterate_num: '叠代次數',
|
||||
by_iteration: '按叠代次數',
|
||||
by_iteration: '按迭代次數',
|
||||
by_iteration_tip: '按迭代次數執行需要配置執行時長,JMeter會按照迭代次數和執行時長來決定是否結束測試',
|
||||
by_duration: '按持續時間',
|
||||
ramp_up_time_times: '次增加並發用戶',
|
||||
advanced_config_error: '高級配置校驗失敗',
|
||||
|
|
Loading…
Reference in New Issue