(1) Installing Ant
Download http://ant.apache.org/, unzip the ant installation package, copy the apache-ant-1.9.4 to/opt,
Set Environment variables:
Ant_home= "/opt/apache-ant-1.9.4"
Add $ant_home/bin to Path:
When you are finished, enter ant-version in the terminal, if prompted:
Apache Ant (TM) version 1.9.4 compiled on April 29 2014
The installation was successful.
Errors that occurred during the installation process:
There are hints when using ant:
Unable to locate Tools.jar. Expected to find it In/usr/lib/jvm/jre1.7.0_60/lib/tools.jar
Workaround:
Locate the/lib/toos.jar in the JDK's installation directory, and then copy it to the error path/usr/lib/jvm/jre1.7.0_60/lib
(2) using Ant
Open Eclipse, build a Java project to run the ant script, a sample ant run script and an HTML document for the demo tutorial under the Extras folder of the JMeter installation directory. We copy this build.xml directly to Eclipse's new project directory. Open the Ant Control Panel with Windows--Show View--"Other"--"ant". Add the Build.xml through the "Add Buildfiles" button.
To modify the Build.xml, the following three items are jmx file path, jmeter installation path, generate report
style= "${jmeter.home}/extras/jmeter-results-detail-report${style_version}.xsl" > //Style under Xlst, Here is an XSL file to parse the generated JTL file into HTML format
Testplan = "${testpath}/get class interface Test 2.JMX" //The JMX name that is written here for testing
When you want to test multiple JMX files, you can directly import a folder's JMX file for testing:
Then run the script to generate an HTML report:
Jmeter+ant Generation Report (Ubuntu environment)