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);
ただし、スレッドグループとサンプラーを組み合わせてテストスクリプトを作成し、同じプログラムから実行する方法についてはまったくわかりません。何か案は?