构建 Log 如下:

Started by user Forkey
Building in workspace /Users/Shared/Jenkins/Home/workspace/JmeterAutoTest
[jmeterTest] $ /Applications/apache-ant-1.10.1/bin/ant -file build.xml
Buildfile: /Applications/apache-jmeter-3.2/jmeterTest/build.xml

all:

test:
[jmeter] Executing test plan: /Applications/apache-jmeter-3.2/jmeterTest/script/test.jmx ==> /Applications/apache-jmeter-3.2/jmeterTest/resultLog/jtl/TestReport201708061257.jtl
[jmeter] 2017-08-06 12:58:01,796 main ERROR FileManager (jmeter.log) java.io.FileNotFoundException: jmeter.log (Permission denied) java.io.FileNotFoundException: jmeter.log (Permission denied)
[jmeter] at java.io.FileOutputStream.open0(Native Method)
[jmeter] at java.io.FileOutputStream.open(FileOutputStream.java:270)
[jmeter] at java.io.FileOutputStream.(FileOutputStream.java:213)
[jmeter] at org.apache.logging.log4j.core.appender.FileManager$FileManagerFactory.createManager(FileManager.java:290)
[jmeter] at org.apache.logging.log4j.core.appender.FileManager$FileManagerFactory.createManager(FileManager.java:274)
[jmeter] at org.apache.logging.log4j.core.appender.AbstractManager.getManager(AbstractManager.java:112)
[jmeter] at org.apache.logging.log4j.core.appender.OutputStreamManager.getManager(OutputStreamManager.java:114)
[jmeter] at org.apache.logging.log4j.core.appender.FileManager.getFileManager(FileManager.java:112)
[jmeter] at org.apache.logging.log4j.core.appender.FileAppender$Builder.build(FileAppender.java:86)
[jmeter] at org.apache.logging.log4j.core.appender.FileAppender$Builder.build(FileAppender.java:51)
[jmeter] at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.build(PluginBuilder.java:122)
[jmeter] at org.apache.logging.log4j.core.config.AbstractConfiguration.createPluginObject(AbstractConfiguration.java:952)
[jmeter] at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:892)
[jmeter] at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:884)
[jmeter] at org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(AbstractConfiguration.java:508)
[jmeter] at org.apache.logging.log4j.core.config.AbstractConfiguration.initialize(AbstractConfiguration.java:232)
[jmeter] at org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:244)
[jmeter] at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:545)
[jmeter] at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:617)
[jmeter] at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:634)
[jmeter] at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:229)
[jmeter] at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:152)
[jmeter] at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:45)
[jmeter] at org.apache.logging.log4j.LogManager.getContext(LogManager.java:194)
[jmeter] at org.apache.logging.log4j.spi.AbstractLoggerAdapter.getContext(AbstractLoggerAdapter.java:122)
[jmeter] at org.apache.logging.slf4j.Log4jLoggerFactory.getContext(Log4jLoggerFactory.java:43)
[jmeter] at org.apache.logging.log4j.spi.AbstractLoggerAdapter.getLogger(AbstractLoggerAdapter.java:46)
[jmeter] at org.apache.logging.slf4j.Log4jLoggerFactory.getLogger(Log4jLoggerFactory.java:29)
[jmeter] at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:358)
[jmeter] at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:383)
[jmeter] at org.apache.jmeter.JMeter.(JMeter.java:109)
[jmeter] at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
[jmeter] at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
[jmeter] at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
[jmeter] at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
[jmeter] at java.lang.Class.newInstance(Class.java:442)
[jmeter] at org.apache.jmeter.NewDriver.main(NewDriver.java:246)
[jmeter]
[jmeter] 2017-08-06 12:58:01,804 main ERROR Unable to inject fields into builder class for plugin type class org.apache.logging.log4j.core.appender.FileAppender, element File. java.lang.IllegalStateException: ManagerFactory [org.apache.logging.log4j.core.appender.FileManager$FileManagerFactory@184cf7cf] unable to create manager for [jmeter.log] with data [org.apache.logging.log4j.core.appender.FileManager$FactoryData@2fd6b6c7]
[jmeter] at org.apache.logging.log4j.core.appender.AbstractManager.getManager(AbstractManager.java:114)
[jmeter] at org.apache.logging.log4j.core.appender.OutputStreamManager.getManager(OutputStreamManager.java:114)
[jmeter] at org.apache.logging.log4j.core.appender.FileManager.getFileManager(FileManager.java:112)
[jmeter] at org.apache.logging.log4j.core.appender.FileAppender$Builder.build(FileAppender.java:86)
[jmeter] at org.apache.logging.log4j.core.appender.FileAppender$Builder.build(FileAppender.java:51)
[jmeter] at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.build(PluginBuilder.java:122)
[jmeter] at org.apache.logging.log4j.core.config.AbstractConfiguration.createPluginObject(AbstractConfiguration.java:952)
[jmeter] at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:892)
[jmeter] at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:884)
[jmeter] at org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(AbstractConfiguration.java:508)
[jmeter] at org.apache.logging.log4j.core.config.AbstractConfiguration.initialize(AbstractConfiguration.java:232)
[jmeter] at org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:244)
[jmeter] at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:545)
[jmeter] at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:617)
[jmeter] at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:634)
[jmeter] at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:229)
[jmeter] at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:152)
[jmeter] at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:45)
[jmeter] at org.apache.logging.log4j.LogManager.getContext(LogManager.java:194)
[jmeter] at org.apache.logging.log4j.spi.AbstractLoggerAdapter.getContext(AbstractLoggerAdapter.java:122)
[jmeter] at org.apache.logging.slf4j.Log4jLoggerFactory.getContext(Log4jLoggerFactory.java:43)
[jmeter] at org.apache.logging.log4j.spi.AbstractLoggerAdapter.getLogger(AbstractLoggerAdapter.java:46)
[jmeter] at org.apache.logging.slf4j.Log4jLoggerFactory.getLogger(Log4jLoggerFactory.java:29)
[jmeter] at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:358)
[jmeter] at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:383)
[jmeter] at org.apache.jmeter.JMeter.(JMeter.java:109)
[jmeter] at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
[jmeter] at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
[jmeter] at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
[jmeter] at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
[jmeter] at java.lang.Class.newInstance(Class.java:442)
[jmeter] at org.apache.jmeter.NewDriver.main(NewDriver.java:246)
[jmeter]
[jmeter] 2017-08-06 12:58:01,806 main ERROR Unable to invoke factory method in class class org.apache.logging.log4j.core.appender.FileAppender for element File. java.lang.IllegalStateException: No factory method found for class org.apache.logging.log4j.core.appender.FileAppender
[jmeter] at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.findFactoryMethod(PluginBuilder.java:224)
[jmeter] at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.build(PluginBuilder.java:130)
[jmeter] at org.apache.logging.log4j.core.config.AbstractConfiguration.createPluginObject(AbstractConfiguration.java:952)
[jmeter] at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:892)
[jmeter] at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:884)
[jmeter] at org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(AbstractConfiguration.java:508)
[jmeter] at org.apache.logging.log4j.core.config.AbstractConfiguration.initialize(AbstractConfiguration.java:232)
[jmeter] at org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:244)
[jmeter] at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:545)
[jmeter] at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:617)
[jmeter] at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:634)
[jmeter] at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:229)
[jmeter] at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:152)
[jmeter] at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:45)
[jmeter] at org.apache.logging.log4j.LogManager.getContext(LogManager.java:194)
[jmeter] at org.apache.logging.log4j.spi.AbstractLoggerAdapter.getContext(AbstractLoggerAdapter.java:122)
[jmeter] at org.apache.logging.slf4j.Log4jLoggerFactory.getContext(Log4jLoggerFactory.java:43)
[jmeter] at org.apache.logging.log4j.spi.AbstractLoggerAdapter.getLogger(AbstractLoggerAdapter.java:46)
[jmeter] at org.apache.logging.slf4j.Log4jLoggerFactory.getLogger(Log4jLoggerFactory.java:29)
[jmeter] at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:358)
[jmeter] at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:383)
[jmeter] at org.apache.jmeter.JMeter.(JMeter.java:109)
[jmeter] at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
[jmeter] at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
[jmeter] at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
[jmeter] at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
[jmeter] at java.lang.Class.newInstance(Class.java:442)
[jmeter] at org.apache.jmeter.NewDriver.main(NewDriver.java:246)
[jmeter]
[jmeter] 2017-08-06 12:58:01,814 main ERROR Null object returned for File in Appenders.
[jmeter] 2017-08-06 12:58:01,825 main ERROR Unable to locate appender "jmeter-log" for logger config "root"
[jmeter] Creating summariser


[jmeter] Created the tree successfully using /Applications/apache-jmeter-3.2/jmeterTest/script/test.jmx
[jmeter] Starting the test @ Sun Aug 06 12:58:07 CST 2017 (1501995487228)
[jmeter] Waiting for possible Shutdown/StopTestNow/Heapdump message on port 4445
[jmeter] summary = 1 in 00:00:01 = 2.0/s Avg: 351 Min: 351 Max: 351 Err: 0 (0.00%)
[jmeter] Tidying up ... @ Sun Aug 06 12:58:08 CST 2017 (1501995488143)
[jmeter] ... end of run

report:

BUILD FAILED
/Applications/apache-jmeter-3.2/jmeterTest/build.xml:23: The following error occurred while executing this line:
/Applications/apache-jmeter-3.2/jmeterTest/build.xml:35: input file /Applications/apache-jmeter-3.2/jmeterTest/resultLog/jtl/TestReport201708061257.jtl does not exist

Total time: 13 seconds
Build step 'Invoke Ant' marked build as failure
Finished: FAILURE

文件目录如下:

构建的 xml 文件代码如下

<?xml version="1.0" encoding="utf-8"?><project name="jmeterTest" default="all" basedir=".">  <tstamp>

 <format property="time" pattern="yyyyMMddhhmm" />
 </tstamp>
 <!-- 需要改成自己本地的 Jmeter 目录-->

 <property name="jmeter.home" value="\Applications\apache-jmeter-3.2" />
 <!-- jmeter生成jtl格式的结果报告的路径-->

 <property name="jmeter.result.jtl.dir" value="\Applications\apache-jmeter-3.2\jmeterTest\resultLog\jtl" />
 <!-- jmeter生成html格式的结果报告的路径-->

 <property name="jmeter.result.html.dir" value="\Applications\apache-jmeter-3.2\jmeterTest\resultLog\html" />
 <!-- 生成的报告的前缀 -->

 <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" />

 <!-- 接收测试报告的邮箱 -->

 <property name="mail_to" value="794975761@qq.com" />
 <!-- 电脑地址 -->

 <property name="ComputerName" value="Susie" />
 <target name="all">     <antcall target="test" />     <antcall target="report" /> </target> <target name="test">     <taskdef name="jmeter" classname="org.programmerplanet.ant.taskdefs.jmeter.JMeterTask" />     <jmeter jmeterhome="${jmeter.home}" resultlog="${jmeter.result.jtlName}">         <!-- 声明要运行的脚本。"*.jmx"指包含此目录下的所有jmeter脚本 -->         <testplans dir="\Applications\apache-jmeter-3.2\jmeterTest\script" includes="test.jmx" />     </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">
 <xslt 
     classpathref="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>

 <!-- 因为上面生成报告的时候,不会将相关的图片也一起拷贝至目标目录,所以,需要手动拷贝 -->
 <copy todir="${jmeter.result.html.dir}">
     <fileset dir="${jmeter.home}/extras">
         <include name="collapse.png" />
         <include name="expand.png" />
     </fileset>
 </copy>
 </target>
 <!-- 发送邮件 -->

</project>


↙↙↙阅读原文可查看相关链接,并与作者交流