XIV configuration of the counter element

 

1、CSV Data Set Config

This element is used to generate the data parameterization, simple and efficient, easy to generate the number of ordered; New only excel, and then drag and drop, copy, paste, etc. to produce different data, and then to read calls.

But it also has shortcomings, as follows:

① If some fields in some tables in the database do not allow duplicate (such as order number), then after the completion of a test, retest need to re-new unique data manually constructed;

②excel only a digital format can drag and drop data to generate growth;

③ data is too large, easily modified to excel in scientific notation;

2、${_Random}

$ {_ Random} jmeter function is a function which comes assistant, action is to return a random number between a specified minimum and maximum values.

Disadvantages: values ​​may be repeated;

 

If the amount of data need to refer to large, and require or need not repeat increment, it can be implemented using a counter.

Counter (counter): allows users to create a counter within the thread group can be cited.

Counter allows users to configure a starting point, a maximum number of increments, circulated to the maximum, then start again, continue to do so until the end of the test. Long using the stored value of the counter, the range is taken 63--2 ^ 2 ^ 63-1.

1, start JMeter, add thread group, adding configure the right element - a counter

 

 

Counter interface is as follows:

 

 

An initial value (start): given the counter start value, the initial value, the first iteration, the counter will assign that value 

Increment (Increment): After each iteration, to counter the increased value

Maximum value (Maximum): the maximum counter value, and if it exceeds the maximum value, resets to the initial value (the Start), the default maximum value of Long.MAX_VALUE, 2 ^ 63-1 (continued if the measured pressure, best not provided maximum)

Number format:可选格式,比如填写000,格式化为001,002;默认格式为Long.toString(),但是默认格式下,还是可以当作数字使用

引用名称(Reference Name):用于控制在其它元素中引用该值,形式:$(day}

与每用户独立的跟踪计数器(Track Counter Independently for each User):全局的计数器,

如果不勾选,即全局的,设置3个vuser,2次循环,则将生成6个不同的数值;类似于LR中的unique each interation

如果勾选,即独立的,设置3个vuser,2次循环,每个user取值不同:比如vuser1的两次迭代取值依次为1,2,vuser2的两次迭代取值也是1,2。类似于LR中的sequential  each interation

每次迭代重置计数器(Reset counter on each Thread Group Iteration):可选,仅勾选与每用户独立的跟踪计数器时可用;

如果勾选,则每次线程组迭代,都会重置计数器的值(重置为初始值),当线程组是在一个循环控制器内时比较有用。

设置3个vuser,两次循环,则vuser1的两次迭代取值都是1,vuser2的两次迭代取值也都是1。类似于LR中的sequential once

 

2、具体过程

①计数器设置

 

②取样器设置

 

③结果树请求内容

 

 

 

 

从上图可以看出,计数器成功的生成了我们所需的值。

 

Guess you like

Origin www.cnblogs.com/xysun/p/10944950.html