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