JENKINS01 Linux+jenkins+ant+jmeter Integrated

Source: Internet
Author: User
Tags xslt

First, jmeter and ant environment construction

JMeter environment Building is relatively simple, upload the JMeter package to Linux, unzip can, but need to configure environment variables, the configuration environment variable code is as follows

Export ant_home=/usr/local/ant/apache-ant-1.10. 1 export jmeter_home=/usr/local/jmeter/apache-jmeter-3.3export CLASSPATH= $CLASSPATH: $ Jmeter_home/lib/ext/apachejmeter_core.jar: $JMETER _home/lib/jorphan.jar: $JMETER _home/lib/logkit-2.0 . Jar:export PATH= $PATH: $HOME/bin: $JMETER _home/bin: $ANT _home/bin
Second, Jenkins Environment construction

Jenkins Environment Construction Please refer to my another article

Http://note.youdao.com/noteshare?id=56897ce973ceac472eab0a8a1bd6f61b&sub=D4389862270D4A729ECF30A0B51128A4

2.1 Jenkins building the necessary plugins for the environment
    • Performance Plugin
    • HTML Publisher Plugin
    • Ant Plugin
Third, jmeter and ant integration
    1. Locate the Ant-jmeter-1.1.1.jar under the Extras directory in the JMeter installation directory, and move it to the Lib directory under the ant installation directory
    2. Locate the Xalan-2.7.2.jar and Serializer-2.7.2.jar files in the Lib directory and move them to the Lib directory under the ant installation directory
    3. Modify the Bin/jmeter/properities file in the JMeter installation directory, modify the Jmeter.save.saveservice.output_format=xml
Iv. Preparation of Build.xml documents

The Build.xml document is written in the following directions

<?xml version= "1.0" encoding= "UTF-8"? ><project name= "Ant-jmeter-test" default= "Run" basedir= "."  > <!--need to change to their local Jmeter directory--<property name= "Jmeter.home" value= "/usr/local/jmeter/apache-jmeter-3.3" /> <property name= "report.title" value= "Environment Build test Project"/> <!--jmeter Generate JTL Format Results report path--<property N Ame= "Jmeter.result.jtl.dir" value= "/usr/local/jmeter/apache-jmeter-3.3/reports"/> <!-- JMeter generate HTML formatted Results report path--<property name= "Jmeter.result.html.dir" value= "/usr/local/jmeter/    Apache-jmeter-3.3/reports "/> <!--generated report prefixes--<property name=" ReportName "value=" Testreport "/> <property name= "Jmeter.result.jtlName" value= "${jmeter.result.jtl.dir}/${reportname}.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.JMe Tertask "/> <jmeter jmeterhome=" ${jmeter.home} "resultlog=" ${jmeter.result.jtlname} "> <!--Sound The script that you want to run "*.jmx" refers to all JMeter scripts that contain this directory--<testplans dir= "/usr/local/jmeter/apache-jmeter-3.3/demos" includes= "        Test_baidu.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&    Gt <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> <!--Because when the report is generated, the associated picture is not Also copied to the target directory, so you need to manually copy--<copy todir= "${jmeter.result.html.dir}" > <fileset dir= "${jmeter.ho            Me}/extras "> <include name=" collapse.png "/> <include name=" Expand.png "/> </fileset> </copy> </target></project>
V. Building a Jenkins Mission

 

You can also get the test report file generated on Linux directly from Jenkins via the setup of Jenkins, and get the rough performance data of the script.

In addition, the test results can be sent to project stakeholders via mail, and the way to send messages using Jenkins is also mentioned in one of my other articles http://note.youdao.com/noteshare?id= 2b1bc352256265b9aa6cebed07208fd6&sub=e26a1360f7bc4a09940b45b5a5358f2b

Reference Documentation:

Http://makaidong.com/qiaoyeye/2579_4716723.html

Https://www.imooc.com/article/22285?block_id=tuijian_wz

JENKINS01 Linux+jenkins+ant+jmeter Integrated

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.