使用了命令
adb shell monkey --pct-touch 100 -v -p com.iBer.iBerAppV2 5000 >/Users/kaibinliu/Desktop/monkey_log.txt
-------------------------------------------------monkey日志
:Monkey: seed=1559743032065 count=5000
:AllowPackage: com.iBer.iBerAppV2:IncludeCategory: android.intent.category.LAUNCHER:IncludeCategory: android.intent.category.MONKEY// Event percentages:// 0: 100.0%// 1: 0.0%// 2: 0.0%// 3: 0.0%// 4: -0.0%// 5: 0.0%// 6: 0.0%// 7: 0.0%// 8: 0.0%// 9: 0.0%// 10: 0.0%:Switch: #Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x10200000;component=com.iBer.iBerAppV2/.MainActivity;end // Allowing start of Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.iBer.iBerAppV2/.MainActivity } in package com.iBer.iBerAppV2:Sending Touch (ACTION_DOWN): 0:(1349.0,304.0):Sending Touch (ACTION_UP): 0:(1350.9614,303.8281):Sending Touch (ACTION_DOWN): 0:(849.0,742.0):Sending Touch (ACTION_UP): 0:(856.3207,742.9238)
解释: 每个seed值 前面都会有个Switch 告诉你从啥页面开始 ,如上面告诉你 com.iBer.iBerAppV2/.MainActivity开始
出现闪退
------------------monkey日志
// CRASH: com.iBer.iBerAppV2 (pid 1952)
~~~
~~~
** Monkey aborted due to error.
Events injected: 4486:Sending rotation degree=0, persist=false:Dropped: keys=0 pointers=0 trackballs=0 flips=0 rotations=0## Network stats: elapsed time=10365ms (0ms mobile, 0ms wifi, 10365ms not connected)** System appears to have crashed at event 4486 of 50000 using seed 1559745138362解释: 再日志里面查到 CRASH,然后下面告诉你第4486个事件出错闪退,接着我们去看4486大概是在什么事件段执行的
------------------monkey日志
:Sending Touch (ACTION_DOWN): 0:(503.0,97.0)
//[calendar_time:2019-05-22 11:41:10.905 system_uptime:131091] // Sending event #4400:Sending Touch (ACTION_UP): 0:(488.35065,89.46216):Sending Touch (ACTION_DOWN): 0:(359.0,258.0):Sending Touch (ACTION_UP): 0:(365.89935,246.05772):Sending Touch (ACTION_DOWN): 0:(27.0,1223.0)解释: 从日志看到 第4400个事件 大概在2019-05-22 11:41:10.905 发生,那么第4486个事件就是该时间之后,我们去看手机日志
这里我抓取手机日志,是用到sdk里面的ddms,抓到 对应发生 闪退时,手机的日志信息
但是:~~~~~~~~~~~~~
peak说 我们的app是RN写的 所有页面名字都叫 .maniActivity,所以压根看不到那个页面出现闪退
Ainne大佬建议 可以看 《腾讯android自动化测试实战》 ,里面有闪退截图啥的,明天去买一本
还有一本《 腾讯ios测试实战》