PostMan工具使用之基础篇
一.什么是PostMan
Postman一款非常流行的API调试工具。(其他测试工具 Jmeter、soapUI)
二.下载及安装:
1.下载:
下载地址:https://www.getpostman.com/apps
2.安装:
Postman最早是作用chrome浏览器插件存在的,所以,你可以到chrome商店搜索下载安装,因为重所周知的原因,所以,大家都会找别人共享的postman插件文件来安装。由于2018年初Chrome停止对Chrome应用程序的支持。
Postman提供了独立的安装包,不再依赖于Chrome浏览器了。同时支持MAC、Windows和Linux,推荐你使用这种方式安装。https://www.getpostman.com/apps
三.接口测试:
1.get请求:
效果图:
地址:http://192.168.31.44:8010/api/User/GetUserInfo
参数:UserId
返回值:
{ "code": 0, "msg": "获取成功", "count": 0, "data": { "UserId": "24d15068-3b9e-457a-bf10-dad2d1cfc19d", "Account": "system", "Email": "[email protected]", "Password": "22683791e7ce25b86177b10f51c9bfe9", "Secretkey": "cb90d66de12743feed1dd79430d5eab2", "RealName": "系统管理员", "Gender": 1, "HeadIcon": null, "Phone": "13246763302", "Tel": null, "OrganizeId": "00000000-0000-0000-0000-000000000000", "RoleId": null, "DeleteMark": 0, "EnabledMark": 1, "Description": "平台超级管理员", "LastVisitTime": "2018-09-28 11:16:40", "SuperUserMark": 1, "CreateTime": null, "CreateUserId": null, "CreateUserName": null, "ModifyTime": null, "ModifyUserId": null, "ModifyUserName": null, "RoleName": null, "OrganizeName": null, "GenderFormat": "男" } }
2.post请求:
效果图:
地址:http://192.168.31.44:8010/api/Login/CheckLogin
参数:
{
"Account":"zlp", "Password":"123" }
返回值:
{
"code": 0, "msg": "登录成功", "count": 0, "data": { "User": { "UserId": "39a0645b-eb55-45e1-ba85-49efb6624958", "Account": "zlp", "Email": "[email protected]", "Password": "22683791e7ce25b86177b10f51c9bfe9", "Secretkey": "cb90d66de12743feed1dd79430d5eab2", "RealName": "张立平", "Gender": 1, "HeadIcon": "sample string 7", "Phone": "17791294367", "Tel": "13302584563", "OrganizeId": "d4929e06-f7a1-412b-8fc4-4f113654be0d", "RoleId": "1", "DeleteMark": 0, "EnabledMark": 1, "Description": "测试用户", "LastVisitTime": "2018-09-28 13:37:49", "SuperUserMark": 1, "CreateTime": "2018-09-18 10:38:52", "CreateUserId": "sample string 13", "CreateUserName": "sample string 14", "ModifyTime": "2018-09-26 21:12:11", "ModifyUserId": "39a0645b-eb55-45e1-ba85-49efb6624958", "ModifyUserName": "张立平", "RoleName": null, "OrganizeName": "陕西制药厂", "GenderFormat": "男" } } }
四.认证接口测试:
和普通测试基本一样,唯一的就是设置