当前位置:网站首页>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/ucowsIt is used to release the development to the production environment
Dev:
http://123.206.191.125/ucowsFor online during development Development Test environment for
LocalTest:
http://192.168.0.140:80/ucowsIt 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 :

边栏推荐
- CDZSC_ 2022 winter vacation personal training match level 21 (1)
- Bit operation ==c language 2
- ISP、IAP、ICP、JTAG、SWD的编程特点
- Codeforces - 1324d pair of topics
- Bean 作⽤域和⽣命周期
- “十二星座女神降临”全新活动推出
- Deconvolution popular detailed analysis and nn Convtranspose2d important parameter interpretation
- Pit encountered by vs2015 under win7 (successful)
- 企业实战|复杂业务关系下的银行业运维指标体系建设
- In addition to the objective reasons for overtime, what else is worth thinking about?
猜你喜欢

ORM--分组查询,聚合查询,查询集QuerySet对象特性

小程序弹出半角遮罩层

Video based full link Intelligent Cloud? This article explains in detail what Alibaba cloud video cloud "intelligent media production" is

Applet sliding, clicking and switching simple UI

web3.0系列之分布式存储IPFS

STM32中AHB总线_APB2总线_APB1总线这些是什么

Google colab loads Google drive (Google drive is used in Google colab)

Basic chapter: take you through notes

Postman interface test I

Some thoughts on the testing work in the process of R & D
随机推荐
内存==c语言1
Garbage disposal method based on the separation of smart city and storage and living digital home mode
Future development blueprint of agriculture and animal husbandry -- vertical agriculture + artificial meat
Guys, have you ever encountered the case of losing data when Flink CDC reads mysqlbinlog? Every time the task restarts, there is a probability of losing data
Introduction to automated testing framework
Software modeling and analysis
Codeforces - 1324d pair of topics
Deep understanding of UDP, TCP
小程序弹出半角遮罩层
视频化全链路智能上云?一文详解什么是阿里云视频云「智能媒体生产」
为什么安装mysql时starting service报错?(操作系统-windows)
Or in SQL, what scenarios will lead to full table scanning
ORM model -- associated fields, abstract model classes
The combination of over clause and aggregate function in SQL Server
大佬们,有没有遇到过flink cdc读MySQLbinlog丢数据的情况,每次任务重启就有概率丢数
Sqlplus garbled code problem, find the solution
Enterprise practice | construction of banking operation and maintenance index system under complex business relations
14th test
【原创】程序员团队管理的核心是什么?
Wallys/IPQ6010 (IPQ6018 FAMILY) EMBEDDED BOARD WITH ON-BOARD WIFI DUAL BAND DUAL CONCURRENT