Syord Syord - 3 months ago 31
HTML Question

Generating a faulty report when running JMeter 3.0 test with Ant

I have been at it for days. Basically I want to create a HTML report from JMeter test file, using Ant. I am using Linux Ubuntu 16.04.1. Here is my build.xml :

<project name="performance-tests" default="run-performance-tests" basedir=".">
<property name="testpath" value="${user.dir}"/>
<poperty name="jmeter.home" value="/home/richard/Asjad/apache-jmeter-3.0"/>

<!-- Name of test (without .jmx) -->
<property name="test" value="Test"/>

<path id="jmeter.path">
<fileset dir="${basedir}" includes="/*.jar" />
</path>

<target name="run-performance-tests">
<delete dir="${basedir}/target" quiet="true" failonerror="false"/>
<mkdir dir="${basedir}/target"/>

<!-- Allow jar to be picked up locally -->
<path id="jmeter.classpath">
<fileset dir="${basedir}">
<include name="ant-jmeter*.jar"/>
</fileset>
</path>

<taskdef name="jmeter"
classpathref="jmeter.classpath"
classname="org.programmerplanet.ant.taskdefs.jmeter.JMeterTask" />
<echo message="Running load tests in testing.xml"/>
<jmeter
jmeterhome="${jmeter.home}"
testplan ="${testpath}/${test}.jmx"
resultlog="${basedir}/target/JMeterResults.xml">
<jvmarg value="-Xincgc"/>
<jvmarg value="-Xmx512m"/>
<jvmarg value="-Dproperty=value"/>
<property name="request.threads" value="5"/>
<property name="request.loop" value="50"/>
<property name="jmeter.save.saveservice.assertion_results" value="all"/>
<property name="jmeter.save.saveservice.output_format" value="xml"/>

</jmeter>
<xslt in="${basedir}/target/JMeterResults.xml"
out="${basedir}/target/Test.html"
style="${basedir}/jmeter-results-detail-report.xsl"/>
</target>




This is what I see when I run the script:

Buildfile: /home/richard/Asjad/apache-jmeter-3.0/extras/build.xml

run-performance-tests:
[delete] Deleting directory /home/richard/Asjad/apache-jmeter-3.0/extras/target
[mkdir] Created dir: /home/richard/Asjad/apache-jmeter-3.0/extras/target
[echo] Running load tests in testing.xml
[jmeter] Executing test plan: /home/richard/Asjad/apache-jmeter-3.0/extras/TestPlan/Test.jmx ==> /home/richard/Asjad/apache-jmeter-3.0/extras/target/JMeterResults.xml
[jmeter] Java HotSpot(TM) 64-Bit Server VM warning: Using incremental CMS is deprecated and will likely be removed in a future release
[jmeter] Writing log file to: /home/richard/Asjad/apache-jmeter-3.0/bin/jmeter.log
[jmeter] Creating summariser <summary>
[jmeter] Created the tree successfully using /home/richard/Asjad/apache-jmeter-3.0/extras/TestPlan/Test.jmx
[jmeter] Starting the test @ Fri Jul 29 11:57:25 EEST 2016 (1469782645099)
[jmeter] Waiting for possible Shutdown/StopTestNow/Heapdump message on port 4445
[jmeter] summary = 10 in 00:00:02 = 4.6/s Avg: 214 Min: 105 Max: 344 Err: 0 (0.00%)
[jmeter] Tidying up ... @ Fri Jul 29 11:57:27 EEST 2016 (1469782647345)
[jmeter] ... end of run
[xslt] Processing /home/richard/Asjad/apache-jmeter-3.0/extras/target/JMeterResults.xml to /home/richard/Asjad/apache-jmeter-3.0/extras/target/Result_One.html
[xslt] Loading stylesheet /home/richard/Asjad/apache-jmeter-3.0/extras/jmeter-results-detail-report.xsl

BUILD SUCCESSFUL
Total time: 3 seconds


The build succeeds and then it gives me a HTML file and when I open it I see this:
HTML report

I would be really thankful if someone could at least tell me my mistake or direction I am supposed to go.

Answer

It looks like JMeter developers broke jmeter-results-detail-report.xsl file, bug was reported here:

In order to revert to previous behaviour take the following steps:

  1. Download apache-jmeter-2.13.zip
  2. Extract jmeter-results-detail-report_21.xsl file from apache-jmeter-2.13/extras folder and drop it to "extras" folder of your JMeter 3.0 installation
  3. Modify your build.xml file to use jmeter-results-detail-report_21.xsl file like:

    <xslt in="${basedir}/target/JMeterResults.xml"
        out="${basedir}/target/Test.html"
        style="${basedir}/jmeter-results-detail-report_21.xsl"/>
    

Alternatively you can get XSLT file i.e. from here

See Visualizing JMeter .jtl Files Viewed as An .xsl Stylesheet article for more details on transforming JMeter XML result files to HTML format.