Ant+jmeter Interface Automation test environment construction in Linux environment (2)

Source: Internet
Author: User
Tags xslt

The previous article on the method of building under Windows, today write about the way to build in the Linux environment.

Experiment Preparation: A Linux server.

Install the JDK on the server and configure the environment variables.

Configure ant on the server.

Tool Preparation:

Jdk:http://www.oracle.com/technetwork/java/javase/downloads/index.html

Jmeter http://jmeter.apache.org/

Ant http://ant.apache.org/

Environment Preparation:

so the environment is built Linux on the server.

To set the ant environment variable:

Vim/etc/profile

Enter edit mode, at the end of the input

Export Ant_home= "/home/apache-ant-1.9.7" (ANT Tool Absolute path)

Export path= "/home/apache-ant-1.9.7/bin": $PATH (Bin Absolute path )

After saving and exiting, run the command

Source/etc/profile

Next check to see if the environment is well built

Java Environment Check

Jmeter Environment

ANT Environment

650) this.width=650; "src=" Http://images2015.cnblogs.com/blog/996824/201607/996824-20160722201719701-829586391.png "/>

Above, three environments have been built!

Locate the ant-jmeter-1.1.1.jar file in the Extras subdirectory in the directory where JMeter is located , and copy it to Ant Location Directory Lib Sub-directory.

650) this.width=650; "src=" Http://images2015.cnblogs.com/blog/996824/201607/996824-20160722201736107-436793103.png "/>

Edit build.xml(emphasis)

Create a new XML file with the following contents:

<?xml version= "1.0"  encoding= "UTF-8"? ><project name= "Ant-jmeter-test"  default= " Run " basedir=". " >    <tstamp>        <format  property= "Time"  pattern= "yyyymmddhhmm"  />    </tstamp><!--  Need to change to their local  Jmeter  directory  -->     <property name= "Jmeter.home"  value= "/home/fangwei/apache-jmeter-2.13/"  /><!--  Generate the path address for HTML and JTL, I'll place it directly under the Tomcat publishing directory  -->     <property name= "Jmeter.result.html.dir"  value= "/home/ Fangwei/apache-tomcat-7.0.55/webapps/demo/report/html "/>    <property name=" Jmeter.result.jtl.dir " value="/HOME/FANGWEI/APACHE-TOMCAT-7.0.55/WEBAPPS/DEMO/REPORT/JTL "/> <! --  generated report prefix-->      <property name= "ReportName"  value= " Testreport " />    <property name= "Jmeter.result.jtlName"  value= "${ JMETER.RESULT.JTL.DIR}/${REPORTNAME}${TIME}.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.JMeterTask " />         <jmeter jmeterhome= "${jmeter.home}"  resultlog= "${jmeter.result.jtlname}" > <!--   declares the script to run. "*.jmx" means all JMeter scripts contained in this directory  -->    &nbsP;       <testplans dir= "/home/fangwei/apache-jmeter-2.13/bin/demo"  includes= "*.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>    <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}"/><!--  because when the report is generated, the associated picture is not copied to the target directory, so manual copy is required  -->          <copy todir= "${jmeter.result.html.dir}" >              <fileset dir= "${jmeter.home}/extras" >                 <include name= "Collapse.png"  />                 <include  name= "Expand.png"  />            < /fileset>        </copy>    </target ></project>



Based on the content in the comments, the basic format is fine, and the Build.xml file is placed in


The/home/fangwei/apache-jmeter-2.13/bin/demo directory.

Here is the directory structure:

Ant's Directory:

650) this.width=650; "Src=" https://s2.51cto.com/wyfs02/M00/8F/4C/wKioL1jaUHmzHf7YAACwZ5Xakms494.jpg-wh_500x0-wm_ 3-wmp_4-s_1470818827.jpg "style=" Float:none; "title=" 1.jpg "alt=" Wkiol1jauhmzhf7yaacwz5xakms494.jpg-wh_50 "/>

Directory of JMeter:

650) this.width=650; "Src=" https://s3.51cto.com/wyfs02/M00/8F/4E/wKiom1jaUHrgQb_YAABQiFAG3wI065.jpg-wh_500x0-wm_ 3-wmp_4-s_45517874.jpg "style=" Float:none; "title=" 2.jpg "alt=" Wkiom1jauhrgqb_yaabqifag3wi065.jpg-wh_50 "/>

Into the

/home/fangwei/apache-jmeter-2.13/bin/demo directory, execute command: Ant

Such as:

650) this.width=650; "Src=" https://s4.51cto.com/wyfs02/M00/8F/4C/wKioL1jaUO-A-N5LAAG3qC4IsbE907.jpg-wh_500x0-wm_ 3-wmp_4-s_2071529085.jpg "title=" 3.jpg "alt=" Wkiol1jauo-a-n5laag3qc4isbe907.jpg-wh_50 "/>

We access IP address:

Http://***.***.***.***:8888/demo/report/html/testreport.html


Results such as:

650) this.width=650; "Src=" https://s1.51cto.com/wyfs02/M01/8F/4C/wKioL1jaUVKQOr90AADkYOJj3I8758.jpg-wh_500x0-wm_ 3-wmp_4-s_3607699815.jpg "title=" 4.jpg "alt=" Wkiol1jauvkqor90aadkyojj3i8758.jpg-wh_50 "/>


Tomcat's path also put it!

650) this.width=650; "Src=" https://s5.51cto.com/wyfs02/M01/8F/4E/wKiom1jaUbWi4XtmAAB7AZO_Cg4888.jpg-wh_500x0-wm_ 3-wmp_4-s_1812210696.jpg "title=" 5.jpg "alt=" Wkiom1jaubwi4xtmaab7azo_cg4888.jpg-wh_50 "/>



But there is a problem, the execution time is not obtained!

Next time to solve this problem, hope to have a way to solve the problem of partners plus me, together to solve the exchange. Number: fang286090326

There are problems can be concerned about the public exchange solution!

Sweep, focus on the forefront of the programmer's technology public number.

650) this.width=650; "Src=" https://s3.51cto.com/wyfs02/M01/8F/4E/wKiom1jaUjixQmsrAABTagCDfEU898.jpg-wh_500x0-wm_ 3-wmp_4-s_966632064.jpg "title=" QR code. jpg "alt=" wkiom1jaujixqmsraabtagcdfeu898.jpg-wh_50 "/>



This article is from "Ghost" blog, please make sure to keep this source http://fangwei009.blog.51cto.com/5234706/1911218

Ant+jmeter Interface Automation test environment construction in Linux environment (2)

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.