編輯:關於Android編程
# 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
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
Android Studio代碼著色插件 前言:半個多月沒寫博客了,放了個假期,這人才緩過來神,懶的啥都不想干,可算是明白一句話的意思了:玩物喪志啊!好在公司項
1. UIAutomatorViewer自動化測試是Android測試的趨勢, 穩定\復用, 最常用的工具就是Espresso.使用UIAutomatorViewer獲取
給大家分享一個高仿微信的PopupWindow、就是微信的掃一掃那個功能窗口、下面有應用運行效果圖、更加直觀的展示了Demo的效果、源代碼是通過兩種方法實現的、大家可以下
這幾天在研究ViewPager,簡單的寫一下如何使用ViewPager實現類似於QQ的“最近聯系人、好友、群組”的界面切換(不知道他們是不是用這個方法實現的)。ViewP