1. Scope of the component
JMeter There are 8 types of components that can be executed (test plans and thread groups are not components), in which the sampler is a typical component that does not interact with other components, and the logic controller only works on the sampler for its child nodes, while the other components (config elements , timers, Post-processors, assertions, listeners, etc.) need to interact with components such as samplers (sampler).
configuration components (config elements )
The component affects all components within its scope.
Pre-processor (per-processors)
The components are executed before each sampler element within its scope.
Timers (Timers)
The component is effective for every sampler within its scope
Post Handler (post-processors)
The component executes after each sampler element within its scope.
Assertion (assertions)
The component performs a check on the results of each sampler element within its scope.
Listener (Listeners)
The component collects and renders information for each of the sampler components of its scope.
In JMeter, the scope of a component is determined by the parent-child relationship of the component in the tree structure of the test plan, and the principle of the scope is:
- The sampler (sampler) element does not interact with other components, so there is no scope problem.
- Logic controller components only function on samplers and logical controllers in their child nodes.
- In addition to samplers and logic controller components, other 6-class components, if they are child nodes of a sampler, function on their parent-child nodes.
- A Class 6 component other than the sampler and logic controller component, if its parent node is not sampler, its scope is all other descendant nodes (including child nodes, child nodes, etc.) under the parent node of the component.
2. Order of execution of components
After understanding the scope of the components, to see the order in which the components are executed, the rules for the order of the component execution are simple, and within the same scope of the domain, the components in the test plan are executed in the following order.
(1) configuration element (config elements)
(2) Pre-processing procedure (per-processors)
(3) Timer (timers)
(4) sampling device (Sampler)
(5) The post handler (post-processors) (unless sampler results in a null return).
(6) Assertion (assertions) (unless sampler gets a null return result).
(7) Listener (Listeners) (unless the return result of sampler is empty).
There are three points to note about the execution sequence:
* Components such as pre-processors, post processors, and assertions can only act on samplers, so they will not be executed if there are no samplers within their scope.
* If there are multiple components of the same type within the same scope, the components are executed one time in the order they are in the test plan.
* An assertion is hierarchical in the test tree. If its parent component is a request, it is applied to that request. If its parent component is a controller, it affects all requests under that controller.
JMeter Learning 3-Component execution order