当前位置:网站首页>Interface test tool - postman
Interface test tool - postman
2022-07-06 19:00:00 【Another piece of braised meat】
Navigation
Why do we need interface testing tools
web There are many kinds of interfaces , such as Restful、Hessian、WebService wait , Those who have good development skills , Can build a project , With the help of HttpClient、WebResource、HessianProxyFactory Wait for the third party jar package , Even RestAssuerd Other framework , To realize the call of the interface .
Develop code to call interfaces , Has its advantages : Extensibility is strong 、 It can be more easily integrated into CI/CD In the process ; But its shortcomings are also obvious : More trouble . If you just need to call it quickly everyday , When testing its connectivity and other scenarios , Write a large string of code and wait for the project to compile 、 perform , Is too slow .
In daily work , In order to call the interface more conveniently and quickly , For example, some get Requested interface , I often call directly in the browser . But for more complex requests , Browsers are obviously not enough , So at this time, we need to call tools with the help of interfaces .Postman It is an interface calling tool , It is mainly used to simulate sending all kinds of HTTP request .
Postman install
Postman The installation of is relatively simple , It can be roughly divided into two installation methods :
1. Install to local application :
Go to Postman Official website , Download the installation program of the corresponding system , Complete the installation .2. With Chrome Plug in installation :
stay Chrome Browser , Found in the market of extension programs postman plug-in unit , Can be installed . You can also download the plug-in package , Install by local import .
The first method is more recommended , Install to local application . It is more convenient to manage the request collection 、 Custom request header 、 Check the history and so on .
Postman Basic operation

1. aggregate
On the left navigation bar ,Cllections The tab is the set management menu .Postman Collection management of , It's a directory structure , A set can be understood as a folder , And a request is a file . With the collection , We can put the same type of requests under a set , Easy to view .
Support to continue to add multi-level folders under the collection , This can make the hierarchical management of the interface clearer .
2. request
Postman The request in must be added under the set , And support all kinds of request methods .
After we create the request , Fill in the complete URL, And according to the interface input requirements , Fill in the request parameters .
stay Headers Under the tag, you can edit the data of the request header .
Body Various input formats are provided under the label , Support all kinds of common, such as web Forms form-data Format , And in raw Under Options JSON、XML Input parameters in equal format .
And can be found in Authorization Configure authentication information . And in the upper right corner Cookies in , Provides Cookies management function .

After filling in the request information , Just click on the Send Button , Then a request will be made , And get the response . The response information will be displayed below .
You can see the response status code in the upper right corner 、 Response time 、 Basic information such as response size .
And provides a variety of response body parsing methods , stay Pretty Next , The response message can be JSON\XML\HTML And other forms of beautification .
If the response is HTML Content , You can also do it in Preview Preview the rendering results .
3. environment variable

To make the request more flexible ,Postman It also provides the operation of variables . For example, when the input parameters of multiple requests need to be modified at the same time , Are assigned with variables , Then modify the environment variable , You can complete all the modifications .
There are two kinds of variables : Global variables (Globals)、 environment variable (Environment). Environment variables can rewrite and overwrite global variables , If there is no , Then the value in the global variable will be used .
When using variables , use { { Variable name }} Such a format is sufficient .

4. random number
With variables, we can't meet the changing needs , For example, when testing the payment interface , The serial number is unique every time , In this case , Use Postman Three random numbers provided , It can be well solved .
Postman There are three random number methods :
{ {$timestamp}}: The current timestamp , Accurate to seconds{ {$randomInt}}:0 and 1000 Random integer between{ {$guid}}:V4 style GUID
Postman Scripting and continuous integration
Postman Support JavaScript, Can be in Tests Write scripts and assertions under the column , It will be executed before and after the request runs .
Postman Of Linux edition :Newman, You can run and test... Directly from the command line Postman aggregate . In this way, it can be integrated into Jenkins In the process , adopt shell Call the script to execute .
Automation of interface testing , I prefer to build Java or Python Engineering to achieve , So for Postman The application of this aspect will not be studied in depth for the time being , If necessary in the follow-up .
边栏推荐
- 根据PPG估算血压利用频谱谱-时间深度神经网络【翻】
- 线代笔记....
- Using block to realize the traditional values between two pages
- If you have any problems, you can contact me. A rookie ~
- The dplyr package of R language performs data grouping aggregation statistical transformations and calculates the grouping mean of dataframe data
- R language ggplot2 visualization: use ggviolin function of ggpubr package to visualize violin diagram
- R语言使用order函数对dataframe数据进行排序、基于单个字段(变量)进行降序排序(DESCENDING)
- 被疫情占据的上半年,你还好么?| 2022年中总结
- R语言ggplot2可视化时间序列柱形图:通过双色渐变配色颜色主题可视化时间序列柱形图
- 人体骨骼点检测:自顶向下(部分理论)
猜你喜欢

Unlock 2 live broadcast themes in advance! Today, I will teach you how to complete software package integration Issues 29-30

Word如何显示修改痕迹

ORACLE进阶(四)表连接讲解

抽象类与抽象方法

About static type, dynamic type, ID, instancetype

应用使用Druid连接池经常性断链问题分析

监控界的最强王者,没有之一!

Meilu biological IPO was terminated: the annual revenue was 385million, and Chen Lin was the actual controller

Understanding disentangling in β- VAE paper reading notes
![Airiot IOT platform enables the container industry to build [welding station information monitoring system]](/img/52/88e3c7b7a60867282921d9bb5c96da.jpg)
Airiot IOT platform enables the container industry to build [welding station information monitoring system]
随机推荐
Hongke shares | plate by plate ar application in Beijing Winter Olympics
SQL injection - access injection, access offset injection
10、 Process management
Breadth first traversal of graph
Reptiles have a good time. Are you full? These three bottom lines must not be touched!
Abstract classes and abstract methods
R language ggplot2 visualization: use the ggstripchart function of ggpubr package to visualize the grouped dot strip plot, and set the add parameter to add box plots for different levels of dot strip
二叉搜索树
ROS自定义消息发布订阅示例
视频化全链路智能上云?一文详解什么是阿里云视频云「智能媒体生产」
About NPM install error 1
Penetration test information collection - WAF identification
Handwritten online chat system (principle part 1)
Stm32+esp8266+mqtt protocol connects onenet IOT platform
There is a sound prompt when inserting a USB flash disk under win10 system, but the drive letter is not displayed
The dplyr package of R language performs data grouping aggregation statistical transformations and calculates the grouping mean of dataframe data
巨杉数据库首批入选金融信创解决方案!
Summary of performance knowledge points
Use cpolar to build a business website (1)
青龙面板最近的库