How can I save a result set after running the Jmeter Test using a program (JAVA CODE)?

前端 未结 2 1787
暗喜
暗喜 2021-01-21 13:15

I have run the Jmeter Script using Jmeter dependency in eclipse using Java code, fortunately, my script is running fine but now I\'m unable to store the result for the same. Can

2条回答
  •  甜味超标
    2021-01-21 13:42

    You need to add a ResultCollector instance to your Test Plan in order to get the .jtl file written like:

    ResultCollector collector = new ResultCollector();
    collector.setFilename("result.jtl");
    testPlanTree.add(testPlanTree.getArray()[0], collector);
    

    the code needs to be added before the jmeter.configure(testPlanTree); line

    More information:

    • Five Ways To Launch a JMeter Test without Using the JMeter GUI
    • jmeter-from-code

提交回复
热议问题