Thursday, October 05, 2006

Download & Quick Start

  • JChav needs Java 1.5 (or later), which can be downloaded from java.com.

  • Download and install Apache Ant.

  • Download and install JMeter.
  • If you've not used Ant or JMeter before, check out the detailed example we provide.

  • Download and extract the latest release of JChav: from the Google Code site.

  • Read on to configure JChav and run against your own site. However, if you'd like to run the example we supply, which runs a few tests against the Digg.com web site, to can: in the docs/examples directory of JChav, edit the two lines in build.properties to let JChav know where it's installed and where to find Jmeter. Then, from the docs/exampes directory, run ant -f build-example.xml. It'll take a while to run as it samples the Digg.com web site. When it's over open digjchavresults/index.html in your web browser.

  • Modify or create an Ant build file to run your JMeter test and record the results. Also set up the location of JMeter, where you'd like the results to be written, etc. Here's an example, which you can use by modifying the value of various properties:
  •  <target name="init">
      <!-- Produce a build id. If using a continuous build 
              process inherit the build. id from that" -->
      <tstamp>
       <format property="build.id" pattern="dMMhhmmss" locale="en"/>
      </tstamp>
    
      <property description="The location of the install of JMeter" 
       name="jmeter.install.dir" value="DIRECTORY_TO/jakarta-jmeter-2.2" />
    
      <property description="The directory containing the jchav jars" 
       name="jchav.libs.dir" value="DIRECTORY_TO/jchav" />
     
      <property description="The JMeter test plan script we want to run" 
       name="jmeter.testplan" value="YOUR_PLAN.jmx" />
    
      <property description="The location to store the per run files" 
       name="jmeter.result.dir" value="jmeter-results" />
    
      <property description="The resulting file location, make sure this is unique for each build" 
       name="jmeter.result.file" value="${jmeter.result.dir}/result-${build.id}.xml" />
    
      <property description="The location to generate the html and charts to. " 
       name="jchav.result.dir" value="jchav-results" />
     </target>
       
     <target name="run-jmeter" depends="init"
       description="Execute the JMeter test plan, recording the results to a file.">  
    
      <taskdef name="jmeter"
             classpath="${jmeter.install.dir}/extras/ant-jmeter.jar"
             classname="org.programmerplanet.ant.taskdefs.jmeter.JMeterTask"/>
    
      <jmeter   
             jmeterhome="${jmeter.install.dir}"
             testplan="${jmeter.testplan}"
             resultlog="${jmeter.result.file}">
                 <property name="jmeter.save.saveservice.output_format" value="xml"/>
      </jmeter>
     </target>
    
  • Run your ant task to gather statistics: ant run-jmeter. Based on the simple example about you'll end up with an XML file in the output directory of jmeter-results.

  • Modify your Ant build file to run JChav on the JMeter results. Here's an example:
  • <target name="run-jchav" depends="init"
       description="Produce JChav report from the JMeter results">
      
       <taskdef name="jchav" classname="com.googlecode.jchav.ant.JChavTask">
          <classpath>
             <fileset dir="${jchav.libs.dir}/">
                <include name="**/*.jar"/>
             </fileset>
          </classpath>
       </taskdef>
      
      <jchav srcdir="${jmeter.result.dir}" destdir="${jchav.result.dir}"/>
    </target>
    
  • Run the ant task, e.g., ant jchav. This will create an output directory such as chav-results. Open index.html to see your reports.

  • Problems? Issues? Fixes? Suggestions? Post them on the project issue tracker.
Thanks for trying JChav.

2 comments:

Unknown said...

Found jChav during a google search this morning and decided that it might do just what I was looking for. Downloaded the jar, hacked some ant targets based upon your examples, executed the jmeter test run, pimped the results with jChav and hey presto, a massive amount of cool looking graphs which are probably going to take me longer to analyse :-) Excellent work!

Kiran said...

Excellent !!!