How to extract and reference Token with Jmeter

 1. Execute the token acquisition interface

Here in the result tree, use the $ symbol to extract the token value.

$root node, $.data.token means to extract the value of the token node under the data node under the root node.

 

2. Use the json extractor to extract the token

The variable path is to write the path extracted in the result tree.

 

3. Use the BeanShell sampler or BeanShell post-processing program to set the token as a global variable

Tool--function assistant, use the function __setProperty to set the obtained parameters as properties.

 

4. Directly refer to the token in other interfaces

Tool--function assistant, use the function __P to call the jmeter attribute to get the attribute value.

Bearer should be added in front of the quoted token, and spliced ​​​​with the following token (it has not been successful before, and then used postman to find that the automatically generated token will be automatically added, here is added manually, and the result is fine), check Said it was for specification..

 

Finally, I would like to thank everyone who has read my article carefully. Reciprocity is always necessary. Although it is not a very valuable thing, you can take it away if you need it:

 These materials should be the most comprehensive and complete preparation warehouse for [software testing] friends. This warehouse has also accompanied tens of thousands of test engineers through the most difficult journey, and I hope it can help you! Partners can click the small card below to receive

 

Guess you like

Origin blog.csdn.net/hlsxjh/article/details/131773378