Jemeter Logic Controller

Source: Internet
Author: User

1. Foreach Controller

The foreach controller reads a series of related variables in a user-defined variable. The sampler or controller under the controller will be executed one or more times, each time reading a different value of the variable. So foreach is always used with the user Defined variables. The usage of it is described in the following instance.

Control Panel

Parameters

Name: Controller names

Comments: Remarks

Input Variable Prefix: Enter variable prefix

Output variable name: Export variable name

Add "_" before number: Enter the variable name for the interval using "_".

Example

In this example, an HTTP request (login page) is added to the foreach controller, and a user name and password are required. Here we set the user name as a variable in the user-defined variable.

Settings in User parameter panel

setting in the Foreach Controller panel

Settings in the HTTP request Sampler panel

When the test plan is executed, the foreach controller iterates through the user parameter to find the variable name that matches the set condition, which is "name" + "_" + "loop count". After the matching variables are found, the values are assigned to the output variable (vname). It can then be used in the sampler or controller under the foreach controller, using the format ${output variable name}.

Run the test plan, as you can see in the view results tree, with different parameters for each request.

2, including controller--include controllers

Contains the controller used to use external jmx files. To demonstrate the use of it, you can add a simple controller and add a sampler (sample) to it, such as an HTTP request. Then save the simple controller as a JMX file. This allows the jmx file to be set in the include controller to be used in the test plan. It is important to note that the test plan that contains the test cannot be a thread group, only the simple controller can be added, and then any sampler, controller under it.

If users need to use cookie manage or user-defined variables, they should be set in the top-level test plan and should not be included in external files, otherwise they will not work.

This element does is not a variables/functions in the FileName field.

However, if the Propertyincludecontroller.prefixis defined, the contents is used to prefix the pathname.

If a file is not found in the Prefix+filename path, the controller attempts to find it in the JMX store directory based on the file name.

Control Panel

Parameters

Attribute

Description

Required

Filename

Included files

Yes

3. Runtime Controller

4. Switch Controller

The switch controller specifies which sampler to run by assigning value to value in the controller. There are two ways to assign values:

1. The first is the value, and the child node under the switch controller counts from 0, determining which element to execute by specifying the numeric value of the child node.

2. The second is to directly specify the name of the child element, such as the sampler name to match. When the specified name does not exist, no element is executed.

When value is empty, a 1th child node element is executed by default.

Control Panel

Parameters

Name: Controller names

Switch value: Specifies the name or numeric value of the child element that needs to be run.

Example

Each parameter of the thread group is set to 1,switch value set "Login.aspx", run the test plan, and view the results in "View results tree"

Only HTTP requests with name "Login.aspx" are executed.

5. While Controller

6. Transaction controller

The transaction controller generates an additional sampler to measure the overall time of the test element under it. It is worth noting that this time contains all the processing time in the scope of the controller, not just the sampler.

For versions above Jmeter2.3, there are two modes of operation

• The transaction sampler is the one that is added after the sampler

• The transaction sampler is the parent sampler for its down sampler.

The measured time of the generated transaction sampler includes its down sampler and all other times. Due to the clock frequency problem, this time may be slightly larger than the sum of the time of a single sampler. The clock start time is the same as the clock end time between the start time of the controller record and the start of the first sampler.

The transaction sampler only displays success if its sub-sampler is successful.

In parent mode, individual samplers under the transaction controller are only visible in the Tree View listener. Also, the data for the sub-sampler is not displayed in the CSV file, but it can be seen in the XML file.

Control Panel

Parameters

Attribute

Description

Required

Name Name of the transaction controller Yes
Sample

If the point, the transaction sampler acts as the parent sampler for its down sampler

Otherwise, it is added as an additional sampler behind the sub-sampler

Yes

Example

1 users,1 loops are set in a thread group.

1.Generate If the Parent sample is not selected, the Aggregate report is displayed as

The data collected by the transaction sampler is ranked after the sub-sampler data, and the data of each column is slightly larger than the sum of the sub-sampler data.

2.Generate when the Parent sample is selected, the Aggregate report is displayed as

Only the data collected by the transaction sampler is displayed, not the data collected by the sub sampler.

7, alternating controller one pass a sub-request to this test, according to the order of sub-components

8, only once controller this controller can ensure that the thread in the case of multiple cycles run only once

9. Throughput Controller

10, if the (if) controller in the "Conditions:" Fill in the judging conditions to perform

When doing similar memory audits and long SQL audit tests, it is often necessary to test various types of SQL statements, and if a test plan is a bit too cumbersome for each SQL statement, here we can use if (if) logical controllers to implement various SQL controls.

As an example of a long SQL audit test, we need to simulate the audit tests for long SQL, short SQL, and mixed-length SQL, where we can set up 2 user variables and an if controller.

The variable longsql is used to control whether the JDBC request for long SQL is executed, Shortsql is used to control whether the JDBC request for short SQL is executed, and the If controller is inserted on each SQL corresponding JDBC request, as shown in

"${shortsql}" = = "true": executes when the value of the variable shortsql is true

"${shortsql}"! = "true": executes when the value of the variable shortsql is not true

11, recording controller we use the JMeter itself to record the script with the controller

12, loop controller the request under this controller can be executed in a loop

13. Module Controller Test a module

14, simple controller , the most basic controller, there is no additional role, can be used to name some operations

15. Random Controller JMeter may randomly pick a request

16, random order controller sub-nodes are all executed, but the order is random

http://blog.csdn.net/blueskylcc/article/details/37657967

Jemeter Logic Controller

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.