美文网首页
Jmeter在Mac上录制https请求

Jmeter在Mac上录制https请求

作者: yywfy的昵称 | 来源:发表于2020-10-12 16:53 被阅读0次

Jmeter在Mac上的安装步骤参看文章:

https://blog.csdn.net/liu_kh/article/details/88820334

需要用iphone实现https的抓包:

1.https抓包必须有对应信任证书的支持

2.Jmeter证书只能安装到用户信任证书库

3.android7.0以上,系统不会信任用户证书库

4.android App需要修改源代码,or安装黑客工具才能支持https的抓包

5.iPhone不存在上述问题,故使用iPhone来实现Jemeter的https的抓包。

Android高版本,如何实现https的抓包:

https://mp.weixin.qq.com/s/nXoDDqzX-Y2SD978F5D4fQ

在Mac上录制https请求的步骤:

1,在Mac的系统设置中找到Network:

Mac System Preferences

打开高级设置Advanced:

Advanced

打开Proxies页签,选择Web Proxy把Web Proxy Server设置为:localhost:8888

Proxies

2. 设置使用的iPhone的代理服务,将iPhone接入的局域网的代理服务器改为运行Jmeter的主机的IP,端口设置也为8888。

设置iPhone的代理服务

3. 给IPhone安装Jemeter的信任证书。

a. 在Jmeter的解压目录的bin文件夹下,能找到Jmeter的证书“ApacheJMeterTemporaryRootCA.crt”。

b. 在Mac的控制台进入Jmeter bin目录,用python3开启一个httpserver服务,“python3 -m http.server 8080”

python3 http service

c.在iPhone上用浏览器访问Mac的http://[mac ip]:8080,点击Jmeter的证书,下载并安装:

下载安装证书

d. 在iPhone的设置-通用-描述文件中信任Jmeter的证书,Jemter证书有效期为7天。

4. 打开Jemeter在Test Plan下面添加一个Thread Group线程组:

Test Plan->Add->Threads->Thread Group

Add Thread Group

Test Plan下面添加一个HTTP Test Script Recorder:

Test Plan->Add->Non-Test Elements->HTTP Test Script Recorder

HTTP Test Script Recorder

配置端口号Port为8888,保持个Mac的Web Proxy Server一致;Target Controller选择“Record>Thread Group”;点击Start按钮

HTTP Test Script Recorder Page Recorder

5. 链接Iphone在Mac之后,操作手机上的App,能看到手机App发出的Https的请求,还可设置Test Script Recorder的Requests Filter过滤关注的https请求:

6. 如果是录制MAC浏览器的请求,打开浏览器做测试操作,这时能看到ThreadGroup下面出现相应的Http Request:

http request list

删掉不需要的Http Request,然后在ThreadGroup下面添加一个View Results Tree:

View Results Tree

运行录制好的脚本,可以在View Results Tree下面看到每个Http Request的结果:

TestResult

8. 可以在Thread Group中设置并发数和压测时间,进行压力测试:

流量回放

参考教程:

https://www.cnblogs.com/imyalost/p/7062784.html

相关文章

网友评论

      本文标题:Jmeter在Mac上录制https请求

      本文链接:https://www.haomeiwen.com/subject/hsxppktx.html