Jmeter+ant+jenkins Automation Continuous Integration

Source: Internet
Author: User
Tags xsl xslt

One, ant installation configuration

1. Official website: http://ant.apache.org/bindownload.cgi

Corresponding operating system select the corresponding version of the download, this article with Windows as a column, download and unzip to the local

2. Setting System Environment variables

ant_home:d:\apache-ant-1.9.7

Path:%ant_home%\bin

Classpath:%ant_home%\lib

After Setup, the corresponding ant version will appear after the DOS command input ant-version ok!

Second, JMeter and Jenkins installation omitted, please refer to the relevant documentation

Third, the integration of the relevant steps:

1. Copy the Ant-jmeter-1.1.1.jar in the JMeter directory Extras directory to the Lib directory of the ant directory

2. Copy an build.xml file in the JMeter directory, configure it, and configure it as follows:

<?XML version= "1.0" encoding= "Utf-8"?><Projectname= "Jmetertest"default= "All"Basedir=".">    <Tstamp>        <format Property= "Time"pattern= "YYYYMMDDHHMM" />    </Tstamp>    <!--need to change to your local Jmeter directory -    < Propertyname= "Jmeter.home"value= "E:\soft\apache-jmeter-3.0" />    <!--JMeter Generating the path of the result report in JTL format -    < Propertyname= "Jmeter.result.jtl.dir"value= "E:\jmetertest\" />    <!--JMeter Generating the path of the result report in HTML format -    < Propertyname= "Jmeter.result.html.dir"value= "E:\jmetertest\" />    <!--The prefix of the generated report -    < Propertyname= "ReportName"value= "Testreport" />    < Propertyname= "Jmeter.result.jtlName"value= "${JMETER.RESULT.JTL.DIR}/${REPORTNAME}${TIME}.JTL" />    < Propertyname= "Jmeter.result.htmlName"value= "${jmeter.result.html.dir}/${reportname}${time}.html" />    <!--the mailbox that receives the test report -    < Propertyname= "Mail_to"value= "[email protected]" />    <!--Computer Address -    < Propertyname= "ComputerName"value= "jkqsh-l0285" />    <Targetname= "All">        <AntcallTarget= "Test" />        <AntcallTarget= "Report" />    </Target>    <Targetname= "Test">        <Taskdefname= "JMeter"ClassName= "Org.programmerplanet.ant.taskdefs.jmeter.JMeterTask" />        <JMeterJmeterhome= "${jmeter.home}"Resultlog= "${jmeter.result.jtlname}">            <!--declares the script to run. "*.jmx" means all JMeter scripts that contain this directory -            <Testplansdir= "E:\jmetertest\"includes= "*.JMX" />            < Propertyname= "Jmeter.save.saveservice.output_format"value= "xml"/>            < Propertyname= "Jmeter.save.saveservice.output_format"value= "xml"/>            < Propertyname= "Jmeter.save.saveservice.assertion_results"value= "All"/>            < Propertyname= "Jmeter.save.saveservice.bytes"value= "true"/>            < Propertyname= "File_format.testlog"value= "${format}"/>            < Propertyname= "Jmeter.save.saveservice.response_data.on_error"value= "${funcmode}"/>        </JMeter>    </Target>    <!--Generate reports -    <Targetname= "Report">        <XSLTinch= "${jmeter.result.jtlname}" out= "${jmeter.result.htmlname}"style= "${jmeter.home}/extras/jmeter-results-detail-report_21.xsl"/>                                <!--because the report is generated above, the related pictures will not be copied to the target directory, so we need to copy them manually . -            <CopyTodir= "${jmeter.result.html.dir}">                <Filesetdir= "${jmeter.home}/extras">                    <includename= "Collapse.png" />                    <includename= "Expand.png" />                </Fileset>            </Copy>            </Target>    <!--Send mail -</Project>

Build.xml file Content Generation reporting part: its role is to convert the generated. JTL data files to. HTML formatted reports

The meaning of the specific attribute:

    • In: The path to the generated. jtl file
    • Out: The path to the generated. html file
    • Style: Convert from. jtl to. html used by the style, these files are also in the Extras directory, this is the most important part, if we want to customize the report can be self-defining this file or from the Internet to find some suitable files.
    • Param: Parameters, these parameters can be used in the style, here is the

Build.xml There is one place to note:

Here this file is jmeter2* file, put this file into the jmeter3.0 directory, if using 3.0 of the files, Jenkins run after generating report error

2. Put JMeter's footsteps in the E:\jmetertest\ directory written in the configuration above

3. Create a job for Jenkins:

The report will be generated in the appropriate directory when it is built immediately after saving:

Open this report appears indicator Nan, this is a pit, you need to copy the Xalan-2.7.2.jar and Serializer-2.7.2.jar from the JMeter lib package into Ant's lib package.

ok! after re-construction

Method solves two:

Add path to the Bulid.xml file: Add the paths to the jar package, and modify the section as follows:

 <PathID= "Xslt.classpath">        <Filesetdir= "${jmeter.home}/lib"includes= "Xalan*.jar"/>        <Filesetdir= "${jmeter.home}/lib"includes= "Serializer*.jar"/>    </Path>    <Targetname= "Report">        <Tstamp> <format Property= "Report.datestamp"pattern= "Yyyy/mm/dd hh:mm" /></Tstamp>        <XSLT classpathref= "Xslt.classpath"  force= "true" inch= "${jmeter.result.jtlname}" out= "${jmeter.result.htmlname}"style= "${jmeter.home}/extras/jmeter-results-detail-report_21.xsl">              <param  name= "Datereport"  expression= "${report.datestamp} "/>        </XSLT>

Jmeter+ant+jenkins Automation Continuous Integration

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.