jmeter-3-linux下环境搭建jmeter+ant
作者:互联网
前言
继上篇Windows搭建 jmeter + ant +jenkins实现后,那么我们平时一般都是集成在linux服务器上。
所以这次我们来Linux下搭建 jmeter + ant +jenkins,废话不多说,走起!!!
一、环境准备
1、jdk1.8以上:
jdk安装教程详细参考(docker安装jenkins的小伙伴请忽略此步骤):linux下安装jdk:https://www.cnblogs.com/gsxl/p/12128768.html
或者yum安装:yum install java-1.8.0-openjdk.x86_64
2、jmeter:
所有版本:https://archive.apache.org/dist/jmeter/binaries/
本篇直接点击此链接下载:https://archive.apache.org/dist/jmeter/binaries/apache-jmeter-5.3.tgz 下载后上传至linux直接解压,或者wget下载
wget 下载:
wget https://archive.apache.org/dist/jmeter/binaries/apache-jmeter-5.3.tgz
注意Linux后缀为.zip,如:apache-jmeter-5.3.tgz
解压:tar -xvf apache-jmeter-5.3.tgz
[root@iZbp19lugf22zbsubsf1y6Z jmeter-ant]# tar -xvf apache-jmeter-5.3.tgz apache-jmeter-5.3/ apache-jmeter-5.3/LICENSE apache-jmeter-5.3/NOTICE
3、ant:
所有版本:https://downloads.apache.org/ant/binaries/
本篇直接点击此链接下载:https://downloads.apache.org/ant/binaries/apache-ant-1.9.15-bin.tar.gz 下载后直接解压:
注意Windows后缀为.zip,如:apache-ant-1.9.15-bin.tar.gz
设置环境变量:
①将bin、lib目录添加至环境变量中的系统变量path即可,如下图我的解压路径:
编辑,命令:vi /etc/profile
复制以下添加保存退出后,输入:source /etc/profile
# ANT_HOME ANT_HOME=/root/jmeter-ant/apache-ant-1.9.15 export PATH=$PATH:$ANT_HOME/bin export PATH=$PATH:$ANT_HOME/lib
输入命令验证版本:ant -version
二、jmeter、ant各种配置
1、jmeter配置:
①将jmeter目录bin\jmeter.properties的490行-528行改为如下:
注意:是jmeter.properties文件,在490-528行中,凡是有jmeter开头的且有#号都需要去掉,或者直接复制下面替换490-528行;
jmeter.save.saveservice.output_format=xml # The below properties are true when field should be saved; false otherwise # # assertion_results_failure_message only affects CSV output jmeter.save.saveservice.assertion_results_failure_message=true # # legitimate values: none, first, all jmeter.save.saveservice.assertion_results=true # jmeter.save.saveservice.data_type=true jmeter.save.saveservice.label=true jmeter.save.saveservice.response_code=true # response_data is not currently supported for CSV output jmeter.save.saveservice.response_data=true # Save ResponseData for failed samples jmeter.save.saveservice.response_data.on_error=true jmeter.save.saveservice.response_message=true jmeter.save.saveservice.successful=true jmeter.save.saveservice.thread_name=true jmeter.save.saveservice.time=true jmeter.save.saveservice.subresults=true jmeter.save.saveservice.assertions=true jmeter.save.saveservice.latency=true # Only available with HttpClient4 jmeter.save.saveservice.connect_time=true jmeter.save.saveservice.samplerData=true jmeter.save.saveservice.responseHeaders=true jmeter.save.saveservice.requestHeaders=true jmeter.save.saveservice.encoding=true jmeter.save.saveservice.bytes=true # Only available with HttpClient4 jmeter.save.saveservice.sent_bytes=true jmeter.save.saveservice.url=true jmeter.save.saveservice.filename=true jmeter.save.saveservice.hostname=true jmeter.save.saveservice.thread_counts=true jmeter.save.saveservice.sample_count=true jmeter.save.saveservice.idle_time=true
更改完成后,我是ftp上传(或者vi编辑):
2、ant 配置
①将apache-jmeter-5.3\extras目录下的:ant-jmeter-1.1.1.jar 复制到apache-ant-1.9.15\lib\
命令:cp 文件路径 复制到哪文件路径
[root@iZbp19lugf22zbsubsf1y6Z apache-jmeter-5.3]# cp extras/ant-jmeter-1.1.1.jar ../apache-ant-1.9.15/lib/ant-jmeter-1.1.1.jar [root@iZbp19lugf22zbsubsf1y6Z apache-jmeter-5.3]#
②创建以下目录文件(网盘下载的不需要再新建了):
推荐直接网盘下载完整文件夹,链接:https://pan.baidu.com/s/1dKy6GpHFDMBIYK0qQixdiA 提取码:gsxl
③编辑build.xml:(vi编辑或者在自己Windows电脑编辑好再上传)
将你的(1)-(5)都改为自己的路径,保存:
三、运行ant run
1、在目录下运行:ant
[root@iZbp19lugf22zbsubsf1y6Z standard-catalog]# ant Buildfile: /root/jmeter-ant/standard-catalog/build.xml [taskdef] Could not load definitions from resource net/sf/antcontrib/antlib.xml. It could not be found. run: [taskdef] Could not load definitions from resource net/sf/antcontrib/antlib.xml. It could not be found. test: [jmeter] Executing test plan: /root/jmeter-ant/standard-catalog/xxx-business.jmx ==> /root/jmeter-ant/standard-catalog/jtl/InterfaceReport202009181126.jtl [jmeter] Creating summariser <summary> [jmeter] Created the tree successfully using /root/jmeter-ant/standard-catalog/xxx-business.jmx [jmeter] Starting standalone test @ Fri Sep 18 23:26:06 CST 2020 (1600442766325) [jmeter] Waiting for possible Shutdown/StopTestNow/HeapDump/ThreadDump message on port 4445 [jmeter] summary = 9 in 00:00:01 = 7.4/s Avg: 92 Min: 12 Max: 659 Err: 0 (0.00%) [jmeter] Tidying up ... @ Fri Sep 18 23:26:08 CST 2020 (1600442768253) [jmeter] ... end of run [jmeter] Executing test plan: /root/jmeter-ant/standard-catalog/xxx-shopping.jmx ==> /root/jmeter-ant/standard-catalog/jtl/InterfaceReport202009181126.jtl [jmeter] Creating summariser <summary> [jmeter] Created the tree successfully using /root/jmeter-ant/standard-catalog/xxx-shopping.jmx [jmeter] Starting standalone test @ Fri Sep 18 23:26:10 CST 2020 (1600442770591) [jmeter] Waiting for possible Shutdown/StopTestNow/HeapDump/ThreadDump message on port 4445 [jmeter] summary = 6 in 00:00:01 = 4.3/s Avg: 175 Min: 19 Max: 784 Err: 0 (0.00%) [jmeter] Tidying up ... @ Fri Sep 18 23:26:12 CST 2020 (1600442772678) [jmeter] ... end of run [taskdef] Could not load definitions from resource net/sf/antcontrib/antlib.xml. It could not be found. report: [xslt] Processing /root/jmeter-ant/standard-catalog/jtl/InterfaceReport202009181126.jtl to /root/jmeter-ant/standard-catalog/html/InterfaceReport.html [xslt] Loading stylesheet /root/jmeter-ant/standard-catalog/xsl/jmeter.results.shanhe.me.xsl [copy] Copying 2 files to /root/jmeter-ant/standard-catalog/html BUILD SUCCESSFUL Total time: 10 seconds
2、html目录下:查看报告
利用:anywhere生成外网可访问
anywhere安装请参考:https://www.cnblogs.com/gsxl/p/13193939.html 第二大点,标题:二、 node.js +Anywhere + html
[root@iZbp19lugf22zbsubsf1y6Z standard-catalog]# cd html/ [root@iZbp19lugf22zbsubsf1y6Z html]# anywhere -p 8055 Running at http://xxx.16.xx.2xx:8055/ Also running at https://xxx.16.1xx.2xx:8056/
欢迎来大家QQ交流群一起学习:482713805
标签:jmeter,ant,linux,apache,save,true,saveservice 来源: https://www.cnblogs.com/gsxl/p/13660988.html