Performance automation is based on Windows (Jenkins + ant + jmeter)

table of Contents

ant calls jmeter script (via ant command)

ant calls jmeter script (via jenkins)


ant calls jmeter script (via ant command)

1. The premise is successful installation of jmeter and ant

ant installation package: https://pan.baidu.com/s/10lmsPafNvzJlabX5DRv_7g extraction code: vg08 

1.1 The installation of ant under Windows:

  • First unzip the installation package

  • Set environment variables

 

New in path:% ANT_HOME% \ bin and D: \ ant \ apache-ant-1.10.5 \ bin (according to the installation path) 

In the classpath: D: \ ant \ apache-ant-1.10.5 \ lib (according to the installation path)

 Win + r enters ant / ant -version in the window to check whether the installation is successful. The following is the installation success;

 2.ant ​​starts calling jemter

  • 2.1 First create a thread in jemter and save it;

  • 2.2 Copy the ant-JMeter-1.1.1.jar in the extras subdirectory of the Jmeter directory to the ant lib directory, so that ant can find the "org.programmerplanet.ant.taskdefs.jmeter.JMeterTask" class when it runs, Thereby successfully triggering JMeter script;

  • 2.3 Put jmeter.results.shanhe.me.xsl into the extras directory of jmeter Link: https://pan.baidu.com/s/1SmZ8DcQn2-30yl2A3mCC0Q Extraction code: 6ytd

  • 2.4 Modify jmeter.properties under the bin file in the jmeter directory, remove the comment before jmeter.save.saveservice.output_format and set the value to xml

  • 2.5 Then create the folder locally as follows:

  • uncleyong ##### The name of the created file can be changed in uncleyong

      --jmeter_script ##### Store the saved .jmx file

      --result ##### The folder for storing the results includes html and jtl

        --html

        --jtl

      The core file of build.xml #### ant, which is used to get the running information from the command execution; very important. . . .

Link: https://pan.baidu.com/s/1--WEUiAjlpYrsAeXaIUdzg extraction code: th4g 

ps: detailed description of the build file

  •  2.6 In the build.xml directory, enter cmd and execute the ant command in the pop-up dom window

  •  2.7 The execution is successful, you can view the execution result in the locally created folder result

You can view the results in jemter, just import the results of jtl

3. How to display the generated html information more comprehensively?

  • 3.1 First modify jmeter.properties under the jmeter directory (D: \ apache-jmeter-5.1.1 \ bin) 

On the basis of the previous modification, modify several items in the above figure and save it after the modification.

  • 3.2 Then modify the files under C: \ software \ apache-jmeter \ apache-jmeter-4.0 \ extras

Replace the file with this link: https://pan.baidu.com/s/1heBK6lgDH-TuxXnKyBlCxA Extraction code: 96df. (The name is still called this name, but the contents have changed)

  • 3.3 Modify the information of the locally created build.xml file

The local path is D: \ uncleyong. You can directly replace this file with the link: https://pan.baidu.com/s/17HAltCcIqD9yVYVoWQIYcA extraction code: k0mh or change the script

Change the style to the xsl file just replaced.

The information in this report is more complete.

ant calls jmeter script (via jenkins)

1: ant calls jemter script and builds the result locally through Jenkins build

  • 1.1 First, configure the ant and jdk in the Jenkins system management. This is the environment required for execution;

System Management》 Global Tool Configuration

  • 1.2 After the environment is configured, create a new task and set the environment in this task

  • 1.3 Next enter the configuration page of this task

Click Configure in the right menu of Task

 After the above configuration is completed, click Save and Apply. Go back to the project and click "Create Now" to start the task. You can view the results of the operation in the console. You can also view the execution results in a locally created directory.

 2: After the result is generated, it is forwarded to the mailbox through the mail function on Jenkins

  • 2.2 After the plug-in is set, return to the task configuration page

  • 2.3 After saving and applying, click "Build Now" to find the report in the left menu

  • 2.4 Then we are ready to set up to send the report to qq mailbox;

Open this service in the mailbox settings "account, and this authorization code must be remembered! ! ! ! ! ! It will be used in subsequent settings;

 

  • 2.4.1 First, configure the mailbox in System Management> System Settings

first step

 

  • 2.4.2 After the system configuration is completed, go back to the task to configure:

 

 

After saving and applying, click "Build Now" to view the information in the console. Mail will also be received. . .

So far

One jmx multiple requests and multiple jmx can generate reports

 

 

 

Various scripts to display reports: optimize native html with bootstart, including json indentation, top statistics, use case search, project name, project version, project test leader display, giving a concise and generous user experience

https://download.csdn.net/download/u014414161/12313602

 

 

 

 

Published 22 original articles · praised 5 · visits 1040

Guess you like

Origin blog.csdn.net/weixin_37018468/article/details/105248321