Second, use Ant to execute JMeter script to generate HTML report

Source: Internet
Author: User
Tags xsl xslt

First, install Ant


1,: http://ant.apache.org/bindownload.cgi, download the required zip package

2. Unzip the zip to the directory you want to install, such as the installation path: D:\ProgramFiles\apache-ant-1.10.1

3. Configure ant's System environment variables:

    • New variable ant_home, fill in Ant's Installation path

    • Edit the variable path, add "%ant_home%\bin; ", just add" "inside the content, notice whether you need to add the English semicolon in the starting position"; "

    • Check that ant is installed successfully, open the DOS interface of Windows, enter "Ant–version", if not error, the configuration is successful.

Second, ant to execute the jmeter script


1. Place the "Ant-jmeter-1.1.1.jar" package under "JMeter installation directory \extras" into the "Ant installation directory \lib"

2. Modify the "jmeter.properties" file under "JMeter installation directory \ Bin":

Jmeter.save.saveservice.output_format=xml

3, write Build.xml, the specific contents are as follows:

<?xml version= "1.0"  encoding= "UTF-8"? ><project name= "Ant-jmeter-test"  default= " Run " basedir=". " >    <!--  need to change to their local  Jmeter  directory-->       <property name= "Jmeter.home"  value= "d:\program files\apache-jmeter-3.3"  />     <!-- jmeter generates a path to the results report in JTL format-->     <property  name= "Jmeter.result.jtl.dir"  value= "D:\program files\apache-jmeter-3.3\jmeterapitest\report"  />    <!-- jmeter generates the path of the result report in HTML format-->    < Property name= "Jmeter.result.html.dir"  value= "d:\program files\apache-jmeter-3.3\jmeterapitest\ Report " />    <!--  prefix for generated reports-->      < Property name= "ReportName"  value= "Testreport"  />    <property  Name= "JMETER.REsult.jtlname " value=" ${JMETER.RESULT.JTL.DIR}/${REPORTNAME}.JTL " />    < Property name= "Jmeter.result.htmlName"  value= "${jmeter.result.html.dir}/${reportname}.html"  / >        <target name= "Run" ><antcall target= " Test " /><antcall target="  />    </target>         <target name= "Test" >         <taskdef name= "JMeter"  classname= "Org.programmerplanet.ant.taskdefs.jmeter.JMeterTask"  />        <jmeter jmeterhome= "${jmeter.home}"   Resultlog= "${jmeter.result.jtlname}" >             <!--  Declares the script to run. "*.jmx" means all JMeter scripts contained in this directory-->            <tesTplans dir= "D:\PROGRAM&NBSP;FILES\APACHE-JMETER-3.3\JMETERAPITEST\JMX"  includes= "*.JMX"  /> <property name= "Jmeter.save.saveservice.output_format"  value= "xml"/>         </jmeter>    </target> <path id= " Xslt.classpath ">        <fileset dir=" ${jmeter.home}/lib "  includes= "Xalan*.jar"/>        <fileset dir= "${ Jmeter.home}/lib " includes=" Serializer*.jar "/>    </path>     <!--style= "${jmeter.home}/extras/jmeter-results-detail-report_21_90line.xsl" >-->     <target name= "Report" ><tstamp> <format property= "Report.datestamp"  pattern= "yyyy/mm/dd hh:mm"  /></tstamp>         <xsltclasspathref= "Xslt.classpatH "force=" true "in=" ${jmeter.result.jtlname} "out=" ${jmeter.result.htmlname} "style=" ${jmeter.home}/extras/ Jmeter-results-detail-report_21.xsl "><param name=" Datereport " expression=" ${report.datestamp} " /></xslt>        <!--  Because when the report is generated, the associated pictures are not copied to the target directory. Therefore, you need to manually copy the  -->         <copy todir= "${ Jmeter.result.html.dir} ">            < Fileset dir= "${jmeter.home}/extras" >                 <include name= "Collapse.png"  />                 <include name= "Expand.png"  / >            </fileset>         </copy&gT;    </target></project> 

4. Open the Windows DOS interface, CD to build.xml file storage path, and then execute: Ant command or Ant-buildfile build.xml

5. After successful execution, you can view the report in the directory where the HTML report is generated by Build.xml, such as:

650) this.width=650; "Src=" http://img.blog.csdn.net/20160923163013441?watermark/2/text/ Ahr0cdovl2jsb2cuy3nkbi5uzxqv/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/dissolve/70/gravity/center "alt=" Center "/>


This article from "11571141" blog, declined reprint!

Second, use Ant to execute JMeter script to generate HTML report

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.