Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How does Jmeter get the parameter values returned by the interface?

2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly explains "how to get the interface return parameter value of Jmeter". The content of the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how to get interface return parameter value of Jmeter".

1. This sharing outline

Two methods of obtaining parameter values in API Response by Jmeter

Detailed explanation of the use of the two methods

Example demonstration

2. Two methods of obtaining parameter values in API Response by Jmeter

Regular expression extractor

JSON extractor

3. Use the regular expression extractor to explain in detail

Reference name: the name of the variable to be passed next time

Regular expressions: regular expressions obtained from the input gadget

Template: if the regular expression has more than one extraction result, the result is in the form of an array, template $1 $, $2 $, and so on, indicating that the parsed value is assigned to the variable; match from 1, and so on.

Matching numbers (0 for random): the result of regular expression matching data can be seen as an array indicating how to take a value: 0 represents a random value, and a positive number n represents the nth value (for example, 1 represents the first value). A negative number means to extract all values that meet the criteria.

Default value: the default value when the match fails; it is usually used for subsequent logical judgments, usually a combination of English capitals with a specific meaning, such as ERROR, etc.

3.1. regular expression gadget-Regester

Copy the content of the API return value to the source text in the Regester tool, enter the regular expression, and output the result.

4. Detailed explanation of the use of JSON extractor

Names of created Variables: the name of the variable referenced by the next pass parameter

JSON Path expressions:JSON expression, based on the returned value, layer by layer

Match No: which match can be left empty, that is, the first one by default

Default Value: default value when no value is obtained

5. Example illustration

5.1, user-defined variables

Get the current timestamp: use the Jmeter function helper _ _ time

5.2. Default value of HTTP request

5.3. HTTP request instance

5.4 、 Debug Sampler

6. Download address of Jmeter scripts and gadgets:

Regester V1.0.9.0 version:

Https://pan.baidu.com/s/1vwqbhke_f275TiJAWzjPEg extraction code: ijq4

Example script:

Https://pan.baidu.com/s/1gJy5lnnH4miG7OEqOlEaxw extraction code: rqgn

Thank you for your reading. the above is the content of "how to obtain the return parameter value of the interface by Jmeter". After the study of this article, I believe you have a deeper understanding of the problem of how to obtain the return parameter value of the interface by Jmeter, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report