Jmeter- post-processor (Json extractor)

Postprocessor -json extractor

Concept: As the name suggests, data extractor to extract data json response;

Step: sampler- post processor -jsonextractor

1. The single parameter extraction

1.Variable name: when the custom parameter name, format referenced $ {}

2.Json path expression: json expression, according to the above json, the expression is:

$.errorCode

3. The following parameters of the interface when referenced directly $ {Variable name}

 

Analysis of this json:

1. We want to get above errorCode: Format is $ .errorCode

2. If I want to get data {} in the orderNo how to write it: [.] Analyzes $ json format is followed by extraction parameters, OrderNo is wrapped in data, the data is wrapped in a result where we layer by layer location: $ result.data [0] .orderNo. 

-> Why should we increase [0]?

The following first data section than JSON, there may be many, we are targeting a first section, which is an array, so that taking the first index [0], if the second subscript is taken [1] and so on .

 

Extracting a plurality of parameters 2

1. Obtain a number of variables, variable names should play a more custom variables, separated by semicolons

2. Json path expression: get json of expression, access to several write a few, separated by semicolons, and above the variable name is the corresponding;

3. Default values: help documentation, I think the meaning is: We customize a default value if there is no match, Jmeter will return the default value to us, and, if more than one variable to extract worthwhile, then, use the semicolons intermediate [;] apart, the representative value of the corresponding variable parameter;

Jmeter original document: Semi-Colon Separated default values ifJSON-the PATH Expressions do not return the any the Result (the MUST Number The match of the Variables)
---------------------
Author: Flury
source: CSDN
original: https: //blog.csdn.net/WANGtesting/article/details/80540775
copyright: This article is a blogger original article, reproduced, please attach Bowen link!

 

Guess you like

Origin www.cnblogs.com/python-xiakaibi/p/11205044.html