jenkins+jmeter+ant(Linux环境搭建记录)

本文档记录了在Linux系统中如何搭建Jenkins、JMeter和Ant,以实现测试自动化。首先介绍了测试人员需要注意的事项,然后分别详细说明了JMeter的下载、解压、配置环境变量及验证安装成功的过程。接着,同样步骤完成了Ant的安装。此外,还指导了如何配置Ant以调用JMeter执行接口测试并生成报告。最后提到了在Jenkins中的配置,包括安装相关插件和配置build.xml文件。
摘要由CSDN通过智能技术生成

测试人员使用方式:

注意事项:生成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"/>
    
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值