使用Jmeter测试手机(iOS)App性能_HTTPS协议

时间:2024-02-17 21:58:33

Step1: Settings in Jmeter and iphone

1.1 Open Jmeter, select 测试计划 > 添加 > Threads(Users) > 线程组

1.2 Select 线程组 > 添加 > 逻辑控制器 > 录制控制器

1.3 Select 线程组 > 添加 > 监听器> 聚合报告

1.4 Select 线程组 > 添加 > 监听器> 查看结果树

1.5 工作台 > 添加 > 非测试原件 > HTTP代理服务器, 端口: 7789(随便设), HTTPS Domains: http://10.102.11.58(安装jmeter的PC的IP)

 

Step2: Install certification in iphone(如果App是使用http协议,那么可以忽略step 2.1, 2.2, 2.3)

2.1 Open Jmeter, select 选项 > SSL管理器,发送Apache.JMeterTemporaryRootCA.crt to iphone, you can use mailbox to send it and open it with safari, install the .crt file in iphone.

2.2 In the iphone, go to Settings > General > Profile, verify the certification file

2.3 In the iphone, go to Settings > General > About > Certificate Trust Settings > Enable the certification(important)

2.4 In the iphone,go to Settings > WLAN > Manual, Server: 10.102.11.58(the same as PC IP), Port: 7789(The same as the setting in Jmeter proxy server)

Picture_2.1

Picture_2.2

Picture_2.3

Picture_2.4

Step3: Record cellphone app

3.1 Open Jmeter, go to 工作台 > 代理服务器, 点击“启动”

3.2 Open App in the iphone, operate it, Jmeter is recording

3.3 Run script in Jmeter, it prompt Unauthorized error,解决方法为添加HTTP信息头管理器

3.4 Select 线程组 > 添加 > 配置元件> HTTP信息头管理器, 信息头管理器中需要填写token信息,可以用postman获取

3.5 Run script in Jmeter, ok

3.6 根据需求Set 线程数和循环次数,run script, 分析结果

Picture_3.3

 

Picture_3.4.1

 

Picture_3.4.2(How to get token with Postman)

 

Picture_3.5

 

Picture_3.6