1.安装ANT并且设置Ant环境变量
2.将 jmeter下extras目录中ant-jmeter-1.1.1.jar包拷贝至ant安装目录下的lib目录中,否则会报错ant-jmeter-1.1.1不存在
如图创建测试路径
ebusines.jmx:为JMeter源文件
build.xml:为配置文件
dada.csv:为测试数据文件
report目录为报告界面
3. 修改%JMETER_HOME%\\bin\jmeter.properties
jmeter.save.saveservice.output_format=xml
注意:这里xml不许小写
4.build.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="C:\apache\apache-jmeter-5.1.1\" /> <!-- jmeter生成jtl格式的结果报告的路径--> <property name="jmeter.result.jtl.dir" value="C:\apache\apache-jmeter-5.1.1\demoant\report\" /> <!-- jmeter生成html格式的结果报告的路径--> <property name="jmeter.result.html.dir" value="C:\apache\apache-jmeter-5.1.1\demoant\report\" /> <!--生成的报告的前缀--> <property name="ReportName" value="电子商务系统测试报告" /> <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="xianggu625@126.com" /> <!--电脑地址--> <property name="ComputerName" value="JerryGu" /> <target name="all"> <antcall target="ebusiness" /> <antcall target="report" /> </target> <target name="ebusiness"> <taskdef name="jmeter" classname="org.programmerplanet.ant.taskdefs.jmeter.JMeterTask" /> <jmeter jmeterhome="${jmeter.home}" resultlog="${jmeter.result.jtlName}"> <!--声明要运行的脚本。"*.jmx"指包含此目录下的所有jmeter脚本--> <testplans dir="C:\apache\apache-jmeter-5.1.1\demoant\" includes="*.jmx" /> </jmeter> </target> <!--声明要运行的脚本。"*.jmx"指包含此目录下的所有jmeter脚本--> <testplans dir="C:\apache\apache-jmeter-5.1.1\demoant\" includes="*.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"> <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-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>
5 显示报告
————————————————————
软件安全测试
https://study.163.com/course/courseMain.htm?courseId=1209779852&share=2&shareId=480000002205486
接口自动化测试
https://study.163.com/course/courseMain.htm?courseId=1209794815&share=2&shareId=480000002205486
DevOps 和Jenkins之DevOps
https://study.163.com/course/courseMain.htm?courseId=1209817844&share=2&shareId=480000002205486
DevOps与Jenkins 2.0之Jenkins
https://study.163.com/course/courseMain.htm?courseId=1209819843&share=2&shareId=480000002205486
Selenium自动化测试
https://study.163.com/course/courseMain.htm?courseId=1209835807&share=2&shareId=480000002205486
性能测试第1季:性能测试基础知识
https://study.163.com/course/courseMain.htm?courseId=1209852815&share=2&shareId=480000002205486
性能测试第2季:LoadRunner12使用
https://study.163.com/course/courseMain.htm?courseId=1209980013&share=2&shareId=480000002205486
性能测试第3季:JMeter工具使用
https://study.163.com/course/courseMain.htm?courseId=1209903814&share=2&shareId=480000002205486
性能测试第4季:监控与调优
https://study.163.com/course/courseMain.htm?courseId=1209959801&share=2&shareId=480000002205486
Django入门
https://study.163.com/course/courseMain.htm?courseId=1210020806&share=2&shareId=480000002205486
啄木鸟顾老师漫谈软件测试
https://study.163.com/course/courseMain.htm?courseId=1209958326&share=2&shareId=480000002205486