APP 弱网测试

1、fiddler要和手机连入同一网络,修改手机wifi--设置高级选项--手动代理--输入当前电脑ip和fiddler中的端口号8888

2 在fiddler 中Rules 下点击Customize Rules

3 在弹出的Fiddler Script窗口中搜索“Delay sends”,找到如下一段代码

 

 

4request-trickle-delay是上传延迟

response-trickle-delay是下载延迟

这里后面单位默认是ms

5   2G 3G 4G 网络设置

2G网络:

上行:2.7K

下行:9.6K

上行:[1/(2.7/8)]X1000=2962ms

下行:[1/(9.6/8)]X1000=833ms

3G网络:


电信:上行:1.8M 1.8x1024

下行:3.1M 3.1x1024

上行:{1/[(1.8x1024)/8]}x1000=4.34ms

下行:{1/[(3.1x1024)/8]}x1000=2.52ms

4G网络:
电信:上行:50M 50x1024

下行:100-150M 125x1024

上行:{1/[(50x1024)/8]}x1000=0.086ms

下行:{1/[(125x1024)/8]}x1000=0.02016ms


# ======Fiddler 中 毫秒的数值必须为整数!!!!!!**

扩展弱网络规则
可能我们在测试中不会想要一个一直虚弱的网络环境,而是随机强弱的网络,这样比较贴切我们的真是情况,那么我们可以修改上述代码为:

static function randInt(min, max) {
return Math.round(Math.random()*(max-min)+min);
}
if (m_SimulateModem) {
// Delay sends by 300ms per KB uploaded.
oSession["request-trickle-delay"] = ""+randInt(1,2000);
// Delay receives by 150ms per KB downloaded.
oSession["response-trickle-delay"] = ""+randInt(1,2000);
}
这里的randInt(1,2000)应该很好理解,代表1-2000中的一个随机整数,这样就会出现偶尔有延迟偶尔网络又良好的情况

原文地址:https://www.cnblogs.com/lexus168/p/13939791.html