I am creating a java class which will start the Jmeter Engine and run the JMX file and give me Result in .jtl file. But the given .jtl file provides me only the below datas
timeStamp,elapsed,label,responseCode,responseMessage,threadName,dataType,success,failureMessage,bytes,sentBytes,grpThreads,allThreads,IdleTime,Connect 1514980442998,2688,test,200,OK,test 1-1,text,true,,136171,125,1,1,0,1561
But I want Avg ,max ,min , error % also. These are provided by the Summariser class but only in console but i want the same appended into my .jtl file.
Below is my class
public class ResultExtractor {
public static void main(String[] args) {
StandardJMeterEngine jmeter = new StandardJMeterEngine();
System.out.println("::>>>>>>>>>>>>JMETER engine intialized");
JMeterUtils.loadJMeterProperties("./jmeter_project_data/apache-jmeter-3.3/bin/jmeter.properties");
JMeterUtils.setJMeterHome("./jmeter_project_data/apache-jmeter-3.3");
JMeterUtils.initLogging();
JMeterUtils.initLocale();
try {
SaveService.loadProperties();
} catch (IOException e) {
e.printStackTrace();
}
File in=new File("./jmeter_project_data/JMXtestdata/test.jmx");
System.out.println("::>>>>>>>>>>>>JMX file is passed");
HashTree testPlanTree =null;
try {
testPlanTree = SaveService.loadTree(in);
}
catch (IOException e)
{
e.printStackTrace();
}
jmeter.configure(testPlanTree);
System.out.println("::>>>>>>>>>>>>Confgurd test in jmeter");
Summariser summer = null;
String summariserName = JMeterUtils.getPropDefault("summariser.name", "summary");//$NON-NLS-1$
if (summariserName.length() > 0) {
summer = new Summariser(summariserName);
}
String logFile = "./jmeter_project_data/Result/jmeterresult.jtl";
ResultCollector logger = new ResultCollector(summer);
logger.setFilename(logFile);
testPlanTree.add(testPlanTree.getArray()[0], logger);
System.out.println("::>>>>>>>>>>>> Test Started");
jmeter.run();
System.out.println("::>>>>>>>>>>>> Test Finished");
}
}
Please help me to get the data in the jtl file.