我在本地主機上運行了Spring Boot服務器:8181,我可以向成功發出GET請求,並且看到日誌打印出來。JMeter Java API - 負載測試運行但服務器上沒有收到任何請求
現在我做了負載測試的概念驗證。我正在使用JMeter Java API將請求發送到使用JMeter的Java API的Spring Boot服務器。 JMeter運行測試套件,沒有錯誤報告,但在我的服務器上,我沒有傳入的請求。
下面是我使用的負載測試代碼:
public class Main {
public static void main(String... args) {
// Engine
StandardJMeterEngine jm = new StandardJMeterEngine();
JMeterUtils.setJMeterHome("C:\\Users\\daz\\Desktop\\apache-jmeter-3.2");
// jmeter.properties
String jmeterProperties = Main.class.getClassLoader().getResource("jmeter.properties").toString().replace("file:", "");
JMeterUtils.loadJMeterProperties(jmeterProperties);
HashTree hashTree = new HashTree();
// HTTP Sampler
HTTPSampler httpSampler = new HTTPSampler();
httpSampler.setDomain("localhost");
httpSampler.setPort(8181);
httpSampler.setPath("/job/test");
httpSampler.setMethod("GET");
// Loop Controller
LoopController loopController = new LoopController();
loopController.setLoops(1);
loopController.addTestElement(httpSampler);
loopController.setFirst(true);
loopController.initialize();
// Thread Group
SetupThreadGroup threadGroup = new SetupThreadGroup();
threadGroup.setNumThreads(2);
threadGroup.setRampUp(1);
threadGroup.setSamplerController(loopController);
// Test plan
TestPlan testPlan = new TestPlan("MY TEST SUITE");
// Construct Test Plan from previously initialized elements
hashTree.add("testPlan", testPlan);
hashTree.add("loopController", loopController);
hashTree.add("threadGroup", threadGroup);
hashTree.add("httpSampler", httpSampler);
jm.configure(hashTree);
jm.run();
}
}
有人可以幫助我發現了什麼是缺少/錯誤這裏預期該代碼不發出請求?
------------- -------------編輯
使用Summariser
我得到以下輸出:
總結= 0 00:00:00 = ******/s的平均:0最小: 9223372036854775807最大:-9223372036854775808錯誤:0(0,00%)
我相信這意味着我沒有提出任何要求,如我所懷疑的那樣。