Jmeter- regular extractor

Postprocessor - extractor
conventional extractor:
. A regular extractor format applies to all the returned
b.json extracted applies only to return data format is json
c boundary value extractor for all returned. format
d.Xpath extractor applies only to the return of data format or html xml format
functions: generally do interface testing time, especially the need to use data across an interface on an interface, then we need to use extractor to extract the data we need, and then used for the next interface, in fact, when the need to use dynamic association.
How to use extractor:
. A first we must find out the contents to be extracted and where? Response header, in response to extracting data body
b. If the data is extracted from the response body, then returned to find out what the format of the data
  extraction to achieve data for return data in different formats, different extractor.

 

In this field value extracted as an example in FIG.

1, Add -> postprocessor -> regular expression extractor

 

To check the response field: where to extract data from

Reference name: variable name from here, such as the HTTP request, refer to this data, the name of the need to use
regular expressions: the need for data is extracted, "key": "(. ? *)", extract the left is the "key": ", the right is" data, save extracted data into a variable
template: Indicates extracted the first several values
$ 1 $: that take the first 1
$ 2 $: that take the second
so: $ n $: represents taking the n-th
matching digits (0 represents a random): 0 represents a random value, a value representing the entire
default: if the regular expression is not found found value, then this default value is
2, Add -> sampler -> debug sampler
debug debugger, to help make debugging of

 

3, view the results tree

 

Note: "totalNum": "(*.?)", My response time data replication: There is a space after the number, but it has failed to extract, delete the space before they succeed




Guess you like

Origin www.cnblogs.com/peiya/p/12623306.html