ant+jenkins+jmeter接口自动化

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:\tools\apache-jmeter-3.1"/>

<property name="jmeter.result.jtl.dir" value="D:\tools\apache-jmeter-3.1\bin\test\report\jtl"/>

<property name="jmeter.result.html.dir" value="D:\tools\apache-jmeter-3.1\bin\test\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}${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:\tools\apache-jmeter-3.1\bin\test\" 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:\tools\apache-jmeter-3.1\bin\test\smokeTest地址后就可以了

 

posted on 2018-08-13 11:50  thy520  阅读(190)  评论(0编辑  收藏  举报