RSS Feed for This PostCurrent Article

Java: Automate Your Load Test using JMeter

In all critical applications when response, throughput and transaction processing time are important factors to determine the success of the system, load test is definitely a must.

In my projects normally I used JMeter to carry out load testing by running JMeter across multiple machines. The problem is that the server can only be load tested at odds hour.

Fortunately, it is possible to automate the load testing with JMeter using Ant, by using the JMeter Ant task available from ProgrammerPlanet.

You can either specify a single test plan using the testplan parameter, or multiple test plans using the testplans nested element. The testplans element is a standard Ant FileSet element.

   1: <jmeter
   2:     jmeterhome="c:\jakarta-jmeter-1.8.1"
   3:     testplan="${basedir}/loadtests/JMeterLoadTest.jmx"
   4:     resultlog="${basedir}/loadtests/JMeterResults.jtl"/>
   1: <jmeter
   2:     jmeterhome="c:\jakarta-jmeter-1.8.1"
   3:     resultlog="${basedir}/loadtests/JMeterResults.jtl">
   4:     <testplans dir="${basedir}/loadtests" includes="*.jmx"/>
   5: </jmeter>

The results look like the following screenshot. You can render the output using a custom XSL, depending on your need


You can also pass in optional parameters to your JMeter tests.

Using it together with a CI server, e.g. Hudson, you can schedule your load test to be run every day midnight.

Trackback URL

Sorry, comments for this entry are closed at this time.