![d856da6137855fac68e65cffe9dbb72f.gif](https://img-blog.csdnimg.cn/img_convert/d856da6137855fac68e65cffe9dbb72f.gif)
我们需要对APP进行monkey测试,手动太麻烦了,为啥我们不让它自动运行呢?这里教你几招诀窍!
一插件安装
1、添加插件:Android Emulator Plugin,会自动下载如下插件:
2、安装成功后,增加构建步骤中多出如下选项:
![3744ddd1d1f4eada3999db9202eb6baf.png](https://img-blog.csdnimg.cn/img_convert/3744ddd1d1f4eada3999db9202eb6baf.png)
前提:设置android SDK root
![b14d0d56cf1ee7e35726e53f10d60342.png](https://img-blog.csdnimg.cn/img_convert/b14d0d56cf1ee7e35726e53f10d60342.png)
1、此处有三种方式:Jenkins配置新的模拟器、jenkins添加已有的模拟器、使用真机
jenkins添加已有的模拟器:
![2b99ada24d69bf12ccc41f209c2ba1f1.png](https://img-blog.csdnimg.cn/img_convert/2b99ada24d69bf12ccc41f209c2ba1f1.png)
Jenkins配置新的模拟器:
job-构建环境中选择Run an Android emulator during build配置模拟器
![26dbee52693d5d9f2652e4bb1e2e3f31.png](https://img-blog.csdnimg.cn/img_convert/26dbee52693d5d9f2652e4bb1e2e3f31.png)
2、在增加构建操作中添加“Run Android monkey tester”
![2d33b6c6c0d4fb49ef3bfb6c48e78be0.png](https://img-blog.csdnimg.cn/img_convert/2d33b6c6c0d4fb49ef3bfb6c48e78be0.png)
进行monkey测试
![815094340c13321ee5af092999c4fb61.png](https://img-blog.csdnimg.cn/img_convert/815094340c13321ee5af092999c4fb61.png)
![80e5f6ea216d9641140171796acf67a2.png](https://img-blog.csdnimg.cn/img_convert/80e5f6ea216d9641140171796acf67a2.png)
![9192bbd0d053a751d7bdf9132459d27a.png](https://img-blog.csdnimg.cn/img_convert/9192bbd0d053a751d7bdf9132459d27a.png)
常见问题:
1、无法执行adb命令
解决:Jenkins服务里面配置高级管理员登录;
2、模拟器报错
Starting emulator for AVD ‘test001’
emulator: ERROR: x86 emulation currently requires hardware acceleration!
Please ensure Intel HAXM is properly installed and usable.
CPU acceleration status: Please disable Hyper-V before using the Android Emulator. Start a command prompt as Administrator, run ‘bcdedit /set hypervisorlaunchtype off’, reboot.
解决:在SDK的Extras部分,勾选安装Intel X86 Emulator Accelerator(HAXM Installer)
![141468ad8144cad28f24bd5dbfad69ff.gif](https://img-blog.csdnimg.cn/img_convert/141468ad8144cad28f24bd5dbfad69ff.gif)
链接:https://blog.csdn.net/weixin_44275820/article/details/107361046
本文为51Testing经授权转载,转载文章所包含的文字来源于作者。如因内容或版权等问题,请联系51Testing进行删除
推荐阅读点击阅读☞方法总比问题多,这回先从Monkey测试开始吧!
点击阅读☞Android环境搭建及Monkey入门
点击阅读☞告诉你个秘密,想偷懒就自己做个Jenkins Job!
点击阅读☞Newman+Jenkins实现接口自动化测试就是这么简单!
点击阅读☞想知道如何用Jenkins自动执行Python脚本输出测试报告?
![b0ce481b60230d6ff2789ad4a70568e6.gif](https://img-blog.csdnimg.cn/img_convert/b0ce481b60230d6ff2789ad4a70568e6.gif)
![3b85482cacb780191ab650a53a905fc1.png](https://img-blog.csdnimg.cn/img_convert/3b85482cacb780191ab650a53a905fc1.png)