Use Jmeter + Maven + Jenkins to implement interface automation test

1. Environment construction

Installation jdk, eclipse, git
JDK download address: http://rj.baidu.com/soft/detail/14459.html?ald
JDK installation reference document: http://blog.csdn.net/ls1792304830/article/details/ 52718177
Eclipse online installation package download address: http://www.eclipse.org/downloads/packages/eclipse-ide-java-ee-developers/oxygen2
eclipse needs to install java EE version
Git installation package download address: https: // git -scm.com/downloads
Git installation reference document: https://www.cnblogs.com/wj-1314/p/7993819.html


1. Configure the jdk environment variable, enter java -version on the command line, the following is displayed, indicating successful configuration
2. After installing git, you need to configure the environment variable, enter git on the command line, the following page is displayed, indicating successful installation
3. eclipse selects java EE for Install, continue to the next step, online installation is complete

Second, install maven and configure
1. Maven download path: https://maven.apache.org/download.cgi
apache-maven-3.5.3 has been placed in the corresponding path, the parameters have been modified, you need to configure maven environment variables, The cmd input mvn -v appears the following interface, which means that the configuration is successful

2. References http://blog.csdn.net/qq_40673345/article/details/79015456
3. Need to modify the \ apache-maven-3.5.3 \ conf \ xml, add C: \ Repository on line 55, this path is the path to save the dependent package, you can set it according to your needs
4. The directory for downloading the previous configuration dependent package is C: \ Repository, you can configure it according to your needs, the dependent package is currently configured The address of Alibaba Cloud is Alibaba Cloud, no need to modify, if you modify it yourself, add this step on line 158

<mirror>
<id>nexus-aliyun</id>
<mirrorOf>central</mirrorOf>
<name>Nexus aliyun</name>
<url>http://maven.aliyun.com/nexus/content/groups/public</url>
</mirror>


Three, install jenkins

Jenkins download path: https://jenkins.io/
Reference materials: http://blog.csdn.net/kingboyworld/article/details/77922730
Install jenkins, install the following plugins on jenkins: Maven Integration plugin
Maven, used for jenkins You can create maven job Git plugin for downloading performance test code from github;
Performance plugin for displaying performance reports; HTML Publisher plugin for displaying reports of related interface test results


1. After jenkins installation is complete, first go to System Management >> Global Tool Configuration for global configuration

2. Configure git installation path

3. Configure jdk
4. Configure maven

5. Click Save to save the configuration, the default jenkins is the system service self-starting mode , It is recommended to use bat to start, otherwise the calling process will report an error, enter services.msc on the command line, enter the service management page, change the jenkins to manual mode

6. Start jenkins with bat, manually create a .bat suffix file, enter Java -jar "C: \ Program Files (x86) \ Jenkins \ jenkins.war" The specific path is modified according to the path you installed
7. Double-click the file to start.
4. Use jmeter to generate the test script
1. Jmeter download path: http : //jmeter.apache.org/download_jmeter.cgi
2. Start jmeter (double-click bin \ jmeter.bat in the unzipped directory of jmeter), create an interface request, and then save it as jmeter.jmx

5. Create a maven project using eclipse
1. First Remember to configure the maven download address and global settings, eclipse >> window >> preferences, and then create the maven project
2. Reference: http://blog.csdn.net/u0 11939453 / article / details / 53301299

  • Create a maven project, File >> New >> Maven Project, select Create a simple project, click next

    • Enter Group Id, Artifact Id, click Finish, the addition is complete
    • After the addition is completed, the pom.xml file needs to be configured. After the configuration is completed, the jmx file can be called to perform the interface test and generate the test report. The full picture of the pom file is as follows:
  1. Create a project using jenkins
  • Build maven project
    • Project source configuration

    • Build configuration
    • Report configuration
    • All configuration is completed, click the save button
    • Enter the management page, click to check now, and start the test
    • Click the Summary HTML Report to view the test report
  • The system displays the corresponding test report, click on the test report you need to view

  • Click Detailed HTML Report to view the detailed interface request report, which will record the assertion, request and response results of each interface


If the article is helpful to you, welcome to pay attention to my public account. The public account is synchronized with the articles on this platform for easy reference. I will continue to launch articles related to testing and share testing techniques with you. Each original article is written with care. , Put an end to plagiarism


QQ Technology Exchange Group: To add a group, please enter verification information
              Insert picture description here


WeChat QR code pay attention to the public number:

Insert picture description here


After paying attention, reply to the resource download, you can get the download address of various resources shared by me

[External chain image transfer failed, the source site may have an anti-theft chain mechanism, it is recommended to save the image and upload it directly (img-dkyHNY2D-1569554485737) (https://s1.51cto.com/images/blog/201908/06/2e62f8806e1dc1c391c4332ac7fd70b1 .png? x-oss-process = image / watermark, size_16, text_QDUxQ1RP5Y2a5a6i, color_FFFFFF, t_100, g_se, x_10, y_10, shadow_90, type_ZmFuZ3poZW5naGVpdGk =)]

Guess you like

Origin www.cnblogs.com/Jmeter-Automation/p/12730476.html
Recommended