Skip to main content

Development

Generate Performance Testing Report with JMeter-Plugins and Ant

JMeter is a popular open source performance test tool. However, its shortage of comprehensive report functionality, affects performance test result analysis, e.g., performance monitor of server, hits per second, response code over time, and so on. This paper will introduce how to create more analysis reports in both JMeter GUI Mode and Non GUI mode.

Generate JMeter-Plugins Report in JMeter GUI Mode

JMeter-Plugins Standard and Extra can resolve its limitation of reporting and data analysis. If scripts are executed in JMeter GUI Mode, it is convenient to add listeners of plugins.

1.Download JMeterPlugins-Standard-1.2.1.zip and JMeterPlugins-Extras-1.2.1.zip from http://jmeter-plugins.org/downloads/all/.

2.Unzip them and copy *.jar file to %JMETER_HOME%\lib\ext.

3.Restart JMeter.

4.Then right click Test plan – > listener -> jp@gc-xxx. More than twenty listener/reports are available now.

01

02

 

Generate JMeter-Plugins Report with Ant in Non-GUI Mode

Jenkins and Ant is always used in JMeter performance testing to schedule and trigger test. In this way, listener added in GUI JMeter mode can’t be saved. However, all test result can be generated from result log .jtl files. JMeter-Plugins provides a CMDRunner.jar, which can be called by command line to generate reports from JTL files.

1.Make sure JMeter-Plugins has been installed correctly as GUI mode.

2.Update JMeter.properties to save data in JTL file.

First you need change output format to xml because JTL file follows XML format. Thread_counts is advised to be selected because parts of report is based on threads.

jmeter.save.saveservice.output_format=xml (default is csv.)

Second, change the values to true if you want to save special data.

jmeter.save.saveservice.assertion_results_failure_message=true

jmeter.save.saveservice.assertion_results=true

jmeter.save.saveservice.data_type=true

jmeter.save.saveservice.label=true

jmeter.save.saveservice.response_code=true

jmeter.save.saveservice.response_data.on_error=true

jmeter.save.saveservice.response_message=true

jmeter.save.saveservice.successful=true

jmeter.save.saveservice.thread_name=true

jmeter.save.saveservice.time=true

jmeter.save.saveservice.subresults=true

jmeter.save.saveservice.assertions=true

jmeter.save.saveservice.latency=true

jmeter.save.saveservice.samplerData=true

jmeter.save.saveservice.responseHeaders=true

jmeter.save.saveservice.requestHeaders=true

jmeter.save.saveservice.encoding=true

jmeter.save.saveservice.bytes=true

jmeter.save.saveservice.url=true

jmeter.save.saveservice.filename=true

jmeter.save.saveservice.hostname=true

jmeter.save.saveservice.thread_counts=true

jmeter.save.saveservice.sample_count= true

jmeter.save.saveservice.idle_time= true

3.Execute jmx scripts with ant. The core target in build.xml can be as below:

<target name=”test”> 

  <taskdef name=”jmeter”     classname=”org.programmerplanet.ant.taskdefs.jmeter.JMeterTask” /> 

 <! — Execute JMX scripts and create JTL file — >

    <jmeter jmeterhome=”${jmeter.home}” resultlog=”${jmeter.result.jtlName}”>     

     <testplans dir=”${basedir}\test” includes=”*.jmx” /> 

    </jmeter> 

</target>

4.Then a resultlog with JTL format has been created at the same time.

5.Add a target in build.xml to generate report with plugins.

Command line: java -jar $CMDRunnerPath/CMDRunner.jar  –tool Reporter –generate-png TransactionsPerSecond.png –input-jtl  $ jmeter.result.jtlName –plugin-type TransactionsPerSecond

Realize the same function as above in build.xml:

<target name=”runTransactionsPerSecond “> 

   <exec executable=”cmd” failonerror=”true”>

         <arg value=”/c”/> 

         <arg value=”java”/> 

         <arg value=”-jar”/> 

         <arg value=”${jmeter.home}\lib\ext\CMDRunner.jar”/> 

         <arg value=”–tool”/> 

          <arg value=”Reporter”/> 

          <arg value=”–generate-png”/> 

          <arg value=”${generate-png}”/>

          <arg value=”–input-jtl”/> 

          <arg value=”${jmeter.result.jtlName}”/>

          <arg value=”–plugin-type”/> 

          <arg value=”TransactionsPerSecond”/>

  </exec>

</target>

6.Run build.xml with ant. Then you can find .png has been created in target folder.

03

Because Ant can be called in Jenkins, reports can be easily created and checked in Jenkins project workspace.

 

Reference

http://www.jmeter-plugins.org/wiki/Start/

http://jmeter.apache.org/usermanual/index.html

 

 

Thoughts on “Generate Performance Testing Report with JMeter-Plugins and Ant”

  1. I am unable to generate graphs with Ant in Non-GUI Mode(followed mentioned steps).Could you please help

  2. Hello Glinius, would you know where I could get the “JMeter Cloud Plugin” ? It doesn’s seem to be present on the Blazemeter website

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Cathy Zhang

More from this Author

Categories
Follow Us