1.网址:https://www.cnblogs.com/ceshisanren/p/5639886.html
2.bulid.xml文件
<?xml version="1.0" encoding="UTF-8"?>
-<project basedir="." default="run" name="ant-jmeter-test">
-<tstamp>
<format pattern="yyyyMMddhhmm" property="time"/>
</tstamp>
<property name="jmeter.home" value="D: oolsapache-jmeter-3.1"/>
<property name="jmeter.result.jtl.dir" value="D: oolsapache-jmeter-3.1in est eportjtl"/>
<property name="jmeter.result.html.dir" value="D: oolsapache-jmeter-3.1in est eporthtml"/>
<property name="ReportName" value="TestReport"/>
<property name="jmeter.result.jtlName" value="${jmeter.result.jtl.dir}/${ReportName}${time}.jtl"/>
<property name="jmeter.result.htmlName" value="${jmeter.result.html.dir}/${ReportName}${time}.html"/>
-<target name="run">
<antcall target="test"/>
<antcall target="report"/>
</target>
-<target name="test">
<taskdef name="jmeter" classname="org.programmerplanet.ant.taskdefs.jmeter.JMeterTask"/>
-<jmeter resultlog="${jmeter.result.jtlName}" jmeterhome="${jmeter.home}">
<testplans dir="D: oolsapache-jmeter-3.1in est" 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>
-<target name="report">
-<tstamp>
<format pattern="yyyy/MM/dd HH:mm" property="report.datestamp"/>
</tstamp>
<xslt style="${jmeter.home}/extras/jmeter-results-detail-report_21.xsl" out="${jemter.result.htmlName}" in="${jmeter.result.jtlName}" force="true" classpathref="xslt.classpath"/>
-<copy todir="${jmeter.result.html.dir}">
-<fileset dir="${jmeter.home}/extras">
<include name="collapse.png"/>
<include name="expand.png"/>
</fileset>
</copy>
</target>
</project>
3注意:
a:build.xml文件地址存在问题时一直走不通,最后放在jemter文件的D: oolsapache-jmeter-3.1in estsmokeTest地址后就可以了