测试人员使用方式:
注意事项:生成jmx文件时,需要选择如下图,要不然执行会报错
jmeter生成xxx.jmx文件,上传至服务端 /home/kits/jmeter-5.5/work/script/路径下
登录jenkins,直接构建即可
安装前期准备工具
1、Jenkins
2、Jmeter
3、Ant
4、jdk
安装jmeter
官网下载地址: https://jmeter.apache.org/download_jmeter.cgi
下载后解压到指定位置
配置环境变量,例如
JMETER_HOME=/home/kits/jmeter-5.5
export JMETER_HOME
输入 jmeter -v 显示如下表示安装成功
安装Ant
官网下载地址:http://ant.apache.org/bindownload.cgi
下载后解压到指定位置
配置环境变量,例如
ANT_HOME=/home/kits/ant-1.10.12
export ANT_HOME
输入 ant -v 显示如下表示安装成功
Ant配置Jmeter:用ant构建命令来调动执行jmeter接口测试,并生成测试报告
将jmeter extras目录下的ant-jmeter-1.1.1.jar文件拷贝到ant安装目录下的lib文件夹中
配置jmeter.propertise文件
将jmeter lib目录下的serializer-2.7.2.jar xalan-2.7.2.jar文件拷贝到ant安装目录下的lib文件夹中
创建工作目录,work/{report/{jtl,html},script}
给jtl,html文件夹赋予权限 chmod a+x jtl html
编写ant的编译文件 build.xml
<?xml version="1.0" encoding="utf-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<project name="ant-jmeter" default="run" basedir=".">
<!-- 需要改成自己本地的 Jmeter 目录-->
<property name="jmeter.home" value="/home/kits/jmeter-5.5"/>