概述:
1.jmter做接口发送和验证的框架
2.ant做代码编译和report生成
3.Jenkins做持续集成/定时执行 当然还有svn
操作:
将“ant-jmeter-1.1.1.jar”这个jar包放到ant的classpath中去。这个jar包位置 jmeter的安装目录下的 extras 目录中。
Ant设置:
<project name="ant-jmeter-test" default="all" basedir="."> <tstamp> <format property="time" pattern="yyyyMMddhhmm" /> </tstamp> <property name="jmeter.home" value="F:jakarta-jmeter-2.3.4jakarta-jmeter-2.3.4" /> <property name="jmeter.result.jtl.dir" value="F: esult" /> <property name="jmeter.result.html.dir" value="F: esult" /> <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="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="F:jmeter" includes="*.jmx" /> </jmeter> </target> <target name="report"> <xslt in="${jmeter.result.jtlName}" out="${jmeter.result.htmlName}" style="${jmeter.home}/extras/jmeter-results-detail-report_21.xsl" /> <copy todir="${jmeter.result.html.dir}"> <fileset dir="${jmeter.home}extras"> <include name="collapse.png" /> <include name="expand.png" /> </fileset> </copy> </target> </project>