学英语学压测:06 jmeter 各组件元素的作用域

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

关键词

descendant 后代 /dɪˈsɛndənt/
hierarchical 分层的 /ˌhaɪəˈrɑːrkɪkəl/
irrelevant 无关的 /ɪˈrɛləvənt/
subelement 子元素 /ˈsʌbˌɛlɪmənt/
test tree 测试树 /tɛst triː/
timer 计时器 /ˈtaɪmər/
tree branch 树枝 /triː bræntʃ/

元素作用域规则

The JMeter test tree contains elements that are both hierarchical and ordered. Some elements in the test trees are strictly hierarchical (Listeners, Config Elements, Post-Processors, Pre-Processors, Assertions, Timers), and some are primarily ordered (controllers, samplers). When you create your test plan, you will create an ordered list of sample request (via Samplers) that represent a set of steps to be executed. These requests are often organized within controllers that are also ordered. Given the following test tree:

学英语学压测:06 jmeter 各组件元素的作用域_第1张图片

The order of requests will be, One, Two, Three, Four.

Some controllers affect the order of their subelements, and you can read about these specific controllers in the component reference.

Other elements are hierarchical. An Assertion, for instance, is hierarchical in the test tree. If its parent is a request, then it is applied to that request. If its parent is a Controller, then it affects all requests that are descendants of that Controller. In the following test tree:

学英语学压测:06 jmeter 各组件元素的作用域_第2张图片

Assertion #1 is applied only to Request One, while Assertion #2 is applied to Requests Two and Three.

Another example, this time using Timers:

学英语学压测:06 jmeter 各组件元素的作用域_第3张图片

In this example, the requests are named to reflect the order in which they will be executed. Timer #1 will apply to Requests Two, Three, and Four (notice how order is irrelevant for hierarchical elements). Assertion #1 will apply only to Request Three. Timer #2 will affect all the requests.

Hopefully these examples make it clear how configuration (hierarchical) elements are applied. If you imagine each Request being passed up the tree branches, to its parent, then to its parent's parent, etc., and each time collecting all the configuration elements of that parent, then you will see how it works.

总结:

  1. JMeter测试树结构:

    • 测试树包含层次结构和顺序元素。
    • 严格层次结构的元素包括监听器、配置元素、后置处理器、预处理器、断言和计时器。
    • 主要有序的元素包括控制器和采样器。
  2. 请求的顺序:

    • 在测试计划中创建的采样请求代表要执行的一系列步骤。
    • 这些请求通常组织在有序的控制器内。
  3. 控制器对顺序的影响:

    • 某些控制器会影响其子元素的顺序。
  4. 层次结构元素的应用:

    • 断言、计时器等层次结构元素根据其父级应用。
    • 如果断言的父级是请求,则仅应用于该请求;如果父级是控制器,则应用于该控制器的所有子请求。
  5. 示例说明:

    • 示例1:断言#1仅应用于请求One,断言#2应用于请求Two和请求Three。
    • 示例2:计时器#1应用于请求Two、Three和Four,计时器#2应用于所有请求。
  6. 配置元素的应用机制:

    • 请求在树结构中传递时,会收集其父级及其祖先的所有配置元素。

你可能感兴趣的:(压测工具jmeter,jmeter,压力测试,作用域,元素作用域)