postman postman parameters associated ---

  We do interface testing will encounter when a scene is related parameters associated with the so-called parameter is the return value of a parameter used to request the next parameter by python in requests we know how to request, how to request by postman ?

Parameters related

In the application service interface, the completion of a business function, sometimes one interface may not meet the entire business process logic, you need to use multiple interfaces with, and after the A interface calls, we need to get in return the A interface data required field, and when calling interface B, B as the parameters passed to the interface requests the interface B, the return data to get the subsequent response.

Combat exercises

We query interface or through the weather to complete today the completion of interface requests by postman

Interface documentation:

# Interface address 
http://apis.juhe.cn/simpleWeather/ Query 
# request parameter city: city name to query / the above mentioned id, city names such as: Wenzhou, Shanghai, Beijing, urlencode need utf8 Key: 331eab8f3481f37868378fcdc76cb7cd

1. Create an environment variable, configure the environment variables

Configuration parameter name and value, where the parameter value can not fill, after the implementation of the interface, automatically filled

2. Fill interface content, content to see the return

Here we return to the city to continue to take content

3, the preparation of Test, the return parameters extracted content

This place is a key part of the postman, we introduced Test in front of a function can increase assertion, you can write a script to complete the interface operation. Here we encountered a scripted charge return, and then we want to extract data

var jsonData = the JSON.parse (the responseBody);
 // set the environment variable to return the phone information 
pm.environment.set ( "city" , Jsondata.result.city);
 // extracted parameter data city

 

 Click request interface, we can see the values ​​set environment variables can be found we want to get the value has been successfully collected

4, create another interface to complete the related parameters

Through the above steps, the parameters have been taken out, how this time to associate it? We know that can be assigned by a variable in python, the postman can it? postman has special methods for such

 

 

Through the above chestnuts, we found have completed the associated parameters, but this is just a very small example, we have to understand is how the method of operation, then we linked from complex interface parameters still far away?

 

 

If the quiet blog for your help, can lower right corner followers, if there is a mistake there, or do not understand the place, you can leave a message below, the first time after seeing the reply. Continuously updated ~~~

 

Guess you like

Origin www.cnblogs.com/qican/p/11581404.html