fix(性能测试): 修复统一预热时间单位导致的测试时长计算错误的问题
This commit is contained in:
parent
3fdc385096
commit
ad1f0d062f
backend/src/main/java/io/metersphere/performance/parse/xml/reader/jmx
frontend/src/business/components/performance/test/components
|
@ -847,11 +847,9 @@ public class JmeterDocumentParser implements DocumentParser {
|
|||
duration = o.toString();
|
||||
}
|
||||
Object units = context.getProperty("unit");
|
||||
String unit = "S";
|
||||
if (units instanceof List) {
|
||||
Object o = ((List<?>) units).get(0);
|
||||
((List<?>) units).remove(0);
|
||||
unit = o.toString();
|
||||
}
|
||||
Object deleteds = context.getProperty("deleted");
|
||||
String deleted = "false";
|
||||
|
@ -868,17 +866,6 @@ public class JmeterDocumentParser implements DocumentParser {
|
|||
enabled = o.toString();
|
||||
}
|
||||
|
||||
switch (unit) {
|
||||
case "M":
|
||||
duration = String.valueOf(Long.parseLong(duration) * 60);
|
||||
break;
|
||||
case "H":
|
||||
duration = String.valueOf(Long.parseLong(duration) * 60 * 60);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
threadGroup.setAttribute("enabled", enabled);
|
||||
if (BooleanUtils.toBoolean(deleted)) {
|
||||
threadGroup.setAttribute("enabled", "false");
|
||||
|
@ -962,11 +949,9 @@ public class JmeterDocumentParser implements DocumentParser {
|
|||
hold = o.toString();
|
||||
}
|
||||
Object units = context.getProperty("unit");
|
||||
String unit = "S";
|
||||
if (units instanceof List) {
|
||||
Object o = ((List<?>) units).get(0);
|
||||
((List<?>) units).remove(0);
|
||||
unit = o.toString();
|
||||
}
|
||||
Object deleteds = context.getProperty("deleted");
|
||||
String deleted = "false";
|
||||
|
@ -983,17 +968,6 @@ public class JmeterDocumentParser implements DocumentParser {
|
|||
enabled = o.toString();
|
||||
}
|
||||
|
||||
switch (unit) {
|
||||
case "M":
|
||||
hold = String.valueOf(Long.parseLong(hold) * 60);
|
||||
break;
|
||||
case "H":
|
||||
hold = String.valueOf(Long.parseLong(hold) * 60 * 60);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
threadGroup.setAttribute("enabled", enabled);
|
||||
if (BooleanUtils.toBoolean(deleted)) {
|
||||
threadGroup.setAttribute("enabled", "false");
|
||||
|
|
|
@ -113,7 +113,7 @@
|
|||
:disabled="isReadOnly"
|
||||
:min="1"
|
||||
v-if="rampUpTimeVisible"
|
||||
:max="getMaxRampUp(threadGroup)"
|
||||
:max="getDuration(threadGroup)"
|
||||
v-model="threadGroup.rampUpTime"
|
||||
@change="calculateTotalChart()"
|
||||
size="mini"/>
|
||||
|
@ -136,7 +136,7 @@
|
|||
:disabled="isReadOnly"
|
||||
v-if="rampUpTimeVisible"
|
||||
:min="1"
|
||||
:max="getMaxRampUp(threadGroup)"
|
||||
:max="getDuration(threadGroup)"
|
||||
v-model="threadGroup.rampUpTime"
|
||||
@change="calculateTotalChart()"
|
||||
size="mini"/>
|
||||
|
@ -654,7 +654,19 @@ export default {
|
|||
|
||||
return true;
|
||||
},
|
||||
getMaxRampUp(tg) {
|
||||
getHold(tg) {
|
||||
if (tg.unit === 'S') {
|
||||
return tg.duration - tg.rampUpTime;
|
||||
}
|
||||
if (tg.unit === 'M') {
|
||||
return tg.duration * 60 - tg.rampUpTime;
|
||||
}
|
||||
if (tg.unit === 'H') {
|
||||
return tg.duration * 60 * 60 - tg.rampUpTime;
|
||||
}
|
||||
return tg.duration - tg.rampUpTime;
|
||||
},
|
||||
getDuration(tg) {
|
||||
if (tg.unit === 'S') {
|
||||
return tg.duration;
|
||||
}
|
||||
|
@ -695,11 +707,11 @@ export default {
|
|||
{key: TARGET_LEVEL, value: this.threadGroups[i].threadNumber},
|
||||
{key: RAMP_UP, value: this.threadGroups[i].rampUpTime},
|
||||
{key: STEPS, value: this.threadGroups[i].step},
|
||||
{key: DURATION, value: this.threadGroups[i].duration, unit: this.threadGroups[i].unit},
|
||||
{key: DURATION, value: this.getDuration(this.threadGroups[i])},
|
||||
{key: UNIT, value: this.threadGroups[i].unit},
|
||||
{key: RPS_LIMIT, value: this.threadGroups[i].rpsLimit},
|
||||
{key: RPS_LIMIT_ENABLE, value: this.threadGroups[i].rpsLimitEnable},
|
||||
{key: HOLD, value: this.threadGroups[i].duration - this.threadGroups[i].rampUpTime},
|
||||
{key: HOLD, value: this.getHold(this.threadGroups[i])},
|
||||
{key: THREAD_TYPE, value: this.threadGroups[i].threadType},
|
||||
{key: ITERATE_NUM, value: this.threadGroups[i].iterateNum},
|
||||
{key: ITERATE_RAMP_UP, value: this.threadGroups[i].iterateRampUp},
|
||||
|
|
Loading…
Reference in New Issue