为了账号安全,请及时绑定邮箱和手机立即绑定

如何从Java程序创建和运行Apache JMeter测试脚本?

如何从Java程序创建和运行Apache JMeter测试脚本?

www说 2019-09-02 09:23:13
我想使用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);但是,我不知道如何创建一个组合线程组和采样器的测试脚本,然后从同一个程序执行它。有任何想法吗?
查看完整描述

3 回答

  • 3 回答
  • 0 关注
  • 1349 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信