Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

The realization of automatically running jmeter script and issuing report by Jenkins

Shulou Source: shulou.com Published: 2022-06-03 02:47:06 09月24日 Update

Background: implementing jmeter executes every 30 minutes, running all interfaces or performance scripts in the system

Or later, the system deployment can trigger the construction execution.

1. To configure the jmeter test environment, please modify the configuration of the jmeter.properties file in the bin directory of Jmeter: jmeter.save.saveservice.output_format=xml

two。 Generate a test script using jmeter

3. Install jenkins (self-owned Baidu)

Two plug-ins are installed in 4.jenkins: Performance Plugin and xsltproc. If you can't find it, advanced installation. Plug-in download: http://updates.jenkins-ci.org/download/plugins/

Jenkins task settings

5. Create a new free-style task

! [] (https://s1.51cto.com/images/blog/201803/08/10c384e96511bd9ec740f9051244f1a6.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)

6. Configure some parameters according to your own situation, such as discard the old build, source code management, and then in "build-add build steps", select to add "Excute Windows batch command" to configure the execution command of jmeter (Note:% WORKSPACE% is the workspace of the current task, generally under .jenkins\ jobs in the C disk user file directory.

(if you test locally and do not do source code management, you can write to death)

7. Add another "Excute Windows batch command", and the configuration command calls xsltproc to convert the jtl report file into a html file:

8. Under "Post-build actions", select "Publish Performance test result report" to generate a jtl report

9. Under "Post-build actions", select to generate a html report

For example, the following figure

10. Save and return to the task interface and select build now, which will automatically execute the script and generate Jtl and html test reports

11. Click on the html test report and you can see the highly readable report:

Note: since the "+" and "-" signs on the right of the html report need to call the expand.png and collapse.png files in the extras subdirectory under the jmeter directory to display completely, you can copy these two files to the same directory as the html report for a good interface.

Tags: Reports files tests configuration tasks directories generation selection scripts two commands plug-ins source code interface systems management running good-looking advanced free Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Linux Shulou Information macOS Shulou Technology Apple