Jmeter-component execution sequence and scope

Source: Internet
Author: User

1. Important jmeter components:

1) configuration element --- config element:
It is used to initialize default values and variables for later use by the probe. The Configuration component handles the initial phase of its scope. The Configuration component is only valid for its test tree branch, for example, before any sampling in the same scope.

2) pre-processor --- pre processors:
The front processor performs some special operations before the probe sends a request. If the Preprocessor is attached to a probe, it will only be executed before the probe runs. The Preprocessor is usually used to modify certain settings of the probe or update values of certain variables before the probe sends a request (these variables are not obtained in the server response ).

3) timer --- Timer:
The timer will keep every samplerger in the scope waiting for a fixed duration before execution. If this delay is not set, jmeter may generate a large number of access requests in a short time, as a result, the server is overwhelmed by a large number of requests. If multiple timers are added to the thread group, jmeter overwrites the timer durations to jointly affect the samplerger within the scope. The timer can be used as a subitem of the probe or logical controller to only affect the samplerger within the scope.

4) sampler --- sampler:
The sampler tells jmeter to send a request to the specified server and wait for the request from the server. The sampler is executed in the order in the test tree. You can also use the logic controller to change the number of times the sampler runs.

5) post processor --- post processors:
The post-processor performs some special operations after the probe sends a request. If the post-processor is attached to a subsample, it will only be executed after the subsample is run. A postprocessor is usually used to process server response data, especially data extraction from server response.

6) assertions:
You can use assertions to check the response content obtained from the server. Using assertions, you can test whether the response returned by the server matches the expectations of the tester.

7) Listener --- listener:
The listener provides an access method to the information that jmeter collects during testing. The "graphic result" listener will draw the system response time in an image. The "view result tree" listener displays the details of the request and response of the probe. You can also import the test data to a file for subsequent analysis.

8) logic controller --- controller:
The logical controller can help you control the jmeter test logic, especially when to send requests. The logic controller can change the request execution sequence of its sub-test components.

Ii. Component execution sequence:

The execution of the elements of the test plan is ordered:
1-config Element)
2-pre Processors)
3-timer (timer)
4-Sampler)
5-post processor (post processors, executed only when results are available)
6-assertions (executed only when results are available)
7-listener (listener, executed only when results are available)

 

Iii. Component scope: 

The component collects and presents information about each sampler component in the scope of its role. In jmeter, the scope of the component is determined by the parent-child relationship of the component in the tree structure of the test plan, the scope principle is:

  • Sampler: The component does not interact with other components, so there is no scope problem.
  • Logical Controller: A component acts only on the samplerger and logical controller in its subnodes.
  • In addition to the sampler and logical controller components, the other six types of components, if a subnode of a sampler, the component only works for its parent and child nodes.
  • Except the sampler and logical controller components, if its parent node is not sampler, its scope is all other child nodes (including child nodes, ).

 

4. Special Instructions:

Config elemnet --> User-Defined variables: the variables defined by this component are shared by the entire thread no matter where it is placed.

For example:

In the following example, the test plan is defined as follows:

1. Three sampler types are defined: one, debug sampler, and two.

2. Define a user-defined variable under one: Add a variable named hello with the value of world.

3. A listener: view the result tree

Objective: To test whether the variables defined in sampler one can be referenced by sampler two and debug Sampler

One:

 

User Defined variables:

Two:

 

Running result:

 

We can see from the above: the user variables defined under one can be used normally at debug sampler and two.

Jmeter-component execution sequence and scope

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.