zoukankan      html  css  js  c++  java
  • monkey常用命令

    1、运行基本monkey命令 adb shell monkey -p com.webank.trendos --ignore-crashes -v -v-v 20000 -p particular 指定的,-v-v-v表示显示日志的详细程度,20000表示操作的事件数

    2. 强制停止应用  ps -ef |grep monkey (查询monkey进程)  kill pid (杀掉monkey进程)

    3. 打印日志保存在本地 adb shell monkey -p com.webank.trendos --ignore-crashes -v -v-v 20000>D:log1.txt

    4. 随机数种子(将此次所有操作保存下来) adb shell monkey -p com.webank.trendos -s 888 --ignore-crashes -v -v-v 20000>D:log1.txt

    5. 间隔多少秒,操作下个事件 adb shell monkey -p com.webank.trendos -s 102 --ignore-crashes -v-v-v --throttle 200 200000>D:log1.txt

    6. 调整触摸百分比事件(比如:让触摸touch事件占20000事件的50%) adb shell monkey -p com.webank.trendos --ignore-crashes -v -v-v --pct-touch 10000 20000>D:log1.txt

    Monkey百分比事件 0:点击事件百分比,即参数--pct-touch 1:滑动事件百分比,即参数--pct-motion 2:缩放事件百分比,即参数--pct-pinchzoom 3:轨迹球事件百分比,即参数--pct-trackball 4:屏幕旋转事件百分比,即参数--pct-rotation 5:基本导航事件百分比,即参数--pct-nav 6:主要导航事件百分比,即参数--pct-majornav 7:系统按键事件百分比,即参数--pct-syskeys 8:Activity启动事件百分比,即参数--pct-appswitch 9:键盘唤出隐藏事件百分比,即参数--pct-flip 10:其他事件百分比,即参数--pct-anyevent

    如何多台手机同时测试稳定性:

    1、准备USB分线器,可以同时连接多台手机

    2、利用多线程去执行ADB命令

    3、查找连接后每个手机在PC端显示的设备序列号,记录下手机机型和对应的序列号

    4、用python编写多线程执行ADB命令的脚本。(注意由于我们是同时连接多台手机,必须得指定手机设备序列号,这样计算机才能知道我们想要执行哪台手机,)

    实例代码:

    import os

    from  threading import Thread

    import time

    #荣耀8X手机

    def honor_adb_run():

      cmd = r"adb -s 7XBNW18A31002790 shell monkey -p plus.AiWork -s 102 --ignore-crashes -v-v-v --throttle 200 200000>D:log1228honor.txt"

      os.system(cmd)

    #红米6A手机

    def redmi_run():

      cmd = r"adb -s c6c816cd7d28 shell monkey -p plus.AiWork -s 103 --ignore-crashes -v-v-v --throttle 200 200000>D:log1228redmi.txt"

      os.system(cmd)

    def main():

       t_1 = Thread(target=honor_adb_run)

       t_2 = Thread(target=redmi_run)

      t_1.start()

      t_2.start()

       t_target=[t_1,t_2]

       for t in t_target:

        t.join()

    if __name__ == '__main__':

      main()

    这个代码保存在txt中后缀名改成a.py就行了,然后打开命令窗口:python a.py就行可以了

  • 相关阅读:
    第五章:向量运算
    第四章:向量
    第三章:多坐标系
    近期一些学习的随笔
    2020高考游记
    寒假集训好题记录
    STL基本用法的一些记录
    2020暑假集训做题记录——数据结构
    2020.12.13~2020.12.20做题记录
    2020.11.30~2020.12.6 做题记录
  • 原文地址:https://www.cnblogs.com/zhaobobo10/p/12179288.html
Copyright © 2011-2022 走看看