In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
It is believed that many inexperienced people have no idea about the method of correlation testing for postman interface. Therefore, this paper summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.
Application scenario
Suppose the next interface login requires the return value of the previous interface. For example, a request needs to log in to obtain the token, and the next request must carry the corresponding token before the request can be made.
Method: by setting global variable / environment variable method 1: setting global variable
1. First request the login API. If the request is successful, return the corresponding token
two。 Set global variables through js under tests after the corresponding first step request is successful
# get the return value of the API var jsonData = JSON.parse (responseBody); # obtain the corresponding value according to your own API result level and set it to the global variable pm.globals.set ('access_token',jsonData.access_token)
After the request is set successfully, you can view the value of the global variable here
3. Send a second interface request, which can refer to the set global variable by {{access_token}}
Method 2: environmental variables
1. Add environment variabl
two。 Select the name of the environment variable and send a request to get token
Var jsonData = JSON.parse (responseBody); / / Environment variable assignment. Hh is my name. You can name it pm.environment.set ("hh", jsonData.access_token).
3. After sending the message successfully, you can see that the token value has been set successfully.
3. Select the same environment variable name, fill in the parameter name {{hh}} you just set, and send the request.
After reading the above, have you mastered the method of postman interface to do correlation testing? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.