Postman for API Automation Testing Ⅰ

简介: Postman for API Automation Testing Ⅰ

Section 1: Introduction of Postman

What is Postman?

Postman - The Best API tool to develop and test (Manual/Automation) API/Webservices Tests with very minial code in quick and easy way.

Postman comes with powerful JavaScript editor which help us to perform various assertions inside the tool to vaildate Tests.

Postman offers various READY-MADE features of Framework like Variables, Enviroments, Workflows, Data Driven components and PM Object which helps to quickly Setup Automation lab for Testing.

As mention, Postman supports various types of Services like Restful API, Soup Web Services, GraphQL, etc.

Also Postman comes to powerful integration of Newman tool to run the Automated Tests from CLI which can alos be Intergrated with Jenkins for CI/CD Intergration.

Section 2: Installation and Startup

Installation

It's much easy to install the Postman, you can download the App from Postman offical website and double click to install it, Postman support MacOS and Windows. You can also work directly from the web browser. But the only the app got the best exprience,

Startup

Start the Postman, you can work and create your apis and test them without creating an account, you can skip it. But It's strongly recommend to create an account and start working beacuse you can explore a lot of opportunities, all kind of collaboration, sharing you code, putting comments on you code, everything you can do when you officially signed into Postman account.

Follow the steps input you email address and username password. Once you created an account and back to the app, you can see the blow welcome page.

image.png

So first of all, We need to create new workspace, the workspace just like a new project you create at IDEA, you can create lots of workspace and switched them whenever you want.

Just click the Workspaces button and click Create Workspace.

image.png

Postman gives four types of workspaces. You can choose a type depends on you situation。

image.png

After that we can create a collection.

Section 3: Send a Request and Get Response

After lanuch the Postman, the very first thing is "Create collection".

image.png

Collection in Postman is a group that related requests and making them easier to access and run, so that you can put your API requests into a collections of A Application.

image.png

Click "Add a request" then you will see the pad like this.

image.png

So that you can add all your api essential like URL, REQUEST METHOD, REQUEST BODY, HEADER and so on, after this you can click the "Send" buttong and get API RESPONSE bottom of Postman.

Now we gonna use Postman to test Postman API, enter the URL https://api.postman.com/workspaces and click Send button

image.png

Then we got the response and here it is giving some error which is expected a API key.

For create a API key, first we need to click the Settings and it will take us to the browser.

image.png

On the setting page, you can click Generate API Key and name you API Key

image.png

image.png

It would be better to copy your API Key

image.png

Back to the Postman. Add new KEY and VALUE to the HEADERS, the key is "x-api-key" and value are the API key we just copied.

image.png

Click "Send" button and we got the response

image.png

As we can see, there is no more error this time and the responset status are 200 OK, the response body list all the login account's workspace. So now we can understand that the API Key just like a token to show that who you are, then the backend server will send the data according who you are.


相关文章
|
7月前
|
JSON Dubbo 测试技术
逐步教你如何在Postman中导入Swagger API
在现代软件开发中,Swagger 和 Postman 作为 API 设计、开发和测试的利器,都被广泛应用。可以将 Swagger 定义的 API 导入到 Postman 中,充分利用 Postman 强大的测试特性对接口进行深入测试。
|
API 对象存储
postman导出api文档
postman导出api文档
151 0
|
JSON API 数据格式
Postman 导入导出API 的用法
大家好,我是阿萨。昨天学习了如何使用Postman里的collections?关于API 脚本的最基本场景我们就学习完成了。 日常工作中会碰到各种各样的情况需要导入或者导出API。
1122 0
Postman 导入导出API 的用法
|
3月前
|
监控 API 开发工具
探索 Postman:API 开发的瑞士军刀
在现代软件开发中,API 起着关键作用,连接前后端应用及微服务架构。Postman 是一款流行的一站式 API 开发工具,支持 REST、GraphQL 和 SOAP 等协议,具备构建、测试、调试 API 的强大功能,包括请求构建器、环境变量管理、测试脚本编写、文档生成及 Mock 服务器创建等。本文详细介绍 Postman 的核心功能与进阶技巧,助你提高 API 开发效率。
|
4月前
|
API 数据安全/隐私保护 网络架构
【Azure Developer】使用Postman获取Azure AD中注册应用程序的授权Token,及为Azure REST API设置Authorization
【Azure Developer】使用Postman获取Azure AD中注册应用程序的授权Token,及为Azure REST API设置Authorization
|
7月前
|
JSON API 开发工具
如何使用Postman 设计和测试一个API?
如何使用Postman 设计和测试一个API?
112 0
如何使用Postman 设计和测试一个API?
|
7月前
|
JSON JavaScript 测试技术
掌握Postman,开启API测试新纪元!
Postman是一款流行的API测试工具和开发环境,旨在简化API开发过程、测试和文档编制。它提供了一套功能强大的工具,帮助开发人员更轻松地构建、测试和调试Web服务。
|
7月前
|
JSON 测试技术 API
Postman Newman 实现 API 自动化测试的快速指南
Newman 是一款专为 Postman 打造的命令行工具,旨在通过自动运行 Postman 集合和环境,实现 API 测试的自动化。它使得开发者无需打开 Postman 图形界面,即可直接在命令行中执行测试用例。
|
7月前
|
JSON JavaScript 前端开发
提升 API 测试效率:Postman Tests 详解
Postman 不仅是一个强大的 API 开发工具,它还提供了创建自动化测试脚本的能力,这些脚本可以用于检验API请求得到的响应是否符合预期。这些测试脚本被称为 “Tests”,支持使用 JavaScript 编程语言进行编写,并且 Postman 提供了一系列的断言库来帮助你检查包括但不限于状态码、响应内容以及响应时间在内的响应数据。
|
7月前
|
JSON API 数据格式
Postman 导入导出API 的用法
Postman 导入导出API 的用法
833 0