Jenkins+ant+jmeter build an interface test platform for continuous integration

Source: Internet
Author: User

One, the Jemter interface script to write the following steps:

1. Writing interface Requests

By recording or viewing the interface documentation, writing interface requests, debugging, ensuring that the interface debugging through, for HTTP requests, is the correct domain name, query string, query parameters and other information

  

2, to determine the return/output of the interface, confirm that the interface test results are abnormal

  

After the work is done, the interface test script is ready.

Second, generate Interface test report

Interface test scripts are generated after the JTL (XML) format of the files, these files are not readable, so we want to convert him into a readable HTML format report. The steps for conversion are as follows:

1. Installing Ant Tools

Ant is a powerful, packaged compilation tool. We use his purpose is to convert the XML file into an HTML-formatted file

2. Find the XSL file that JMeter comes with

XML file to be converted into an HTML file, you need to write an XSL file, in fact, JMeter has its own XSL file, if you do not want to define the format, you can directly use the own format, so that can save a lot of things. The locations of these files are located in the Extras folder of JMeter and can be used only if you simply modify some file path configurations.

3. To write Ant's BuildFile file, Ant comes with a Lib library that transforms XML into HTML, so this conversion is fairly straightforward, as shown in the following example:

<target name= "Xslt-report" depends= "_message_xalan" >

<tstamp><format property= "Report.datestamp" pattern= "Yyyy/mm/dd hh:mm"/></tstamp>

<xslt

classpathref= "Xslt.classpath"

Force= "true"

In= "${RESULTPATH}/${TEST}-${TODAY}.JTL"

out= "${resultpath}/${test}-${today}.html"

style= "${jmeter.extras}/jmeter-results-detail-report${style_version}.xsl" >

<param name= "ShowData" expression= "${show-data}"/>

<param name= "Titlereport" expression= "${report.title}"/>

<param name= "Datereport" expression= "${report.datestamp}"/>

</xslt>

</target>

The complete BuildFile file, please own Baidu

4. Run the ant command to generate the HTML file

CMD runs the ant–buildfile XSL file, you can generate the HTML report

  

The resulting test reports are as follows:

  

Third, deploy to the continuous integration platform

Deploying to a continuous integration platform allows for timed execution of scripts, which is the core of interface testing. Here we choose the Jenkins,,jenkins is a powerful continuous integration system, it is very simple to use. Use the following steps:

1. Install Jenkins and configure a project, see http://www.cnblogs.com/dtest/p/4125061.html

Note: Please install Jenkins into a larger system disk. Because Jenkins runs, the resulting file is more space-occupying.

2. Configure the Item parameter

  

The old build saves all the temporary files you have in a build, and if the build is not preserved, tick discard old builds and set the maximum number of two parameters to keep the build angels and keep building. Note: Three settings must be set at the same time, otherwise invalid

3, set the timer run interval, here, set the interval time is 10 minutes to run

  

4, set invoke Ant, by setting invoke ant, you can call ant, perform the packaging process. In this case, the steps to execute the build test report

  

Through the above steps, we have successfully built a simple and continuous integrated interface test platform, of course, you can also add other more powerful features according to your needs

Jenkins+ant+jmeter build an interface test platform for 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.