diff --git a/backend/src/main/java/io/metersphere/performance/parse/xml/reader/jmx/JmeterDocumentParser.java b/backend/src/main/java/io/metersphere/performance/parse/xml/reader/jmx/JmeterDocumentParser.java index 790be02d19..3b9e263ae2 100644 --- a/backend/src/main/java/io/metersphere/performance/parse/xml/reader/jmx/JmeterDocumentParser.java +++ b/backend/src/main/java/io/metersphere/performance/parse/xml/reader/jmx/JmeterDocumentParser.java @@ -824,12 +824,22 @@ public class JmeterDocumentParser implements DocumentParser { enabled = 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(); + } + switch (unit) { case "M": + duration = String.valueOf(Long.parseLong(duration) * 60); hold = String.valueOf(Long.parseLong(hold) * 60); rampUp = String.valueOf(Long.parseLong(rampUp) * 60); break; case "H": + duration = String.valueOf(Long.parseLong(duration) * 60 * 60); hold = String.valueOf(Long.parseLong(hold) * 60 * 60); rampUp = String.valueOf(Long.parseLong(rampUp) * 60 * 60); break; @@ -837,7 +847,7 @@ public class JmeterDocumentParser implements DocumentParser { break; } // 处理预计结束时间 - processExpectedEndTime(hold); + processExpectedEndTime(duration); threadGroup.setAttribute("enabled", enabled); if (BooleanUtils.toBoolean(deleted)) {