使用抓包工具fiddler和apipost进行接口测试

{"type":"doc","content":[{"type":"heading","attrs":{"align":null,"level":2},"content":[{"type":"text","text":"一、进行接口测试准备的东西"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"1.接口测试工具:apipost、jmeter等"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"2.接口文档,没有接口文档就用接口信息获取工具"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"3.接口信息收取工具:fiddler抓包工具、浏览器开发者工具(f12)等"}]},{"type":"heading","attrs":{"align":null,"level":2},"content":[{"type":"text","text":"二、web接口测试需要获取的东西"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"web接口测试需要知道的三个条件"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"1.请求方式:get、post、put、patch、delete等"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"2.url地址:分为http请求和https是请求,如:"},{"type":"link","attrs":{"href":"https://link.zhihu.com/?target=http%3A//www.baidu.com","title":null},"content":[{"type":"text","text":"http://www.baidu.com"}]},{"type":"text","text":"和"},{"type":"link","attrs":{"href":"https://link.zhihu.com/?target=https%3A//www.baidu.com","title":null},"content":[{"type":"text","text":"https://www.baidu.com"}]}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"3.body传递的参数:一般是以json的格式传递参数如:\"name\":\"xiaoming\",\"pwd\":\"123\"。一般以post传递参数请求为多"}]},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/d5/d5c15b9116689833877cc15e97e15596.png","alt":null,"title":"","style":[{"key":"width","value":"100%"},{"key":"bordertype","value":"none"}],"href":"","fromPaste":false,"pastePass":false}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"heading","attrs":{"align":null,"level":2},"content":[{"type":"text","text":"三、fiddler抓包工具"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"fiddler是由 C# 开发的最强大好用的免费web调试工具之一,可记录所有客户端和服务见的 http 以及 https 请求,可监视设断点,甚至修改输入输出数据,它还包含了一个强大的基于事件脚本的子系统,并且能使用 .net 语言来拓展。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"fiddler就是通过我们对网页的操作使用而进行的接口信息的抓取的。抓取之后按照上面需求的请求方法、url和body来查找需要的数据。"}]},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/48/488d4783d42fba96f0e59d8611f5d2ba.png","alt":null,"title":"","style":[{"key":"width","value":"100%"},{"key":"bordertype","value":"none"}],"href":"","fromPaste":false,"pastePass":false}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"这是一个简单的登录请求被fiddler抓取到的信息,我们可以用到的分别是:"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"1.Protocol请求类型:http或https。这里是http"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"2.host+url两个加起来形成的接口访问地址。这里的请求地址为:"},{"type":"link","attrs":{"href":"https://link.zhihu.com/?target=http%3A//127.0.0.1%3A8888/login","title":null},"content":[{"type":"text","text":"127.0.0.1:8888/login"}]}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"3.Request Haeders(请求头部信息)中的请求方法:get、post等。这里是post请求"}]},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/47/477dc6c86ab5c2d0ac4879b744066504.png","alt":null,"title":"","style":[{"key":"width","value":"100%"},{"key":"bordertype","value":"none"}],"href":"","fromPaste":false,"pastePass":false}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"之后再点击Inspectors中的WebForms查看body参数。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"获取的参数为,参数名:参数值,name:xiaoming,pwd:111"}]},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/3f/3f97d90506dcd6dcda3ea1f6d7640c9e.png","alt":null,"title":"","style":[{"key":"width","value":"100%"},{"key":"bordertype","value":"none"}],"href":"","fromPaste":false,"pastePass":false}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"heading","attrs":{"align":null,"level":2},"content":[{"type":"text","text":"四、接口测试"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"通过fiddler已经收取到这个接口的具体信息之后,我们通过接口测试工具apipost进行接口测试。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"选择请求方法post、请求地址:"},{"type":"link","attrs":{"href":"https://link.zhihu.com/?target=http%3A//127.0.0.1%3A8888/login","title":null},"content":[{"type":"text","text":"http://127.0.0.1:8888/login"}]},{"type":"text","text":"、body参数:name:xiaoming,pwd:111"}]},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/0f/0fa46e7c285aa6aac8ae3384d90d7327.png","alt":null,"title":"","style":[{"key":"width","value":"100%"},{"key":"bordertype","value":"none"}],"href":"","fromPaste":false,"pastePass":false}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"查看请求结果"}]},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/8a/8afa82e5c5dd02a5731e743fe695a2f7.png","alt":null,"title":"","style":[{"key":"width","value":"100%"},{"key":"bordertype","value":"none"}],"href":"","fromPaste":false,"pastePass":false}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"这就是通过fiddler和apipost进行接口测试的步骤。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"fiddler下载地址:https://www.telerik.com/fiddler"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"apipost下载地址:"},{"type":"link","attrs":{"href":"https://www.apipost.cn/?dt=20201031","title":""},"content":[{"type":"text","text":"https://www.apipost.cn/?dt=20201031"}]}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}}]}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章