自动化测试中自动化切换网络----解决方案

自动化测试中自动化切换网络----解决方案

 

思路

通过安装一个控制网络的APP,在测试脚本中,通过shell命令来控制实现

 

使用方式

关闭WIFI,切换到4G网络(测试手机默认流量是开着的)

adb  shell am force-stop com.steinwurf.adbjoinwifi

adb  shell am start -n com.steinwurf.adbjoinwifi/com.steinwurf.adbjoinwifi.MainActivity -e ssid 4G

   

切换到WIFI网络

adb  shell am force-stop com.steinwurf.adbjoinwifi

adb  shell am start -n com.steinwurf.adbjoinwifi/com.steinwurf.adbjoinwifi.MainActivity -e ssid MBDTEST -e password_type WPA -e password qazwsxedc

注: 黄色代表wifi名字和密码

 

实现

已经打好的APK包:

       https://files.cnblogs.com/files/udld/adbjoinwifi.apk

posted @ 2016-10-09 11:07  UDLD  阅读(1502)  评论(0编辑  收藏  举报