Jmeter-scope and execution sequence of components

Source: Internet
Author: User
Tags http cookie

 

I have already introducedJmeterFor beginners,JmeterThere are still a lot of components. If we learn according to the meaning of each parameter of each component, it will undoubtedly reduce the enthusiasm for learning performance testing, even if we are familiar with all the components and the parameters on the components, we do not know how to combine them into the performance tests we want to describe. On the other hand, when we click components on each node, similar or identical menus will appear. What is their hierarchical relationship. The position at which this component is placed is what we want.

Quick StartJmeterYou are advised to quickly understand the components and hierarchical relationships of a performance test by recording scripts.

For more information about the recording method, see jmeterBasics-Recording script"

As follows:BadboyA script recorded by the tool (script process: Login126Email, send an email to yourself and wish you a merry Christmas !), You can easily export the scriptJMXFormat, which is alsoJmeterScript format, so it can beJmeterIdentify and import.

 

Script importJmeterThen, I added two listeners (view the result tree), because they have different scopes due to their different locations. The previous one can only listenWww.126.comPage request.HTTPRequest to listen.

 

 

 

Component Scope

 

 

 

 

The component has a scope. Jmeter Basics --- Jmeter Basic Concepts In the chapter, we introduce 8 Components that can be executed by the class (the test plan and thread group do not belong to the component). Among these components, the sampleer is a typical component that does not interact with other components, the logical controller is only valid for subnode samplervers, while other elements ( Config Elements , Timers , Post-processors , Assertions , Listeners ,) Needs to be associated with the samplezer ( Sampler .

Configuration element (Config Elements) 

A component affects all components within its scope of action.

Pre-processingProgram(Per-processors)

Each component within its scopeSamplerExecuted before the component.

Timer (Timers)

Each element within its scopeSamplerValid

Post-processing program (Post-processors)

Each component within its scopeSamplerAfter the component is executed.

Assertion (Assertions)

Each element within its scopeSamplerVerify the component execution result.

Listener (Listeners)

Components collect each of their scopesSamplerComponent information and presentation.

InJmeterIn, the scope of the component is determined by the parent-child relationship of the component in the tree structure of the test plan. The principle of the scope is:

  •  Samplezer (Sampler) The component does not interact with other components, so there is no scope problem.
  •  Logical Controller (Logic Controller) The component only acts on the sampleer and logic controller in its subnodes.
  •  Except for the samplezer and logic controller components6Class element, if it isSamplerThe child node of the Parent and Child Nodes.
  •  Except for the sampling device and logical controller Components6Class element. If its parent node is notSamplerThe scope is all other child nodes (including child nodes and child nodes) under the parent node of the component ).

After talking about this, you may be confused. Is it swollen !? Two examples are used to understand their scopes.

 

A(Note: it is only to describe the scope and cannot run normally)

sampler ( HTTP request 1 , FTP request 2 , TCP sampler 3 ) logical controller (Cyclic Controller) listener (graphical result 1 aggregate reports 2 )

* HTTP request 1 , FTP request 2 , TCP sampler 3 the component has no scope concept.

* the cyclic Controller component acts on its subnode. FTP request 2 , TCP sampler 3 .

* graphic results 1 the scope of the component is FTP request 2 , TCP sampler 3 .

*Aggregate report2The scope of the metaworks isHTTPRequest1,FTPRequest2,TCPSamplezer3

 

B(Note: it is only to describe the scope and cannot run normally)

This example is a little more complex and contains many components. First, subcategory.

Samplezer (HTTPRequest,FTPRequest,TCPSamplezer,JDBC request) Logical controller (Cyclic controller, instant Controller) timer (fixed timer,Uniform Random Timer) Assertions (Response assertions,XMLAssertion) listener (graphical results, aggregate reports)

 

According to the Scope Principle, the scopes of these components are:

* HttpRequest,FTPRequest,TCPSamplezer,JDBC requestThe component has no function domain name concept.

*The scope of the loop controller isFTPRequest,TCPSamplerger and instant Controller

* fixed timer for HTTP request, Uniform Random timer act on all samplervers

* response assertions act on JDBC request , XML the assertion acts on FTP request, TCP sampling and JDBC request .

*Graphic Results Act onFTPRequest,TCPSampling andJDBC requestThe aggregate report acts on all samplervers.

 

In fact, the above analysis is not as complicated as you think. We can judge the scope of each component from the hierarchy of each component.

 

JmeterIn (Config Elements) The behavior within the scope of its function is slightly different from that of other components. Logical Controller components are divided into two categories: default configuration (HTTPDefault request,FTPDefault requests) and management (HTTPHeader management,HTTP cookieManagement ).

The default configuration ( Configuration ults Values set in the component can be superimposed within the scope. For example, add two HTTP Default request, the first default setting Server name or IP Is Www.google.com , The second default setting Path Is /Page-not-exist , All HTTP Default request. The default Server name or IP And Path Both Server name or IP And /Page-not-exist . (You have a story. I have a joke. When we exchange it, both of them have a story and a joke .)

Management (Manager) Logical controller components cannot be superimposed. If two or more management components have overlapping scopes. Then, the sampling device components in the overlapping scope will only be affected by one of them immediately, which will lead to uncertainty in the behavior of the sampling device. Therefore, when using management logic controllers, you must ensure that the scopes of the same management components do not overlap.

 

 

 

 

 

 

 

 

 

 

 

Component execution sequence

 

After understanding that the component has a scope, let's take a look at the execution sequence of the component. The rule for the component execution sequence is very simple. Within the same scope of the domain name, the components in the test plan are executed in the following order.

(1) Configuration component (Config Elements)

(2) Pre-processing program (Per-processors)

(3) Timer (Timers)

(4) Sampling Device (Sampler)

(5) Post-processing program (Post-processors) (UnlessSamplerThe returned result is null ).

(6) Assertion (Assertions) (UnlessSamplerThe returned result is null ).

(7) Listener (Listeners) (UnlessSamplerThe returned result is null ).

 

Note the following two points about the execution sequence:

*Components such as the Preprocessor, postprocessor, and assertion can act on samplerkers. Therefore, if they do not have any samplerkers within their scope, they will not be executed.

*If multiple components of the same type exist within the same scope, these components are executed in the ascending and descending order of the test plan.

 

------------------------------

Note: The sampler mentioned in this document is translated as a "sampler" in some documents ".

Related reading:

Basic concepts of jmeter --- basic concepts of jmeter Jmeter-recording script One of the basics of jmeter is a simple performance test

 

 

 

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.