我想使用Apache JMeter提供的API從Java程序創建和運行測試腳本。我已經了解了ThreadGroup和Samplers的基礎知識。我可以使用JMeter API在我的Java類中創建它們。ThreadGroup threadGroup = new ThreadGroup(); LoopController lc = new LoopController(); lc.setLoops(5); lc.setContinueForever(true); threadGroup.setSamplerController(lc); threadGroup.setNumThreads(5); threadGroup.setRampUp(1);HTTPSampler sampler = new HTTPSampler(); sampler.setDomain("localhost"); sampler.setPort(8080); sampler.setPath("/jpetstore/shop/viewCategory.shtml"); sampler.setMethod("GET"); Arguments arg = new Arguments(); arg.addArgument("categoryId", "FISH"); sampler.setArguments(arg);但是,我不知道如何創建一個組合線程組和采樣器的測試腳本,然后從同一個程序執行它。有任何想法嗎?
添加回答
舉報
0/150
提交
取消