Jak utworzyć i uruchomić skrypty testowe Apache JMeter z programu Java?

Chcę użyć API dostarczonego przez Apache JMeter do tworzenia i uruchamiania skryptów testowych z programu Java. Zrozumiałem podstawy ThreadGroup i Samplers. Mogę tworzyć je w mojej klasie Java za pomocą interfejsu API JMeter.

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);

Nie mam jednak pojęcia, jak utworzyć skrypt testowy łączący grupę wątków i próbnik, a następnie wykonać go z tego samego programu. Jakieś pomysły?

questionAnswers(4)

yourAnswerToTheQuestion