Linux(Centos)我用Jenkins+ant+jmeter
运行出错
结果如下
BUILD FAILED
/data/interface/build.xml:20: The following error occurred while executing this line:
/data/interface/build.xml:48: input file /data/interface/smoke_report/jtl/TestReport202107140129.jtl does not exist Linux(Centos 7)下搭建Jenkins+ant+jmeter
用ant跑build.xml出错
查了网上说权限有问题,我把相关的权限全部改了还是出错,提示48行出错,48行是 style="${jmeter.home}/extras/jmeter.results.shanhe.me.xsl" /> 路径没问题,总不能是下载的jmeter.results.shanhe.me.xsl有问题吧,但是别人可以用,就很奇怪,提示是文件不存在,但是运行报告应该直接写入啊,我没有建smoke_report/jtl/文件夹,但是给了interface777的权限 这是build.xml代码 - <?xml version="1.0" encoding="UTF-8"?>
- <project name="ant-jmeter-test" default="run" basedir=".">
- <tstamp>
- <format property="time" pattern="yyyyMMddhhmm" />
- </tstamp>
- <!-- 需要改成自己本地的 Jmeter 目录-->
- <property name="jmeter.home" value="/data/apache-jmeter-5.4.1" />
- <!-- jmeter生成jtl格式的结果报告的路径-->
- <property name="jmeter.result.jtl.dir" value="/data/interface/smoke_report/jtl" />
- <!-- jmeter生成html格式的结果报告的路径-->
- <property name="jmeter.result.html.dir" value="/data/interface/smoke_report/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}.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 jmeterhome="${jmeter.home}" resultlog="${jmeter.result.jtlName}">
- <!-- 声明要运行的脚本。"*.jmx"指包含此目录下的所有jmeter脚本-->
- <testplans dir="/var/lib/jenkins/workspace/mkInterfaceTest/testcase" 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 property="report.datestamp" pattern="yyyy/MM/dd HH:mm" /></tstamp>
- <xslt
- classpathref="xslt.classpath"
- force="true"
- in="${jmeter.result.jtlName}"
- out="${jmeter.result.htmlName}"
- style="${jmeter.home}/extras/jmeter.results.shanhe.me.xsl" />
- <!-- 因为上面生成报告的时候,不会将相关的图片也一起拷贝至目标目录,所以,需要手动拷贝 -->
- <copy todir="${jmeter.result.html.dir}">
- <fileset dir="${jmeter.home}/extras">
- <include name="collapse.png" />
- <include name="expand.png" />
- </fileset>
- </copy>
- </target>
- </project>
复制代码
|