Jmeter+ant+jenkins realizes continuous integration

jmeter+ant+jenkins continuous integration

1. Download and configure jmeter

First download the jmeter tool and configure the environment variables; reference: https://www.cnblogs.com/YouJeffrey/p/16029894.html

  By default, jmeter saves files in .jtl format. To set bin/jmeter.properties, file content, save jmeter.save.saveservice.output_format=xml  

 2. Download and configure the ant tool

Download the ant tool and configure the environment variables; reference: https://www.cnblogs.com/YouJeffrey/p/16176224.html

Ant tool network disk address:

Link: https://pan.baidu.com/s/1o4hzidZF2hk3T3SdDkMOwQ
Extraction code: bt9j

3. Trigger the configuration of the jmeter script through ant

Copy the ant-JMeter-1.1.1.jar in the extras subdirectory under the directory where JMeter is located to the lib subdirectory under the directory where Ant is located, so that "org.programmerplanet.ant.taskdefs.jmeter.JMeterTask" can be found when Ant is running class, thus successfully triggering the JMeter script.

Under the extras folder in jmeter; as shown below:

 Under the lib file of the ant toolkit

4. The jar package configuration for automatically sending emails; as shown below:

1. Download the commons-email.jar package on the website , and then put it in the \lib directory of ant; https://commons.apache.org/proper/commons-email/download_email.cgi

2. Download the activation-1.1.1.jar package on the website , and put it in the \lib directory of ant; http://www.java2s.com/Code/Jar/a/Downloadactivation111jar.htm

3. Download the javax.mail.jar package from the website , and put it in the \lib directory of ant; https://javaee.github.io/javamail/

 

5. Create the following directory structure

 

1. resultlog
html =>ant converted result.
The result generated by jtl=>imeter
2,
the script executed by script jmeter

3. Configure the build.xml file:

Build.xml file network disk address:

Link: https://pan.baidu.com/s/1-Q6-JUsXFzIXbibntdUZRg
Extraction code: k2vs

The build.xml file should be placed in the pc or app directory; as shown below:

Configure the details of the build.xml file content

Key point: smtp authorization code; such as QQ mailbox

After the configuration is complete, open the DOS window and enter the directory where the build.xml file is located, and enter ant to generate a report and send it to the designated person's mailbox; the result is as shown in the figure below

6. Build through jenkins and automatically run the jmeter script

1. Create a new item task; as shown below

2. Build a trigger and set how often it triggers

Scheduled task:
minute hour day of month month month day of week
0-59 0-23 1-31 1-12 0-7 (0 and 7 represent Sundays)
Example: 0 20 * * *
is executed automatically at 20:00 every night Execute 0 20 * * 1, 3, 5 every week at 20:00 on 1, 3, and 5 every week 0 20 * * execute every 2 days in a week at 20:00 on 1-5 0 20 * * */2






3. Jump to the build step interface, click Add Build Step and select Invoke Ant

 Then click the Advanced button

Copy the path of the build.xml file to the location shown below

 Click Save to return to the main page; click Build Now to start execution

 4. Execution results, check the recipient's mailbox

 

Practical case

Optical theory is useless, you have to learn to follow along, and you have to do it yourself, so that you can apply what you have learned to practice. At this time, you can learn from some actual combat cases.

If it is helpful to you, please like and collect it to give the author an encouragement. It is also convenient for you to quickly find it next time.

If you don’t understand, please consult the small card below. The blogger also hopes to learn and progress with like-minded testers

At the right age, choose the right position, and try to give full play to your own advantages.

My road of automated test development is inseparable from the plan of each stage along the way, because I like planning and summarizing,

Test and develop video tutorials, study notes and receive portals! ! !

Guess you like

Origin blog.csdn.net/Liuyanan990830/article/details/132351775