当前位置:网站首页>Postman interface test IV
Postman interface test IV
2022-07-07 10:09:00 【Splendid Qianyang 813】
Catalog
Other easy-to-use functions and tools
Use environment variables to realize multi server version
Postman Support with Environment Environment variable to implement multi server version
Other easy-to-use functions and tools
grouping Collection
At the beginning of a project , For the convenience of organization and management , Multiple projects belonging to the same project API, Put it in a group
So we have to build a new one first Collection: New -> Collection
After a period of use , Built the effect of multiple groups :
The effect of expanding a single group :
Historical record History
Postman Support history Historical record , Show recently used API:
Use environment variables to realize multi server version
Existing problems
In the test API period , There are often multiple environments , Corresponding IP Address ( Or domain names )
such as :
Prod:
http://116.62.25.57/ucows
It is used to release the development to the production environment
Dev:
http://123.206.191.125/ucows
For online during development Development Test environment for
LocalTest:
http://192.168.0.140:80/ucows
It is used for the local environment in the local LAN to cooperate with background developers during development , For joint debugging API Interface
While testing API period , It often needs to be modified manually API The address of :
Low efficiency , And after the address is changed, the address cannot be retained .
in addition , And according to different IP Address ( Or domain name ) It's not easy to identify which environment it is .
Postman Support with Environment Environment variable to implement multi server version
It turned out Postman in , Yes Environment and Global Variable, To solve this problem , Realize the management of different environments :
Obviously , Can be used to achieve without manual modification url Server address in , So as to dynamically realize , Support different server environments :
Production Production environment
Development development environment
Local Local LAN environment
How to use Enviroment Implement multi server version
perhaps :
Environments are a group of variables & values, that allow you to quickly switch the context for your requests and collections.
Learn more about environments
You can declare a variable in an environment and give it a starting value, then use it in a request by putting the variable name within curly-braces. Create an environment to get started.
Input Key and value:
Click on Add after :
[info] Where environment variables can be used
URL
URL params
Header values
form-data/url-encoded values
Raw body content
Helper fields
Write test In the test script
adopt postman The interface of , Gets or sets the value of the environment variable .
Here, put the previous in url Medium IP Address ( Or domain name ) Change to environment variable :
Move the mouse over the environment variable , Can dynamically display specific values :
Then add another development environment :
You can add 2 Environment variables , Indicates two server addresses , Two versions :
Then you can switch between different server environments :
You can see , Same variable server_address, After switching, it corresponds to IP The address becomes the of the desired development environment IP 了 :
Postman export API The effect of multiple environment variables in the document
Take a look by the way , Export to API After the documents , With this Environment Interface of variables , What does the document look like :
The discovery was before the release , You need to select the corresponding environment :
Published documents , You can see the of the selected environment and the corresponding server IP Of :
Of course, after publishing the document , You can also switch the environment in real time :
The benefits of environmental variables
When replacing the server , Directly modify the of variables IP Address :
It can be updated in real time , When the mouse moves over the variable, you can see the effect :
Code generation tool
View the currently requested HTTP Original content
For the current request , You can also click Code
Check the corresponding compliance HTTP The original content of the agreement :
Sample code for various languages Code Generation Tools
such as :
Swift Language
Java Language
Other languages It also supports various other languages :
Currently supported languages are :
HTTP
C (LibCurl)
cURL
C#(RestSharp)
Go
Java
OK HTTP
Unirest
Javascript
NodeJS
Objective-C(NSURL)
OCaml(Cohttp)
PHP
Python
Ruby(NET::Http)
Shell
Swift(NSURL)
The benefits of code generation tools are : Call this... When writing API When the code , You can refer to the corresponding code , Even copy and paste the corresponding code , that will do .
Test interface
After selecting a group , Click on Runner
Select a group and click Run
You can see the test results :
边栏推荐
- 【ORM框架】
- 【原创】程序员团队管理的核心是什么?
- Wallys/IPQ6010 (IPQ6018 FAMILY) EMBEDDED BOARD WITH ON-BOARD WIFI DUAL BAND DUAL CONCURRENT
- request对象对请求体,请求头参数的解析
- 为什么安装mysql时starting service报错?(操作系统-windows)
- Qualifying 3
- Why are social portals rarely provided in real estate o2o applications?
- Gauss elimination
- Application of C # XML
- Parameter sniffing (1/2)
猜你喜欢
随机推荐
CentOS installs JDK1.8 and mysql5 and 8 (the same command 58 in the second installation mode is common, opening access rights and changing passwords)
20排位赛3
[ORM framework]
C# Socke 服务器,客户端,UDP
Integer inversion
ORM模型--数据记录的创建操作,查询操作
哈夫曼编码压缩文件
终于可以一行代码也不用改了!ShardingSphere 原生驱动问世
14th test
剑指 Offer II 107. 矩阵中的距离
ORM -- logical relation and & or; Sort operation, update record operation, delete record operation
There is a problem using Chinese characters in SQL. Who has encountered it? Such as value & lt; & gt;` None`
Memory ==c language 1
Deep understanding of UDP, TCP
VS Code指定扩展安装位置
AI moves from perception to intelligent cognition
反卷积通俗详细解析与nn.ConvTranspose2d重要参数解释
CodeForces - 1324D Pair of Topics(二分或双指针)
The applet realizes multi-level page switching back and forth, and supports sliding and clicking operations
Google colab loads Google drive (Google drive is used in Google colab)