"Go" jenkins+ant+jmeter Automation performance test Platform

Source: Internet
Author: User
Tags echo message xslt

  JmeterIs Performance Testingof tools, JavaWriting, open source, small and convenient, you can run the graphical interface can also be run under the command line.  There are already people using ant to run, since can use Ant to run, that and Hudson, Jenkins integration is very convenient, and Jenkins also has the corresponding plug-in performance Plugin, can automatically collect JMeter test results, show out. First go to download jmeter, test pass in version 2.8, 2.9 version test failed.  Download Ant-jmeter-1.1.1.jar under the JMeter Home directory Lib folder. Download the required ant package, including the configuration file and some jar packages. The build.xml inside is a configuration file that can be customized. You need to modify the JMeter path, and then direct ant to run it.
<?xml version= "1.0" encoding= "Utf-8"? ><project default= "All" ><!--Define your Jmeter Home & your Report Title & Interval time between Test--><property name= "Report.title" value= "webloadTest report "/><property name=" Jmeter-home "location=" D:\work\apache-jmeter-2.8 "/><property name =" Interval-time-in-seconds "value ="/><!--default path config, you can modify for your own requirement; Generally, you don't need to modify--><property environment= "env"/><property name= "Runremote" value= "false "/><property name=" Resultbase "value=" results "/><property name=" RESULTS.JTL "value=" JTL "/>< Property Name= "results.html" value = "html"/><property name= "Jmxs.dir"  value= "Jmxs"/><tstamp> <format property= "Report.datestamp" pattern= "Yyyy-mm-dd-hh-mm-ss"/></tstamp><property name= "Time" Value= "${report.datestamp}"/><!-- diffrent version of Jmeter have its own ant-jmeter.jar,please input the righ T versioin--><path id= "Ant.jmeter.classpath" ><pathelement location= "${jmeter-home}/lib/ Ant-jmeter-1.1.1.jar "/></path><taskdef name=" JMeter "Classname=" org.programmerplanet.aNt.taskdefs.jmeter.JMeterTask "classpathref=" Ant.jmeter.classpath "/><!--just to support foreach by Ant-- <taskdef resource= "net/sf/antcontrib/antcontrib.properties" ><classpath><pathelement location= ". Libs/ant-contrib-20020829.jar "/></classpath></taskdef><!--use this config to generate HTML report; If not, could not display Min/max time in Html--><path id= "Xslt.classpath" ><fileset dir= "./libs" includes= "Xala N-2.7.1.jar "/><fileset dir="./libs "includes=" Serializer-2.9.1.jar "/></path><!-- First create temporary results folder before running--><target name= "Create-folder" ><delete dir= "${resultbase}/temp"/><mkdir dir= "${ RESULTBASE}/TEMP/${RESULTS.JTL} "/><mkdir dir=" ${resultbase}/temp/${results.html} "/></target>< Target Name= "all-test" depends= "Create-folder" ><foreach  param= "Jmxfile" target= "test" ><fileset Dir= "${jmxs.dir}" ><include name= "*.JMX"/></fileset></foreach></target><target name= "test" ><basename property= "Jmx.filename" file= "${jmxfile}" suffix= ". Jmx"/><echo message= "----------processing ${jmxfile}-----------"/><echo message= "resultlogdir===${resultbase}/temp/${ RESULTS.JTL} "/><jmeter jmeterhome=" ${jmeter-home} "resultlogdir=" ${RESULTBASE}/TEMP/${RESULTS.JTL} " Runremote= "${runremote}" resultlog= "${jmx.filename}.jtl" testplan= "${JMXS.DIR}/${JMX.FILENAME}.JMX" >< Jvmarg value= "-XINCGC"/><jvmarg value= "-xms1024m"/><jvmarg value= "-xm1024m"/></jmeter>< Sleep seconds= "></sleep><!--Generate html report--><xslt   in=" ${resultbase}/temp/${ Results.jtl}/${jmx.filename}.jtl "out=" ${resultbase}/temp/${results.html}/${jmx.filename}.html "  classpathref= "Xslt.classpath" style= "${jmeter-home}/extras/jmeter-results-report_21.xsl" ><param name= " Datereport "expression=" ${report.datestamp} "/><param name=" ShowData "expression=" n "/><param name=" Titlereport "ExpressioN= "${report.title}:[${jmx.filename}" "/></xslt><echo message=" Sleep ${interval-time-in-seconds} Seconds, and then start next Test; Please waiting ... "/><sleep seconds=" ${interval-time-in-seconds} "></sleep></target>< Target Name= "copy-images" depends= "all-test" ><copy file= "${jmeter-home}/extras/expand.png" tofile= "${ Results.html}/expand.png "/><copy file=" ${jmeter-home}/extras/collapse.png "tofile=" ${results.html}/ Collapse.png "/><copydir src=" ${resultbase}/temp "dest=" ${resultbase}/${report.datestamp} "/><delete Dir= "${resultbase}/temp"/></target><target name= "All" depends= "All-test, Copy-images"/></ Project>
The Jmxs folder holds the JMeter script, and Ant executes the script in its order, and the results are placed in the results folder, containing the statistical HTML file and the JMeter request detail JTL file. Finally integrate with Jenkins, build the Jenkins environment, install the performance plugin plugin, create a new job, select the target machine (ant on the machine), fill in SVN or CVS, schedule execution, build commands, and more. In the Add Post-build action, you can add a publish performance test result report to collect the results of jmeter tests, select meter, and then fill in the **/* in the report files. JTL can be.

"Go" jenkins+ant+jmeter Automation performance test Platform

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.