Jmeter请求增加顺序执行
This commit is contained in:
@@ -7,7 +7,9 @@ import com.jayway.jsonpath.PathNotFoundException;
|
|||||||
import com.test.common.core.domain.model.*;
|
import com.test.common.core.domain.model.*;
|
||||||
import org.apache.jmeter.config.Arguments;
|
import org.apache.jmeter.config.Arguments;
|
||||||
import org.apache.jmeter.config.gui.ArgumentsPanel;
|
import org.apache.jmeter.config.gui.ArgumentsPanel;
|
||||||
|
import org.apache.jmeter.control.GenericController;
|
||||||
import org.apache.jmeter.control.LoopController;
|
import org.apache.jmeter.control.LoopController;
|
||||||
|
import org.apache.jmeter.control.gui.LogicControllerGui;
|
||||||
import org.apache.jmeter.control.gui.LoopControlPanel;
|
import org.apache.jmeter.control.gui.LoopControlPanel;
|
||||||
import org.apache.jmeter.control.gui.TestPlanGui;
|
import org.apache.jmeter.control.gui.TestPlanGui;
|
||||||
import org.apache.jmeter.engine.StandardJMeterEngine;
|
import org.apache.jmeter.engine.StandardJMeterEngine;
|
||||||
@@ -31,7 +33,6 @@ import org.apache.jmeter.threads.gui.ThreadGroupGui;
|
|||||||
import org.apache.jmeter.timers.ConstantThroughputTimer;
|
import org.apache.jmeter.timers.ConstantThroughputTimer;
|
||||||
import org.apache.jmeter.util.JMeterUtils;
|
import org.apache.jmeter.util.JMeterUtils;
|
||||||
import org.apache.jorphan.collections.HashTree;
|
import org.apache.jorphan.collections.HashTree;
|
||||||
import org.apache.jorphan.collections.ListedHashTree;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
@@ -94,10 +95,9 @@ public class JMeterGroupUtil {
|
|||||||
List<ResultCollector> resultCollector = getResultCollector(replayLogPath, summaryReportPath);
|
List<ResultCollector> resultCollector = getResultCollector(replayLogPath, summaryReportPath);
|
||||||
|
|
||||||
// 5. 构建测试树,新增每个用例下的http请求节点
|
// 5. 构建测试树,新增每个用例下的http请求节点
|
||||||
HashTree firstTreeTestPlan = new ListedHashTree();
|
HashTree firstTreeTestPlan = new HashTree();
|
||||||
HashTree secondHashTree = new ListedHashTree();
|
HashTree secondHashTree = new HashTree();
|
||||||
ListedHashTree thirdHashTree = new ListedHashTree();
|
HashTree thirdHashTree = new HashTree();
|
||||||
dealHttpHashTreeWithRequestList(thirdHashTree, jmeterGroupRequest.getJmeterRequestList());
|
|
||||||
|
|
||||||
// 6. 获取设置吞吐量
|
// 6. 获取设置吞吐量
|
||||||
ConstantThroughputTimer constantThroughputTimer = null;
|
ConstantThroughputTimer constantThroughputTimer = null;
|
||||||
@@ -107,6 +107,13 @@ public class JMeterGroupUtil {
|
|||||||
constantThroughputTimer = getConstantThroughputTimer(rpsLimit);
|
constantThroughputTimer = getConstantThroughputTimer(rpsLimit);
|
||||||
thirdHashTree.add(constantThroughputTimer);
|
thirdHashTree.add(constantThroughputTimer);
|
||||||
}
|
}
|
||||||
|
HashTree threadGroupHashTree = secondHashTree.add(threadGroup);
|
||||||
|
GenericController simpleController = new GenericController();
|
||||||
|
simpleController.setName("简单顺序逻辑控制器");
|
||||||
|
simpleController.setProperty(TestElement.TEST_CLASS, GenericController.class.getName());
|
||||||
|
simpleController.setProperty(TestElement.GUI_CLASS, LogicControllerGui.class.getName());
|
||||||
|
HashTree simpleControllerTree = threadGroupHashTree.add(simpleController);
|
||||||
|
dealHttpHashTreeWithRequestList(simpleControllerTree, jmeterGroupRequest.getJmeterRequestList());
|
||||||
secondHashTree.add(threadGroup, thirdHashTree);
|
secondHashTree.add(threadGroup, thirdHashTree);
|
||||||
firstTreeTestPlan.add(testPlan, secondHashTree);
|
firstTreeTestPlan.add(testPlan, secondHashTree);
|
||||||
|
|
||||||
@@ -145,7 +152,7 @@ public class JMeterGroupUtil {
|
|||||||
* @param thirdHashTree
|
* @param thirdHashTree
|
||||||
* @param requestList
|
* @param requestList
|
||||||
*/
|
*/
|
||||||
private static void dealHttpHashTreeWithRequestList(ListedHashTree thirdHashTree, List<JmeterRequest> requestList) {
|
private static void dealHttpHashTreeWithRequestList(HashTree thirdHashTree, List<JmeterRequest> requestList) {
|
||||||
for (JmeterRequest jmeterRequest : requestList) {
|
for (JmeterRequest jmeterRequest : requestList) {
|
||||||
try {
|
try {
|
||||||
HashTree fourHashTree = new HashTree();
|
HashTree fourHashTree = new HashTree();
|
||||||
|
|||||||
Reference in New Issue
Block a user