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.


相关文章
|
JSON Dubbo 测试技术
逐步教你如何在Postman中导入Swagger API
在现代软件开发中,Swagger 和 Postman 作为 API 设计、开发和测试的利器,都被广泛应用。可以将 Swagger 定义的 API 导入到 Postman 中,充分利用 Postman 强大的测试特性对接口进行深入测试。
|
API 对象存储
postman导出api文档
postman导出api文档
533 0
|
4月前
|
人工智能 数据可视化 测试技术
Postman 性能测试教程:快速上手 API 压测
本文介绍API上线后因高频调用导致服务器告警,通过Postman与Apifox进行压力测试排查性能瓶颈。对比两款工具在批量请求、断言验证、可视化报告等方面的优劣,探讨API性能优化策略及行业未来发展方向。
Postman 性能测试教程:快速上手 API 压测
|
6月前
|
JSON JavaScript 测试技术
用Postman玩转电商API:一键测试+自动化请求教程
Postman 是电商 API 测试的高效工具,涵盖基础配置、自动化测试、环境管理与请求自动化,助你快速提升开发效率。
|
9月前
|
数据可视化 测试技术 API
JMeter、Apipost 与 Postman 的 API 测试对比:为什么 APIPost 是更聪明的选择
API测试如同筹备一场晚宴,选对工具至关重要。JMeter功能强大但上手难,适合专业用户;Postman简单易用,但在复杂场景和团队协作中表现有限;而Apipost则是一款智能高效的“厨房神器”。它性能测试轻松、结果清晰、学习门槛低,并且能一键集成CI/CD流程。对于追求效率与便捷的团队而言,Apipost无疑是更优选择,让API测试如同五星大厨烹饪般丝滑流畅。
|
9月前
|
存储 前端开发 数据可视化
Postman vs. Apifox 用于 API 测试全面对比
寻找一款可靠的 API 测试工具?这份对比分析将深入探讨 Postman 和 Apifox 的功能和特性。了解哪款工具最适合您的 API 测试需求。
|
9月前
|
监控 安全 测试技术
选择Postman免费版还是付费版,进行 API 测试呢?
深入了解 Postman 免费版和付费版的细节,看看哪一个更适合您的 API 需求。
|
10月前
|
网络协议 API 开发者
深入解密 :Postman、Apipost和Apifox API 协议与工具选择
作为全栈开发者,每天与API打交道是常态。本文总结了多年经验,深入解析常见API协议(HTTP(s)、SSE、gRPC、WebSocket、Socket.IO)及其适用场景,并对比三款主流调试工具(Postman、Apipost、ApiFox)。从基础特性到高级应用,帮助开发者根据需求选择最优方案,提升效率,让开发更顺畅!
|
11月前
|
JSON 前端开发 API
以项目登录接口为例-大前端之开发postman请求接口带token的请求测试-前端开发必学之一-如果要学会联调接口而不是纯写静态前端页面-这个是必学-本文以优雅草蜻蜓Q系统API为实践来演示我们如何带token请求接口-优雅草卓伊凡
以项目登录接口为例-大前端之开发postman请求接口带token的请求测试-前端开发必学之一-如果要学会联调接口而不是纯写静态前端页面-这个是必学-本文以优雅草蜻蜓Q系统API为实践来演示我们如何带token请求接口-优雅草卓伊凡
643 5
以项目登录接口为例-大前端之开发postman请求接口带token的请求测试-前端开发必学之一-如果要学会联调接口而不是纯写静态前端页面-这个是必学-本文以优雅草蜻蜓Q系统API为实践来演示我们如何带token请求接口-优雅草卓伊凡
|
10月前
|
数据可视化 JavaScript 前端开发
利用Postman和Apipost进行API测试的实践与优化-动态参数
在API测试中,Postman和Apipost是常用的工具。Postman内置变量功能有限,面对复杂场景时需编写JavaScript脚本,增加了维护成本。而Apipost提供丰富的内置变量、可视化动态值配置和低代码操作,支持生成真实随机数据,如邮箱、手机号等,显著提升测试效率和灵活性。对于复杂测试场景,Apipost是更好的选择,能有效降低开发与维护成本,提高测试工作的便捷性和可维护性。