• android monkey


    # monkey                                           

    usage: monkey [-p ALLOWED_PACKAGE [-p ALLOWED_PACKAGE] ...]
                  [-c MAIN_CATEGORY [-c MAIN_CATEGORY] ...]
                  [--ignore-crashes] [--ignore-timeouts]
                  [--ignore-security-exceptions]
                  [--monitor-native-crashes] [--ignore-native-crashes]
                  [--kill-process-after-error] [--hprof]
                  [--pct-touch PERCENT] [--pct-motion PERCENT]
                  [--pct-trackball PERCENT] [--pct-syskeys PERCENT]
                  [--pct-nav PERCENT] [--pct-majornav PERCENT]
                  [--pct-appswitch PERCENT] [--pct-flip PERCENT]
                  [--pct-anyevent PERCENT] [--pct-pinchzoom PERCENT]
                  [--pkg-blacklist-file PACKAGE_BLACKLIST_FILE]
                  [--pkg-whitelist-file PACKAGE_WHITELIST_FILE]
                  [--wait-dbg] [--dbg-no-events]
                  [--setup scriptfile] [-f scriptfile [-f scriptfile] ...]
                  [--port port]
                  [-s SEED] [-v [-v] ...]
                  [--throttle MILLISEC] [--randomize-throttle]
                  [--profile-wait MILLISEC]
                  [--device-sleep-time MILLISEC]
                  [--randomize-script]
                  [--script-log]
                  [--bugreport]
                  [--periodic-bugreport]
                  COUNT


    #monkey -p com.android.calculator2 -v 500

    #monkey-v -p com.android.settings--throttle 200 --pct-touch 100 500

    官网能够查阅具体的文档

    http://developer.android.com/tools/help/monkey.html

    2.

    1)配置monkeyrunner环境

    #gedit ~/.bashrc

    android_tools=/home/funbox/workspace/env/android-sdk-linux/tools
    PATH=$PATH:$android_tools

    export PATH

    2)monkeyrunner的使用

    # Imports the monkeyrunner modules used by this program
    from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice
    
    # Connects to the current device, returning a MonkeyDevice object
    device = MonkeyRunner.waitForConnection()
    
    # Installs the Android package. Notice that this method returns a boolean, so you can test
    # to see if the installation worked.
    device.installPackage('myproject/bin/MyApplication.apk')
    
    # sets a variable with the package's internal name
    package = 'com.example.android.myapplication'
    
    # sets a variable with the name of an Activity in the package
    activity = 'com.example.android.myapplication.MainActivity'
    
    # sets the name of the component to start
    runComponent = package + '/' + activity
    
    # Runs the component
    device.startActivity(component=runComponent)
    
    # Presses the Menu button
    device.press('KEYCODE_MENU', MonkeyDevice.DOWN_AND_UP)
    
    # Takes a screenshot
    result = device.takeSnapshot()
    
    # Writes the screenshot to a file
    result.writeToFile('myproject/shot1.png','png')

    http://developer.android.com/tools/help/monkeyrunner_concepts.html

  • 相关阅读:
    [java]struts2 模型驱动 2016-05-01 21:40 702人阅读 评论(19) 收藏
    [CS]C#操作word 2016-04-17 18:30 1506人阅读 评论(35) 收藏
    软件设计 2016-04-03 18:21 1012人阅读 评论(26) 收藏
    sqlite数据库文件导入到sqlserver 2016-03-26 21:55 1292人阅读 评论(1) 收藏
    C/S和B/S交互 2016-03-19 11:27 1275人阅读 评论(30) 收藏
    DESede/CBC/PKCS5Padding
    Gson应用:利用map和list来拼装Json消息
    使用Log4j2,打包后提示ERROR StatusLogger Log4j2 could not find a logging implementation.
    Jinkins定时任务设置
    给Fitnesse添加调用多参数fixture的调用方法
  • 原文地址:https://www.cnblogs.com/blfshiye/p/5204730.html
Copyright © 2020-2023  润新知