ant & jemkins 执行jmx (Linux)

2022/7/10 5:21:25

本文主要是介绍ant & jemkins 执行jmx (Linux),对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

1.jenkins 环境安装 JDK,Jmeter,Ant

2.jenkins 下载ant插件

2.1
https://plugins.jenkins.io/ 搜索ant

2.2
将下载好的插件手动安装
2.3
重启jenkins:http://192.168.184.150:8888/reload

3.Global Tool Configuration -> Ant

默认是自动安装,不要勾选:

取消勾选后,自己配置

3.1 如果ant_home 没有配置好,jenkins 会报如下异常:
BUILD FAILED
/var/lib/jenkins/workspace/auto_test/build.xml:21: The following error occurred while executing this line:
/var/lib/jenkins/workspace/auto_test/build.xml:26: taskdef class org.programmerplanet.ant.taskdefs.jmeter.JMeterTask cannot be found
** using the classloader AntClassLoader[]**

Total time: 0 seconds
Build step 'Invoke Ant' marked build as failure
Finished: FAILURE

4.再次构建,发现报错:

BUILD FAILED
/var/lib/jenkins/workspace/auto_test/build.xml:22: The following error occurred while executing this line:
/var/lib/jenkins/workspace/auto_test/build.xml:47: input file /root/test_report/jtl/TestReport202207090911.jtl does not exist

Total time: 0 seconds
Build step 'Invoke Ant' marked build as failure
Finished: FAILURE

原因:保存报告的结果的文件 /root/test_report/jtl/ 的权限不够

5.调整权限后再次构建:

Started by user zhangsan
Running as SYSTEM
Building in workspace /var/lib/jenkins/workspace/auto_test
The recommended git tool is: NONE
using credential 3d010dc0-2220-4ec1-9a5e-f139c077dce3
 > git rev-parse --resolve-git-dir /var/lib/jenkins/workspace/auto_test/.git # timeout=10
Fetching changes from the remote Git repository
 > git config remote.origin.url http://192.168.184.149:82/test_group/autotest.git # timeout=10
Fetching upstream changes from http://192.168.184.149:82/test_group/autotest.git
 > git --version # timeout=10
 > git --version # 'git version 1.8.3.1'
using GIT_ASKPASS to set credentials gitlab-auth-http
 > git fetch --tags --progress http://192.168.184.149:82/test_group/autotest.git +refs/heads/*:refs/remotes/origin/* # timeout=10
 > git rev-parse refs/remotes/origin/master^{commit} # timeout=10
Checking out Revision 2d34e963b1b09f8ef46c3d9a637e766d60c1ee0c (refs/remotes/origin/master)
 > git config core.sparsecheckout # timeout=10
 > git checkout -f 2d34e963b1b09f8ef46c3d9a637e766d60c1ee0c # timeout=10
Commit message: "update path"
 > git rev-list --no-walk bf14c30ee7ddd9cd069e4d0e32ce663687dfc53d # timeout=10
[auto_test] $ /opt/ant/bin/ant -file build.xml run
Buildfile: /var/lib/jenkins/workspace/auto_test/build.xml

run:

test:
   [jmeter] Executing test plan: /var/lib/jenkins/workspace/auto_test/01.jmx ==> /root/test_report/jtl/TestReport202207090914.jtl
   [jmeter] WARNING: An illegal reflective access operation has occurred
   [jmeter] WARNING: Illegal reflective access by com.thoughtworks.xstream.core.util.Fields (file:/opt/jmeter/lib/xstream-1.4.11.jar) to field java.util.TreeMap.comparator
   [jmeter] WARNING: Please consider reporting this to the maintainers of com.thoughtworks.xstream.core.util.Fields
   [jmeter] WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
   [jmeter] WARNING: All illegal access operations will be denied in a future release
   [jmeter] Creating summariser <summary>
   [jmeter] Created the tree successfully using /var/lib/jenkins/workspace/auto_test/01.jmx
   [jmeter] Starting the test @ Sat Jul 09 09:15:01 CST 2022 (1657329301606)
   [jmeter] Waiting for possible Shutdown/StopTestNow/HeapDump/ThreadDump message on port 4445
   [jmeter] Warning: Nashorn engine is planned to be removed from a future JDK release
   [jmeter] summary +      1 in 00:00:01 =    0.9/s Avg:   841 Min:   841 Max:   841 Err:     0 (0.00%) Active: 3 Started: 3 Finished: 0
   [jmeter] summary +      2 in 00:00:00 =   64.5/s Avg:   850 Min:   843 Max:   857 Err:     0 (0.00%) Active: 0 Started: 3 Finished: 3
   [jmeter] summary =      3 in 00:00:01 =    2.6/s Avg:   847 Min:   841 Max:   857 Err:     0 (0.00%)
   [jmeter] Tidying up ...    @ Sat Jul 09 09:15:03 CST 2022 (1657329303317)
   [jmeter] ... end of run
   [jmeter] Executing test plan: /var/lib/jenkins/workspace/auto_test/02.jmx ==> /root/test_report/jtl/TestReport202207090914.jtl
   [jmeter] WARNING: An illegal reflective access operation has occurred
   [jmeter] WARNING: Illegal reflective access by com.thoughtworks.xstream.core.util.Fields (file:/opt/jmeter/lib/xstream-1.4.11.jar) to field java.util.TreeMap.comparator
   [jmeter] WARNING: Please consider reporting this to the maintainers of com.thoughtworks.xstream.core.util.Fields
   [jmeter] WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
   [jmeter] WARNING: All illegal access operations will be denied in a future release
   [jmeter] Creating summariser <summary>
   [jmeter] Created the tree successfully using /var/lib/jenkins/workspace/auto_test/02.jmx
   [jmeter] Starting the test @ Sat Jul 09 09:15:05 CST 2022 (1657329305799)
   [jmeter] Waiting for possible Shutdown/StopTestNow/HeapDump/ThreadDump message on port 4445
   [jmeter] Warning: Nashorn engine is planned to be removed from a future JDK release
   [jmeter] summary =      1 in 00:00:01 =    1.1/s Avg:   674 Min:   674 Max:   674 Err:     0 (0.00%)
   [jmeter] Tidying up ...    @ Sat Jul 09 09:15:07 CST 2022 (1657329307265)
   [jmeter] ... end of run

report:
     [xslt] Processing /root/test_report/jtl/TestReport202207090914.jtl to /root/test_report/html/TestReport202207090914.html
     [xslt] Loading stylesheet /opt/jmeter/extras/jmeter.results.shanhe.me.xsl
     [copy] Copying 2 files to /root/test_report/html

BUILD SUCCESSFUL
Total time: 9 seconds
Finished: SUCCESS


这篇关于ant & jemkins 执行jmx (Linux)的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程