One of the easiest ways to generate a report out of JMeter test run is to make use of "extra" folder comes with JMeter and build with Ant
Steps to create an Ant report
1. Download Apache Ant and update user variable 'Path" pointing to the Ant installation
2. Go to %jMeter_Installation%/extras folder, and then copy your .jmx (JMeter script) file there
3. Using CMD prompt, run following command : jmeter -n -t test.jmx -l test.jmx.jtl to run the Jmeter script and then create the .jtl results file
4. Then run ant -Dtest=test.jmx to create the Ant report
with –Dtest switch, you point to your Jmeter script file
If it is successful, you will get a html file created with the result (ex: test.jmx.html)
%jMeter_Installation%/extras contains necessary artifacts to run ant and generate the report.
In build.xml, you can change the source and destination file locations if you want
make sure test.jmx.jtl file is there. Run jmeter in command line: jmeter -n –t test.jmx -l test.jmx.jtl to generate the .jtl file
If you get an error "Fatal Error! Content is not allowed in prolog." it could probbly be due to CSV format of your .jtl file, and for successful XSLT transformation it needs to be XML.
To fix this add the following line to user.properties file (lives under /bin folder of your ${jmeter-home}
jmeter.save.saveservice.output_format=xml
To automate the process , create a .bat file and schedule it in Task scheduler.Add following to the batch file.
del test.jmx.jtl (always delete the existing .jtl file before a new test run)
jmeter -n -t sod.jmx -l test.jmx.jtl
ant -Dtest=test.jmx
host the test.jmx.html in web server
No comments:
Post a Comment