当前位置:网站首页>What is Jmeter? What are the principle steps used by Jmeter?

What is Jmeter? What are the principle steps used by Jmeter?

2022-08-10 22:05:00 Rejoice in the testing world

1.1 什么是 JMeter

Apache JMeter 是 Apache 组织开发的基于 Java 的压力测试工具.用于对软件做压力测试,它最初被设计用于 Web 应用测试,但后来扩展到其他测试领域. 它可以用于测试静态和动态资源,例如静态文件、Java 小服务程序、CGI 脚本、Java 对象、数据库、FTP 服务器, 等等.JMeter 可以用于对服务器、网络或对象模拟巨大的负载,来自不同压力类别下测试它们的强度和分析整体性能.另外,JMeter 能够对应用程序做功能/回归测试,通过创建带有断言的脚本来验证你的程序返回了你期望的结果.为了最大限度的灵活性,JMeter 允许使用正则表达式创建断言.

Apache jmeter 可以用于对静态的和动态的资源(文件,Servlet,Perl 脚本,java 对象,数据库和查询,FTP 服务器等等)的性能进行测试.它可以用于对服务器、网络或对象模拟繁重的负载来测试它们的强度或分析不同压力类型下的整体性能.你可以使用它做性能的图形分析或在大并发负载测试你的服务器/脚本/对象.

1.2 为什么是 JMeter

为什么选择 JMeter,下面看看 JMeter 的特色.

  1. 开源许可: Jmeter 是完全免费的,并提供了源码可供自定义开发

  2. 图形界面模式:提供了方便的图形界面来编辑和开发测试脚本

  3. 平台无关:可以轻易在 windows、linux、mac 上运行

  4. 多线程框架:通过线程组,Concurrent users to easily set different test.

  5. 图形测试结果:提供了图表、表格、树、文件等格式的结果显示.

  6. 易于安装:jmeter 不需要安装,下载解压即可用.

  7. 高扩展性:jmeter 支持用户自定义测试脚本,同样还提供了各种插件.

  8. 多测试类型支持:支持性能测试、分布式测试、功能测试

  9. 仿真模拟:支持多用户并发测试

  10. 多协议支持:支持 http、jdbc、ldap、soap、jms、ftp 等等协议

  11. 录制&回放:支持用 badboy 或 jmeter 录制

  12. 脚本测试:jmeter 支持 beanshell 和 selenium

在这里插入图片描述

1.3 JMeter 工作原理

JMeter 基本工作原理如图:

在这里插入图片描述

JMeter 完整的工作原理如图:

在这里插入图片描述

1.4 总结

本次对 jmeter 进行了简单的基本介绍,主要让大家对 jmeter 有个基本的了解.

第二篇 JMeter 目录及关键配置分析

2.1 前言

Learn a tool,Must first key to its configuration and directory has a basic understanding of,This can more easily in-depth grasp the tool,下面我们就 JMeter Directory and related key configuration analysis shows that.

2.2 下载安装

1.安装主程序

从 Apache JMeter Website under the latest version:

http://jmeter.apache.org/download_jmeter.cgi

在这里插入图片描述

下载后直接解压即可.

2.安装插件管理


https://jmeter-plugins.org/install/Install/ 或 https://jmeter-plugins.org/downloads/all/ Download the plugin management package,如图:

在这里插入图片描述

Put to the download package jmemter Extract the root of lib/ext After the restartjmeter即可.

在这里插入图片描述

2.3 目录说明

First look at the decompression after JMeter 安装目录:

在这里插入图片描述

目录说明:

backups: 包含jmeterAutomatic backup save to test plan

 bin: 包含启动、配置等相关命令

 docs: 官方本地文档目录

 extras: 辅助库

 lib: 核心库,包含 JMeter 用到的各种基础库和插件

 licenses: 包含 non-ASF 软件的许可证

 printable_docs: 可打印版本文档目录

 LICENSE: JMeter 许可说明

 NOTICE: JMeter 简单信息说明

 README.md: JMeter 官方基本介绍

下面我们重点看下 bin 目录,如图:

在这里插入图片描述

主要介绍 bin We pay most attention to several files directory:

 jmeter.properties: JMeter 核心配置文件,各种配置基本在这完成

 log4j.conf: JMeter 日志配置管理

 jmeter.log: JMeter 运行日志记录,什么输出信息、警告、报错都在这里进行了记录

 jmeter.bat: windows 下 jmeter 启动文件

 shutdown.cmd: windows 下 jmeter 关闭文件

 stoptest.cmd: windows 下 jmeter 测试停止文件

 jmeter-server.bat: windows 下 jmeter 服务器模式启动文件

注:每一个.cmd 文件都对应一个.sh 文件,.sh 是 linux Under the corresponding function of file,The function of the other files are not say clear,At the same time other elaborates the directory is no longer here,Interested can thorough look at yourself.

在这里插入图片描述

2.4 关键配置说明

1.jmeter.properties 配置说明

Mainly includes the following aspects of configuration:

SSL 配置:

重点关注下面几个配置

# 指定 HTTPS 协议层

https.default.protocol=TLS

# 指定 SSL 版本,实际应用中可能需要修改

https.default.protocol=SSLv3

# 设置启动的协议

https.socket.protocols=SSLv2Hello SSLv3 TLSv1

# 缓存控制,控制 SSL 是否可以在多个迭代中重用

https.use.cached.ssl.context=true

JMeter Interface display configuration

Here is not the interface shows the display control of,Usually the default interface can meet all application.

JMeter 测试项目自动备份配置

# 设置是否启用自动备份,默认是 true

jmeter.gui.action.save.backup_on_save=true

# 设置自动备份目录,默认备份至 JMeter 根目录的 backups下

jmeter.gui.action.save.backup_directory=

# 设置自动备份项目数,默认为最近 10 个

jmeter.gui.action.save.keep_backup_max_count=10

远程主机配置

# 配置远程主机的 IP,默认为本机.用逗号","可以设置多个远程主机

remote_hosts=127.0.0.1

# 多个远程主机指定示例如下,其中:后为端口

remote_hosts=127.0.0.1:1099,127.0.0.1:1200,127.0.0.1:1300

对于 RMID 的配置请直接看配置文件中的选项说明

日志管理配置

# 设置日志格式

log_format_type=default

# 设置日志输出级别

log_level.jmeter=INFO

# 设置 junit 日志输出级别

log_level.jmeter.junit=DEBUG

# 设置日志输出目标文件,默认为 jmeter.log

log_file=jmeter.log

And so on other 10 Multiple configuration categories(就不一一列举了)

jmeter.bat 关键配置修改

为了更优化的使用 jmeter,需要对 jmeter.bat 中的一些配置根据当前机器的配置进行优化,这里进行关键配置项说明,找到这些配置,对其中的数值根据当前机器的硬件配置来修改.

set HEAP=-Xms2048m -Xmx2048m

set NEW=-XX:NewSize=512m -XX:MaxNewSize=512m

set SURVIVOR=-XX:SurvivorRatio=8 -

XX:TargetSurvivorRatio=50%

set TENURING=-XX:MaxTenuringThreshold=2

if %current_minor% LEQ "8" (

rem Increase MaxPermSize if you use a lot of Javascript in

your Test Plan :

set PERM=-XX:PermSize=512m -

XX:MaxPermSize=1024m

)

2.5 启动 jmeter

在 bin 目录下直接双击 jmeter.bat 即可

启动后的界面如下:

在这里插入图片描述

2.6 总结

本次就 jmeter The installation and configuration and key configuration items to share,You can go to study in-depth the other configuration,In order to further familiar with jmeter 的原理和应用.

喜欢软件测试的小伙伴们,如果我的博客对你有帮助、如果你喜欢我的博客内容,请 “点赞” “评论” “收藏” 一 键三连哦!

软件测试工程师自学教程:

这才是2022最精细的自动化测试自学教程,我把它刷了无数遍才上岸字节跳动,做到涨薪20K【值得自学软件测试的人刷】

接口性能测试 — 软件测试人必会618实战场景分析

软件测试工程师月薪2W以上薪资必学技能 — Python接口自动化框架封装.

美团面试真题_高级测试25K岗位面试 — 软件测试人都应该看看

测试开发之全面剖析自动化测试平台 — 软件测试人的必经之路

软件测试必会_Jmeter大厂实战 — 仅6步可实现接口自动化测试

Jmeter实战讲解案例 — 软件测试人必会

在这里插入图片描述

在这里插入图片描述

原网站

版权声明
本文为[Rejoice in the testing world]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/222/202208102110073529.html