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 fdfbd929ce..99c004e8f2 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
@@ -491,9 +491,9 @@ public class JmeterDocumentParser implements DocumentParser {
setupElement.setAttribute("testclass", "SetupThreadGroup");
setupElement.setAttribute("testname", "setUp Thread Group");
setupElement.setAttribute("enabled", "true");
- setupElement.appendChild(createStringProp(document, "MsThreadGroup.on_sample_error", "stoptestnow"));
+ setupElement.appendChild(createStringProp(document, "ThreadGroup.on_sample_error", "stoptestnow"));
Element elementProp = document.createElement("elementProp");
- elementProp.setAttribute("name", "MsThreadGroup.main_controller");
+ elementProp.setAttribute("name", "ThreadGroup.main_controller");
elementProp.setAttribute("elementType", "LoopController");
elementProp.setAttribute("guiclass", "LoopControlPanel");
elementProp.setAttribute("testclass", "LoopController");
@@ -502,12 +502,12 @@ public class JmeterDocumentParser implements DocumentParser {
elementProp.appendChild(createBoolProp(document, "LoopController.continue_forever", false));
elementProp.appendChild(createIntProp(document, "LoopController.loops", 1));
setupElement.appendChild(elementProp);
- setupElement.appendChild(createStringProp(document, "MsThreadGroup.num_threads", "1"));
- setupElement.appendChild(createStringProp(document, "MsThreadGroup.ramp_time", "1"));
- setupElement.appendChild(createStringProp(document, "MsThreadGroup.duration", ""));
- setupElement.appendChild(createStringProp(document, "MsThreadGroup.delay", ""));
- setupElement.appendChild(createBoolProp(document, "MsThreadGroup.scheduler", false));
- setupElement.appendChild(createBoolProp(document, "MsThreadGroup.same_user_on_next_iteration", true));
+ setupElement.appendChild(createStringProp(document, "ThreadGroup.num_threads", "1"));
+ setupElement.appendChild(createStringProp(document, "ThreadGroup.ramp_time", "1"));
+ setupElement.appendChild(createStringProp(document, "ThreadGroup.duration", ""));
+ setupElement.appendChild(createStringProp(document, "ThreadGroup.delay", ""));
+ setupElement.appendChild(createBoolProp(document, "ThreadGroup.scheduler", false));
+ setupElement.appendChild(createBoolProp(document, "ThreadGroup.same_user_on_next_iteration", true));
hashTree.appendChild(setupElement);
Element setupHashTree = document.createElement(HASH_TREE_ELEMENT);
@@ -568,17 +568,17 @@ public class JmeterDocumentParser implements DocumentParser {
}
/*
- continue
-
+ continue
+
false
1
- 1
- 1
- false
-
-
- true
+ 1
+ 1
+ false
+
+
+ true
*/
Element tearDownElement = document.createElement("PostThreadGroup");
@@ -586,15 +586,15 @@ public class JmeterDocumentParser implements DocumentParser {
tearDownElement.setAttribute("testclass", "PostThreadGroup");
tearDownElement.setAttribute("testname", "tearDown Thread Group");
tearDownElement.setAttribute("enabled", "true");
- tearDownElement.appendChild(createStringProp(document, "MsThreadGroup.on_sample_error", "continue"));
- tearDownElement.appendChild(createStringProp(document, "MsThreadGroup.num_threads", "1"));
- tearDownElement.appendChild(createStringProp(document, "MsThreadGroup.ramp_time", "1"));
- tearDownElement.appendChild(createStringProp(document, "MsThreadGroup.duration", ""));
- tearDownElement.appendChild(createStringProp(document, "MsThreadGroup.delay", ""));
- tearDownElement.appendChild(createBoolProp(document, "MsThreadGroup.scheduler", false));
- tearDownElement.appendChild(createBoolProp(document, "MsThreadGroup.same_user_on_next_iteration", true));
+ tearDownElement.appendChild(createStringProp(document, "ThreadGroup.on_sample_error", "continue"));
+ tearDownElement.appendChild(createStringProp(document, "ThreadGroup.num_threads", "1"));
+ tearDownElement.appendChild(createStringProp(document, "ThreadGroup.ramp_time", "1"));
+ tearDownElement.appendChild(createStringProp(document, "ThreadGroup.duration", ""));
+ tearDownElement.appendChild(createStringProp(document, "ThreadGroup.delay", ""));
+ tearDownElement.appendChild(createBoolProp(document, "ThreadGroup.scheduler", false));
+ tearDownElement.appendChild(createBoolProp(document, "ThreadGroup.same_user_on_next_iteration", true));
Element elementProp = document.createElement("elementProp");
- elementProp.setAttribute("name", "MsThreadGroup.main_controller");
+ elementProp.setAttribute("name", "ThreadGroup.main_controller");
elementProp.setAttribute("elementType", "LoopController");
elementProp.setAttribute("guiclass", "LoopControlPanel");
elementProp.setAttribute("testclass", "LoopController");
@@ -760,8 +760,8 @@ public class JmeterDocumentParser implements DocumentParser {
threadGroup.setAttribute("guiclass", CONCURRENCY_THREAD_GROUP + "Gui");
threadGroup.setAttribute("testclass", CONCURRENCY_THREAD_GROUP);
/*
-
- continue
+
+ continue
2
12
2
@@ -773,11 +773,11 @@ public class JmeterDocumentParser implements DocumentParser {
removeChildren(threadGroup);
// elementProp
Element elementProp = document.createElement("elementProp");
- elementProp.setAttribute("name", "MsThreadGroup.main_controller");
+ elementProp.setAttribute("name", "ThreadGroup.main_controller");
elementProp.setAttribute("elementType", "com.blazemeter.jmeter.control.VirtualUserController");
threadGroup.appendChild(elementProp);
- threadGroup.appendChild(createStringProp(document, "MsThreadGroup.on_sample_error", "continue"));
+ threadGroup.appendChild(createStringProp(document, "ThreadGroup.on_sample_error", "continue"));
threadGroup.appendChild(createStringProp(document, "TargetLevel", "2"));
threadGroup.appendChild(createStringProp(document, "RampUp", "12"));
threadGroup.appendChild(createStringProp(document, "Steps", "2"));
@@ -785,9 +785,7 @@ public class JmeterDocumentParser implements DocumentParser {
threadGroup.appendChild(createStringProp(document, "LogFilename", ""));
// bzm - Concurrency Thread Group "Thread Iterations Limit:" 设置为空
// threadGroup.appendChild(createStringProp(document, "Iterations", "1"));
-// threadGroup.appendChild(createStringProp(document, "Unit", "M"));
- // 单位改成秒
- threadGroup.appendChild(createStringProp(document, "Unit", "S"));
+ threadGroup.appendChild(createStringProp(document, "Unit", "M"));
}
private void processCheckoutTimer(Element element) {
@@ -880,24 +878,6 @@ public class JmeterDocumentParser implements DocumentParser {
}
private void processVariableThroughputTimer(Element variableThroughputTimer) {
- Object durations = context.getProperty("duration");
- Integer duration;
- if (durations instanceof List) {
- Object o = ((List>) durations).get(0);
- duration = (Integer) o;
- ((List>) durations).remove(0);
- } else {
- duration = (Integer) durations;
- }
- Object rpsLimits = context.getProperty("rpsLimit");
- String rpsLimit;
- if (rpsLimits instanceof List) {
- Object o = ((List>) rpsLimits).get(0);
- ((List>) rpsLimits).remove(0);
- rpsLimit = o.toString();
- } else {
- rpsLimit = rpsLimits.toString();
- }
if (variableThroughputTimer.getChildNodes().getLength() > 0) {
final NodeList childNodes = variableThroughputTimer.getChildNodes();
for (int i = 0; i < childNodes.getLength(); i++) {
@@ -923,9 +903,27 @@ public class JmeterDocumentParser implements DocumentParser {
stringPropCount++;
} else {
stringPropCount = 0;
- prop.getFirstChild().setNodeValue(String.valueOf(duration));
+ Object durations = context.getProperty("duration");// 传入的是分钟数, 需要转化成秒数
+ Integer duration;
+ if (durations instanceof List) {
+ Object o = ((List>) durations).get(0);
+ duration = (Integer) o;
+ ((List>) durations).remove(0);
+ } else {
+ duration = (Integer) durations;
+ }
+ prop.getFirstChild().setNodeValue(String.valueOf(duration * 60));
continue;
}
+ Object rpsLimits = context.getProperty("rpsLimit");
+ String rpsLimit;
+ if (rpsLimits instanceof List) {
+ Object o = ((List>) rpsLimits).get(0);
+ ((List>) rpsLimits).remove(0);
+ rpsLimit = o.toString();
+ } else {
+ rpsLimit = rpsLimits.toString();
+ }
prop.getFirstChild().setNodeValue(rpsLimit);
}
}