Jmeter the regular expression extractor application

Speaking Jmeter regular expression extractor application, you have to say association. The so-called association, is to return to the dynamic changes in the application of data acquisition to save it as a parameter to provide local'll need later use.

Jmeter by the associated "adding - postprocessor - extractor regular expression" to obtain data, and noted a regular expression attached extractor needs to acquire data under a sampler, the data from the general "Tree View Results "the response data acquisition.

 

First, access to a single data

For example: a list of users as a result, it is necessary to "mobilephone": "158 **** 1763" phone number is used to remove the log-in operation

 

1, a request to add a list of users in the following - a post-processor - regular expression extractor

Regular Expression Extractor Description:

Apply to: Applications

To check the response field: the sample data source.

Reference name: variable name when the rest of the quote, I'm here to write the phone, customizable settings, reference method: $ {name} references

Regular Expressions: data extractor (values in parentheses are for you to get). "mobilephone": "(LR equivalent to the left margin,)", "leaveamount" equivalent LR right border. The brackets \ d + is a regular expression to match the data needs to be acquired, what is meant by the end of the regular expression article will be accompanied by instructions

Template: $$ correspond to the regular expression extractor type. All -1, 0 random, a 2 second 1 second, and so, if only on a regular ships fill $ 1 $

Matching numbers: All the results of the regular expression matching data can be viewed as an array, matching numbers can be seen as the first of several elements of the array. -1 for all, random 0, 1 first, 2 second and so on. If the value as long as the acquisition of the first match, then fill 1

Default: match the default value of failure. You can not write. Request for subsequent determination logic can be simply written as ERROR.

 

2, in the list of users added  Debug PostProcessor  is used for debugging, general view taken for variable values.

From the result of execution, the value obtained can be seen as follows:

3, in the login request, the value will be the regular expression to obtain a reference.

 

 

Second, a plurality of data acquisition

Example: In the results list of users, it is necessary to "id": 82, "mobilephone": "150 **** 7414", the user id, the phone numbers are taken for subsequent log, investment operations

1, pay attention if it contains more regular, we have the following settings

 

Among them, we can see the results by Debug PostProcessor

From the results, if we want to refer to id, mobilephone, then, is here user_g1, user_g4 refer respectively to the value.

2, pay attention to the value of the variable in the login, citing investment request!

 

 

Regular expressions attached description:

 

Popular point of view regular expression is a formula for matching strings. Such as regular expression \ d + is to match one or more consecutive numbers.

 

Guess you like

Origin www.cnblogs.com/youyouyunduo/p/11704941.html