学英语学压测:03jmeter组件-采样器、逻辑控制器

📢📢📢:先看关键单词,再看英文,最后看中文总结,再回头看一遍英文原文,效果更佳!!

关键词

assertion断言/əˈsɜrʃən/
configuration element配置元素/ˌkɒn.fɪˈɡjʊr.eɪ.ʃən ˈɛlɪmənt/
controller控制器/kənˈtroʊlər/
cookie managercookie管理器/ˈkʊki ˈmænɪdʒər/
default默认值/dɪˈfɔlt/
interleave controller交错控制器/ˈɪntərˌliv kənˈtroʊlər/
listener监听器/ˈlɪsənər/
logical controller逻辑控制器/ˈlɒdʒɪkəl kənˈtroʊlər/
once only controller仅一次控制器/wʌns ˈoʊnli kənˈtroʊlər/
sampler采样器/ˈsæmplər/
thread group线程组/θrɛd ɡruːp/

控制器:包括采样器和逻辑控制器

JMeter has two types of Controllers: Samplers and Logical Controllers. These drive the processing of a test.

Samplers tell JMeter to send requests to a server. For example, add an HTTP Request Sampler if you want JMeter to send an HTTP request. You can also customize a request by adding one or more Configuration Elements to a Sampler. For more information, see Samplers.

Logical Controllers let you customize the logic that JMeter uses to decide when to send requests. For example, you can add an Interleave Logic Controller to alternate between two HTTP Request Samplers. For more information, see Logical Controllers.

采样器:

Samplers tell JMeter to send requests to a server and wait for a response. They are processed in the order they appear in the tree. Controllers can be used to modify the number of repetitions of a sampler.

JMeter samplers include:

  • FTP Request
  • HTTP Request (can be used for SOAP or REST Webservice also)
  • JDBC Request
  • Java object request
  • JMS request
  • JUnit Test request
  • LDAP Request
  • Mail request
  • OS Process request
  • TCP request

Each sampler has several properties you can set. You can further customize a sampler by adding one or more Configuration Elements to the Test Plan.

If you are going to send multiple requests of the same type (for example, HTTP Request) to the same server, consider using a Defaults Configuration Element. Each controller has one or more Defaults elements (see below).

Remember to add a Listener to your test plan to view and/or store the results of your requests to disk.

If you are interested in having JMeter perform basic validation on the response of your request, add an Assertion to the sampler. For example, in stress testing a web application, the server may return a successful "HTTP Response" code, but the page may have errors on it or may be missing sections. You could add assertions to check for certain HTML tags, common error strings, and so on. JMeter lets you create these assertions using regular expressions.

逻辑控制器

Logic Controllers let you customize the logic that JMeter uses to decide when to send requests. Logic Controllers can change the order of requests coming from their child elements. They can modify the requests themselves, cause JMeter to repeat requests, etc.

To understand the effect of Logic Controllers on a test plan, consider the following test tree:

  • Test Plan
    • Thread Group
      • Once Only Controller
        • Login Request (an HTTP Request)
      • Load Search Page (HTTP Sampler)
      • Interleave Controller
        • Search "A" (HTTP Sampler)
        • Search "B" (HTTP Sampler)
        • HTTP default request (Configuration Element)
      • HTTP default request (Configuration Element)
      • Cookie Manager (Configuration Element)

The first thing about this test is that the login request will be executed only the first time through. Subsequent iterations will skip it. This is due to the effects of the Once Only Controller.

After the login, the next Sampler loads the search page (imagine a web application where the user logs in, and then goes to a search page to do a search). This is just a simple request, not filtered through any Logic Controller.

After loading the search page, we want to do a search. Actually, we want to do two different searches. However, we want to re-load the search page itself between each search. We could do this by having 4 simple HTTP request elements (load search, search "A", load search, search "B"). Instead, we use the Interleave Controller which passes on one child request each time through the test. It keeps the ordering (i.e. it doesn't pass one on at random, but "remembers" its place) of its child elements. Interleaving 2 child requests may be overkill, but there could easily have been 8, or 20 child requests.

Note the HTTP Request Defaults that belongs to the Interleave Controller. Imagine that "Search A" and "Search B" share the same PATH info (an HTTP request specification includes domain, port, method, protocol, path, and arguments, plus other optional items). This makes sense - both are search requests, hitting the same back-end search engine (a servlet or cgi-script, let's say). Rather than configure both HTTP Samplers with the same information in their PATH field, we can abstract that information out to a single Configuration Element. When the Interleave Controller "passes on" requests from "Search A" or "Search B", it will fill in the blanks with values from the HTTP default request Configuration Element. So, we leave the PATH field blank for those requests, and put that information into the Configuration Element. In this case, this is a minor benefit at best, but it demonstrates the feature.

The next element in the tree is another HTTP default request, this time added to the Thread Group itself. The Thread Group has a built-in Logic Controller, and thus, it uses this Configuration Element exactly as described above. It fills in the blanks of any Request that passes through. It is extremely useful in web testing to leave the DOMAIN field blank in all your HTTP Sampler elements, and instead, put that information into an HTTP default request element, added to the Thread Group. By doing so, you can test your application on a different server simply by changing one field in your Test Plan. Otherwise, you'd have to edit each and every Sampler.

The last element is a HTTP Cookie Manager. A Cookie Manager should be added to all web tests - otherwise JMeter will ignore cookies. By adding it at the Thread Group level, we ensure that all HTTP requests will share the same cookies.

Logic Controllers can be combined to achieve various results. See the list of built-in Logic Controllers.

总结

  1. JMeter有两种类型的控制器:采样器和逻辑控制器。
  2. 采样器:告诉JMeter向服务器发送请求并等待响应,按它们在测试树中的顺序处理。
  3. 常见的采样器:包括FTP请求、HTTP请求、JDBC请求、Java对象请求、JMS请求、JUnit测试请求、LDAP请求、邮件请求、操作系统进程请求和TCP请求。
  4. 配置元素:可以通过添加一个或多个配置元素来自定义采样器。
  5. 默认配置元素:如果要向同一服务器发送多个相同类型的请求,考虑使用默认配置元素。
  6. 监听器:添加到测试计划中以查看和/或将请求结果存储到磁盘。
  7. 断言:可以在响应中执行基本验证,例如检查特定HTML标签或常见错误字符串。
  8. 逻辑控制器:让你可以自定义JMeter用来决定何时发送请求的逻辑,改变请求的顺序、修改请求、重复请求等。
  9. Once Only Controller:只在第一次迭代时执行其子请求。
  10. Interleave Controller:在其子请求之间交替,每次通过测试时传递一个子请求。
  11. HTTP Request Defaults:可以将共享的HTTP请求信息抽象到一个配置元素中,以减少重复配置。
  12. Cookie Manager:应添加到所有Web测试中,否则JMeter将忽略cookies。
  13. 组合逻辑控制器:可以结合使用来实现各种结果。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/diannao/66173.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

配置嵌入式服务器

一、如何定制和修改Servlet容器的相关配置 修改和server有关的配置(ServerProperties) server.port8081 server.context‐path/tx server.tomcat.uri-encodingUTF-8二、注册servlet三个组件【Servlet、Filter、Listener】 由于SpringBoot默认是以jar包…

文献分享:RoarGraph——跨模态的最邻近查询

文章目录 1. \textbf{1. } 1. 导论 1.1. \textbf{1.1. } 1.1. 研究背景 1.2. \textbf{1.2. } 1.2. 本文的研究 1.3. \textbf{1.3. } 1.3. 有关工作 2. \textbf{2. } 2. 对 OOD \textbf{OOD} OOD负载的分析与验证 2.1. \textbf{2.1. } 2.1. 初步的背景及其验证 2.1.1. \textbf{2…

智慧工地信息管理与智能预警平台

建设背景与政策导向 智慧工地信息管理与智能预警平台的出现,源于工地管理面临的诸多挑战,如施工地点分散、危险区域多、监控手段落后等。随着政府对建筑产业现代化的积极推动,各地纷纷出台政策支持智慧工地的发展,旨在通过信息技…

[论文笔记]Representation Learning with Contrastive Predictive Coding

引言 今天带来论文 Representation Learning with Contrastive Predictive Coding的笔记。 提出了一种通用的无监督学习方法从高维数据中提取有用表示,称为对比预测编码(Contrastive Predictive Coding,CPC)。使用了一种概率对比损失, 通过使用负采样使…

H7-TOOL固件2.27发布,新增加40多款芯片脱机烧录,含多款车轨芯片,发布LUA API手册,CAN助手增加负载率,错误状态信息检测

H7-TOOL详细介绍(含操作手册):H7-TOOL开发工具,1拖4/16脱机烧录,高速DAPLINK,RTOS Trace,CAN/串口助手, 示波器, RTT等,支持WiFi,以太网,高速USB和手持 - H7-…

Git 入门(一)

git 工作流如下: 命令如下: clone(克隆): 从远程仓库中克隆代码到本地仓库checkout (检出):从本地仓库中检出一个仓库分支然后进行修订add(添加): 在提交前先将代码提交到暂存区com…

【网络安全 | 漏洞挖掘】JS Review + GraphQL滥用实现管理面板访问

未经许可,不得转载。 正文 在映射目标范围后,我发现了一个用于管理的控制台界面,但没有注册功能。 于是我开始尝试: 1、模糊测试注册端点 -> 失败 2、在请求中将登录替换为注册 -> 再次失败 尝试均未奏效后,我决定冷静下来,重新思考方法并利用技术手段。 我观察…

gitlab高级功能之 CICD Steps

CICD Steps 1. 介绍2. 定义 Steps2.1 Inputs2.2 Outputs 3. Using steps3.1 Set environment variables3.2 Running steps locally 4. Scripts5. Actions5.1 已知的问题 6. 表达式7. 实操7.1 单个step7.2 多个step7.3 复用steps7.4 添加output到step7.5 使用远程step 1. 介绍 …

开源数据集成平台白皮书重磅发布《Apache SeaTunnel 2024用户案例合集》!

2025年新年临近,Apache SeaTunnel 社区用户案例精选📘也跟大家见面啦!在过去的时间里,SeaTunnel 社区持续成长,吸引了众多开发者的关注与支持。 为了致谢一路同行的伙伴,也为了激励更多人加入技术共创&…

Python:交互式物质三态知识讲解小工具

学着物理写着Python 以下是一个使用Python的Tkinter库实现的简单示例程序,通过图形界面展示并讲解固态、液态、气态的一些特点,代码中有详细的注释来帮助你理解各部分功能: 完整代码 import tkinter as tk from tkinter import ttk import …

多模态论文笔记——CogVLM和CogVLM2(副)

大家好,这里是好评笔记,公主号:Goodnote,专栏文章私信限时Free。本文详细介绍多模态模型的LoRA版本——CogVLM和CogVLM2。在SD 3中使用其作为captioner基准模型的原因和优势。 文章目录 CogVLM论文背景VLMs 的任务与挑战现有方法及…

网络安全抓包

#知识点: 1、抓包技术应用意义 //有些应用或者目标是看不到的,这时候就要进行抓包 2、抓包技术应用对象 //app,小程序 3、抓包技术应用协议 //http,socket 4、抓包技术应用支持 5、封包技术应用意义 总结点:学会不同对象采用…

Innodisk iSMART V6使用说明_SSD还能用多久?已经读写了多少次数?……

Innodisk iSMART是一款SSD健康数据读取软件。它能轻松获取大部分SSD内部寄存器中的健康数据,并以简洁的图形界面展示给用户。在程序界面的顶部,是页面标签,点击页面标签就能切换到相应的页面。页面标签的下面是磁盘选择栏。点击磁盘编号&…

网络编程原理:回显服务器与客户端通信交互功能

文章目录 路由器及网络概念网络通信基础TCP/IP 五层协议封装和分用封装分用 网络编程(网络协议)UDP类 API使用实现回显通信程序回显服务器(UDP代码)回显客户端(UDP代码) TCP API使用回显服务器(TCP代码)回显客户端(TCP代码) 路由器及网络概念 网络发展是…

设计模式 创建型 建造者模式(Builder Pattern)与 常见技术框架应用 解析

单例模式(Singleton Pattern),又称生成器模式,是一种对象构建模式。它主要用于构建复杂对象,通过将复杂对象的构建过程与其表示分离,使得同样的构建过程可以创建出具有不同表示的对象。该模式的核心思想是将…

【C++】P1428 小鱼比可爱

博客主页: [小ᶻ☡꙳ᵃⁱᵍᶜ꙳] 本文专栏: C 文章目录 💯前言💯题目说明题目输入格式题目输出格式样例**输入样例****输出样例** 题目解析 💯解法分析我的做法代码解法说明时间复杂度 老师的做法代码解法说明总结时间复杂度 …

maven之插件调试

当使用maven进行项目管理的时候,可能会碰到一些疑难问题。网上资料很少,可能会想着直接调试定位问题。这里以maven-compiler-plugin为例: (1)准备maven-compiler-plugin源码 进入maven 官网-》Maven Plugins-》找到对…

蓝桥杯(Java)(ing)

Java前置知识 输入流: (在Java面向对象编程-CSDN博客里面有提过相关知识------IO流) // 快读快写 static BufferedReader in new BufferedReader(new InputStreamReader(System.in)); static BufferedWriter out new BufferedWriter(new…

【C++】深入理解C语言中的特殊字符处理与问题分析优化

博客主页: [小ᶻ☡꙳ᵃⁱᵍᶜ꙳] 本文专栏: C 文章目录 💯前言💯题目:B2090 年龄与疾病输入格式输出格式输入输出样例 💯初始代码分析与问题排查问题点分析 💯修正后的代码与优化修正与优化要点 &#…

电商Google广告:2025年提升转化率的5种策略

展望 2025 年,Google 广告领域将迎来一系列显著变化,这些趋势对于提升广告转化率至关重要,值得我们提前关注与布局。 智能化程度持续加深,用户搜索习惯愈发精细,广告格式推陈出新,视频广告势头正猛...那么…