前言
目的
1.输出Maven与Ant各自构建结果,自行根据优缺点进行选择;
2.设计接口梯度并发自动化测试,根据固定脚本线程模式自由设置并发数;
3.根据测试脚本定期维护更新,设计自动到仓库拉取测试脚本执行;
4.设计出前端性能自动化数据收集;
所需软件清单
软件 | 下载地址 |
---|---|
JDk | https://www.oracle.com/technetwork/java/javase/downloads/index.html |
Jmeter | https://archive.apache.org/dist/jmeter/binaries/ |
Ant | http://archive.apache.org/dist/ant/binaries/ |
Maven | http://maven.apache.org/ |
Jenkins | https://jenkins.io/download/ |
STS | https://spring.io/tools |
Grafana | https://grafana.com/docs/installation/ |
Influxdb | https://portal.influxdata.com/ |
软件特性
jenkins:定时执行 持续集成
jmeter:压测工具
Ant:批量构建功能
Maven:项目构建管理工具
输出
Jenkins jmeter
Jenkins Ant jmeter
Jenkins Maven jmeter
Jenkins maven svn jmeter
Jmeter Influxdb Grafana
本次试验在本机服务器:172.16.87.1168
操作系统:CenOs 7.4
Jmeter可视化报告
预装软件及软件配置
influxDB、Grafana
下载软件influxDB、Grafana工具,根据软件进行交互配置;
下载/安装/配置influxdb
(influxdb1.4 版本后就没有web界面了)
代码语言:javascript复制wget https://dl.influxdata.com/influxdb/releases/influxdb-1.6.4.x86_64.rpm
sudo yum localinstall influxdb-1.6.4.x86_64.rpm
sudo service influxdb start
vim /etc/influxdb/influxdb.conf
[[graphite]]
# Determines whether the graphite endpoint is enabled.
enabled = true
database = "jmeter"
# retention-policy = ""
bind-address = ":2003"
protocol = "tcp"
consistency-level = "one"
注:默认占用8086/8088两个端口号,可以根据自己的实际场景进行替换,进入;
查询 bind-address,其中端口号对应的用处说明如下:
代码语言:javascript复制# Bind address to use for the RPC service for backup and restore.
bind-address = "127.0.0.1:8088"
….
[http]
# Determines whether HTTP endpoint is enabled.
enabled = true
# The bind address used by the HTTP service.
bind-address = ":8086"
启动influxd
代码语言:javascript复制service influxdb restart
influxdb
下载/安装/配置Grafana
代码语言:javascript复制wget https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-4.2.0-1.x86_64.rpm
sudo yum localinstall grafana-4.2.0-1.x86_64.rpm
service grafana-server start
访问:Grafana首页 ip 3000端口:http://172.16.87.8:3000/login
软件交互衔接串通
jmeter配置一条请求信息,添加Backend Listener设置配置信息:
influxd基本配置:
代码语言:javascript复制[root@jmeter ~]# influx -port 8086
Connected to http://localhost:8086 version 1.6.4
InfluxDB shell version: 1.6.4
>
# 创建数据库
> create database jmeter
# 查看数据库
> show databases
# 链接数据库;
> use jmeter
> select * from jmeter
##查看influxd中jmeter数据库是否有数据;
> show measurements
Grafana基本配置:
监控结果图: