![775d24c114225c295ce41040c0a66c91.png](https://img-blog.csdnimg.cn/img_convert/775d24c114225c295ce41040c0a66c91.png)
投票看看你的同伴有多少人。下面我们一一分析小编实际体验的感受(基本功能的使用),挑选出适合自己的,才是最好的!
1、Postman / Postwoman
① Postman 客户端
![f43f82a0801b4b35e5a9b5128e38f832.png](https://img-blog.csdnimg.cn/img_convert/f43f82a0801b4b35e5a9b5128e38f832.png)
体验后的感觉
① 模拟各种 Htpp,Https请求,支持 header 参数,例如添加 token 信息;
② 在屏幕左侧,支持文件夹,一个文件夹可以保存多个 request 请求,支持分享,导出,支持手动排序
③ 支持搜索接口,缺点是搜索的是历史记录,无法定位到文件夹
④ 可以设置变量参数,很方便,使用{{url}},避免重复造轮子,不然谁记得一长串域名和 ip 地址
⑤ 接口响应接口,json 数据展示美化,避免一长串挤在一起
⑥ 支持批量测试
⑦ 同步在线,防丢失
基本操作不作赘述,聊下大家可能用的比较少的场景
【批量测试】
比如你要批量生成数据,一个个点是很笨的方法,postman 会怎么做呢?
a.在“Tests”下写断言,可以通过右侧自动生成,然后酌情修改,记得一定要保存,不要最后问我为什么批量没有生效;
![7fc2c81eb1b983784f1d4e3e74cc4f33.png](https://img-blog.csdnimg.cn/img_convert/7fc2c81eb1b983784f1d4e3e74cc4f33.png)
b.在对应的 Collections 下按下图点击“Run”,差评,再弹出一个界面
![c1c0c7d4c43c4b1e9ff680cd10e75aa2.png](https://img-blog.csdnimg.cn/img_convert/c1c0c7d4c43c4b1e9ff680cd10e75aa2.png)
c.勾选你要选择的
![0206dbd2b01f43fe69a653b7db69d211.png](https://img-blog.csdnimg.cn/img_convert/0206dbd2b01f43fe69a653b7db69d211.png)
d.执行结果界面
![a727afaf9610da525349305d7474c800.png](https://img-blog.csdnimg.cn/img_convert/a727afaf9610da525349305d7474c800.png)
【批量测试(改进版)】
看了上面的 ,大家可以已经发现,批量测试的都是重复数据,实际情况,我们需要不同的数据支持。Postman 如何解决呢?
未修改前:
![ead5f72c015adbc90ab137a8210d7f14.png](https://img-blog.csdnimg.cn/img_convert/ead5f72c015adbc90ab137a8210d7f14.png)
修改后:
![6cac2e5de2a5e69c5445c4251540b951.png](https://img-blog.csdnimg.cn/img_convert/6cac2e5de2a5e69c5445c4251540b951.png)
编辑 csv 或者 json 文件,按前面操作,导入文件
![d38a5d683b80100cd390ae91e1a51aa4.png](https://img-blog.csdnimg.cn/img_convert/d38a5d683b80100cd390ae91e1a51aa4.png)
输出结果:
![904eb34a634fd0b5f6b85839ea8455c5.png](https://img-blog.csdnimg.cn/img_convert/904eb34a634fd0b5f6b85839ea8455c5.png)
【接口依赖】
我们应该会遇到这样的场景,某个接口依赖于另一个接口的参数,比如登录接口需要发送验证码接口返回的数据,下单接口需要登录的 token 信息等,面对这种情况,Postman 如何应对?
a.将返回结果中的 token 信息放到环境变量中
![1e13bc86529aa8fb0725f90fc3a24c30.png](https://img-blog.csdnimg.cn/img_convert/1e13bc86529aa8fb0725f90fc3a24c30.png)
b.参数从环境变量中获取,从测试中可以看出参数值生效
![630b4965f55034c45ab9a30e76ee1f9a.png](https://img-blog.csdnimg.cn/img_convert/630b4965f55034c45ab9a30e76ee1f9a.png)
@Python大星 评价:90 分
2、Postman 的对象 Postwoman 了解一下
相比较于 Postman,是一个用于替代 Postman,免费开源、轻量级、快速且美观的 API 调试工具。能帮助程序员节省时间,提升工作效率。Postwoman 没有客户端,下面展示如何在浏览器中使用
① 下载
用国内网址下载:http://postwoman.cn/
![48bd61c4f48b61be7207405bef81782b.png](https://img-blog.csdnimg.cn/img_convert/48bd61c4f48b61be7207405bef81782b.png)
下拉到下面底部
![269a8c6eebfc98c750286ddc859dcffb.png](https://img-blog.csdnimg.cn/img_convert/269a8c6eebfc98c750286ddc859dcffb.png)
下载后解压
![4b9722814caa9b760c1265b8ade7d8e8.png](https://img-blog.csdnimg.cn/img_convert/4b9722814caa9b760c1265b8ade7d8e8.png)
![cf401604bf37524e530143c8292b3d69.png](https://img-blog.csdnimg.cn/img_convert/cf401604bf37524e530143c8292b3d69.png)
打开 Chromn >> 扩展程序 >> 加载 Postwoman 解压文件
![9d0c1ebc01e7d6f54b4ed8bb1e9fbf90.png](https://img-blog.csdnimg.cn/img_convert/9d0c1ebc01e7d6f54b4ed8bb1e9fbf90.png)
点击小图标即可打开
![feebb51e501c8969232849fa40450379.png](https://img-blog.csdnimg.cn/img_convert/feebb51e501c8969232849fa40450379.png)
可以使用 Github 账号登录
![83c329e1edb20c131464e9b2b007cd3d.png](https://img-blog.csdnimg.cn/img_convert/83c329e1edb20c131464e9b2b007cd3d.png)
注意:离线无法使用,最多支持 10 项目,一个项目下可以建立多个模块
![ef0d9846735f7c47cf8fa2ccd1712ffb.png](https://img-blog.csdnimg.cn/img_convert/ef0d9846735f7c47cf8fa2ccd1712ffb.png)
![aeab64a2dd1cd7a357e93e7e83ed8231.png](https://img-blog.csdnimg.cn/img_convert/aeab64a2dd1cd7a357e93e7e83ed8231.png)
页面美观大方,使用方便,不需要重新启动客户端,功能比 postman 略有不足,不能测试本地接口,差评。
可以在 github 下载 postwoman vue 项目,本地访问后使用。
@Python大星 评价:80 分
3、ApiPost
![1a72abd0dc4a37e41ee72749cf77a047.png](https://img-blog.csdnimg.cn/img_convert/1a72abd0dc4a37e41ee72749cf77a047.png)
① 界面
暗黑模式的皮肤太棒了
![a68c80fae2b476f7cc21524f67f9f0d7.png](https://img-blog.csdnimg.cn/img_convert/a68c80fae2b476f7cc21524f67f9f0d7.png)
② 接口
![2220d5e33484f9f02500465efca9cd5d.png](https://img-blog.csdnimg.cn/img_convert/2220d5e33484f9f02500465efca9cd5d.png)
③ 分享生成在线文档
![28e7dc48eaf3ac408caa27ccdb030962.png](https://img-blog.csdnimg.cn/img_convert/28e7dc48eaf3ac408caa27ccdb030962.png)
打开分享的地址
![46f054f06e29c110db9b69c2e7e0d505.png](https://img-blog.csdnimg.cn/img_convert/46f054f06e29c110db9b69c2e7e0d505.png)
@Python大星 评价:95 分
4、Python 等其他脚本
以下以 Python 举一个例子,不做多概述,如果对 Python 不熟悉,可以翻看 @Python大星 以往文章,关于request 库非常详细>>>
《request 的基本使用》
![5dd57a392c0a5394b8cbb8f63e9465a9.png](https://img-blog.csdnimg.cn/img_convert/5dd57a392c0a5394b8cbb8f63e9465a9.png)
![3123620ed9853f1fdbf36432d7ba49b3.png](https://img-blog.csdnimg.cn/img_convert/3123620ed9853f1fdbf36432d7ba49b3.png)
@Python大星 评价:85 分
关于其他的测试接口的方法,如 fiddler(上一篇有讲),idea 中的测试可以当做临时使用,关于单元测试后面会单独抽一篇详细描述。
程序员:服了!移动端测试不会自己抓包,提什么 bug
欢迎关注 @Python 大星 ,一个会点 Python 的 Java 程序员。如果你有更好的想法,欢迎留言,一起探讨,想说你就说啊!后面继续分享 Java 的相关开发,人少就散了吧!
@Python 大星 | 文
![43799e4ea9f8c9a10dfffe6f2de4d04e.png](https://img-blog.csdnimg.cn/img_convert/43799e4ea9f8c9a10dfffe6f2de4d04e.png)