public
Last active

monkeyrunner for robotframework

  • Download Gist
MonkeyrunnerLibrary.py
Python
1 2 3 4 5 6 7 8 9 10 11 12
# -*- coding: utf-8 -*-
 
from com.android.monkeyrunner import MonkeyRunner
 
class MonkeyrunnerLibrary(object):
"""docstring for ClassName"""
ROBOT_LIBRARY_SCOPE = 'Global'
 
self.device = MonkeyRunner.waitForConnection()
 
def shell(self, string):
return self.device.shell(string)
console.log
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105
sh jybotshell.sh
[ ERROR ] Error in file '/Users/jollychang/Downloads/MonkeyrunnerLibrary/resource_monkey.txt' in table 'Settings': Importing test library '/Users/jollychang/Downloads/MonkeyrunnerLibrary/MonkeyrunnerLibrary.py' failed: NullPointerException
java.lang.NullPointerException
at com.android.monkeyrunner.MonkeyRunner.waitForConnection(MonkeyRunner.java:75)
at MonkeyrunnerLibrary$py.MonkeyrunnerLibrary$1(/Users/jollychang/Downloads/MonkeyrunnerLibrary/MonkeyrunnerLibrary.py:13)
at MonkeyrunnerLibrary$py.call_function(/Users/jollychang/Downloads/MonkeyrunnerLibrary/MonkeyrunnerLibrary.py)
at MonkeyrunnerLibrary$py.f$0(/Users/jollychang/Downloads/MonkeyrunnerLibrary/MonkeyrunnerLibrary.py:7)
at MonkeyrunnerLibrary$py.call_function(/Users/jollychang/Downloads/MonkeyrunnerLibrary/MonkeyrunnerLibrary.py)
at robot.utils.importer$py._import$13(/Users/jollychang/jython2.5.2/Lib/site-packages/robot/utils/importer.py:154)
at robot.utils.importer$py.call_function(/Users/jollychang/jython2.5.2/Lib/site-packages/robot/utils/importer.py)
at robot.utils.importer$py._import_by_path$25(/Users/jollychang/jython2.5.2/Lib/site-packages/robot/utils/importer.py:230)
at robot.utils.importer$py.call_function(/Users/jollychang/jython2.5.2/Lib/site-packages/robot/utils/importer.py)
at robot.utils.importer$py.import_$19(/Users/jollychang/jython2.5.2/Lib/site-packages/robot/utils/importer.py:181)
at robot.utils.importer$py.call_function(/Users/jollychang/jython2.5.2/Lib/site-packages/robot/utils/importer.py)
at robot.utils.importer$py._import_class_or_module$4(/Users/jollychang/jython2.5.2/Lib/site-packages/robot/utils/importer.py:67)
at robot.utils.importer$py.call_function(/Users/jollychang/jython2.5.2/Lib/site-packages/robot/utils/importer.py)
at robot.utils.importer$py.import_class_or_module$3(/Users/jollychang/jython2.5.2/Lib/site-packages/robot/utils/importer.py:64)
at robot.utils.importer$py.call_function(/Users/jollychang/jython2.5.2/Lib/site-packages/robot/utils/importer.py)
at robot.run$py.main$3(/Users/jollychang/jython2.5.2/Lib/site-packages/robot/run.py:361)
at robot.run$py.call_function(/Users/jollychang/jython2.5.2/Lib/site-packages/robot/run.py)
at robot.utils.application$py._execute$10(/Users/jollychang/jython2.5.2/Lib/site-packages/robot/utils/application.py:87)
at robot.utils.application$py.call_function(/Users/jollychang/jython2.5.2/Lib/site-packages/robot/utils/application.py)
at robot.utils.application$py.execute_cli$5(/Users/jollychang/jython2.5.2/Lib/site-packages/robot/utils/application.py:45)
at robot.utils.application$py.call_function(/Users/jollychang/jython2.5.2/Lib/site-packages/robot/utils/application.py)
at robot.run$py.run_cli$4(/Users/jollychang/jython2.5.2/Lib/site-packages/robot/run.py:371)
at robot.run$py.call_function(/Users/jollychang/jython2.5.2/Lib/site-packages/robot/run.py)
PYTHONPATH:
/Users/jollychang/Work/android-sdk-macosx/tools/lib/traceview.jar
/Users/jollychang/Work/android-sdk-macosx/tools/lib/swtmenubar.jar
/Users/jollychang/Work/android-sdk-macosx/tools/lib/sdkstats.jar
/Users/jollychang/Work/android-sdk-macosx/tools/lib/monkeyrunner.jar
/Users/jollychang/Work/android-sdk-macosx/tools/lib/jsilver.jar
/Users/jollychang/Work/android-sdk-macosx/tools/lib/hierarchyviewerlib.jar
/Users/jollychang/Work/android-sdk-macosx/tools/lib/hierarchyviewer2.jar
/Users/jollychang/Work/android-sdk-macosx/tools/lib/hardware-properties.ini
/Users/jollychang/Work/android-sdk-macosx/tools/lib/guavalib.jar
/Users/jollychang/Work/android-sdk-macosx/tools/lib/draw9patch.jar
/Users/jollychang/Work/android-sdk-macosx/tools/lib/ddmuilib.jar
/Users/jollychang/Work/android-sdk-macosx/tools/lib/ddms.jar
/Users/jollychang/Work/android-sdk-macosx/tools/lib/ddmlib.jar
/Users/jollychang/Work/android-sdk-macosx/tools/lib/common.jar
/Users/jollychang/Work/android-sdk-macosx/tools/lib/chimpchat.jar
/Users/jollychang/Work/android-sdk-macosx/tools/lib/archquery.jar
/Users/jollychang/Work/android-sdk-macosx/tools/lib/anttasks.jar
/Users/jollychang/Work/android-sdk-macosx/tools/lib/androidprefs.jar
/Users/jollychang/Work/android-sdk-macosx/tools/lib/swing-worker-1.1.jar
/Users/jollychang/Work/android-sdk-macosx/tools/lib/osgi.jar
/Users/jollychang/Work/android-sdk-macosx/tools/lib/mkidentity.jar
/Users/jollychang/Work/android-sdk-macosx/tools/lib/manifmerger.jar
/Users/jollychang/Work/android-sdk-macosx/tools/lib/lombok-ast-0.2.jar
/Users/jollychang/Work/android-sdk-macosx/tools/lib/lint_checks.jar
/Users/jollychang/Work/android-sdk-macosx/tools/lib/lint_api.jar
/Users/jollychang/Work/android-sdk-macosx/tools/lib/lint.jar
/Users/jollychang/Work/android-sdk-macosx/tools/lib/jython.jar
/Users/jollychang/Work/android-sdk-macosx/tools/lib/jfreechart-1.0.9.jar
/Users/jollychang/Work/android-sdk-macosx/tools/lib/jfreechart-1.0.9-swt.jar
/Users/jollychang/Work/android-sdk-macosx/tools/lib/jcommon-1.0.12.jar
/Users/jollychang/Work/android-sdk-macosx/tools/lib/httpmime-4.1.1.jar
/Users/jollychang/Work/android-sdk-macosx/tools/lib/httpcore-4.1.jar
/Users/jollychang/Work/android-sdk-macosx/tools/lib/httpclient-4.1.1.jar
/Users/jollychang/Work/android-sdk-macosx/tools/lib/guava-10.0.1.jar
/Users/jollychang/Work/android-sdk-macosx/tools/lib/emma_device.jar
/Users/jollychang/Work/android-sdk-macosx/tools/lib/emma_ant.jar
/Users/jollychang/Work/android-sdk-macosx/tools/lib/emma.jar
/Users/jollychang/Work/android-sdk-macosx/tools/lib/dvlib.jar
/Users/jollychang/Work/android-sdk-macosx/tools/lib/commons-logging-1.1.1.jar
/Users/jollychang/Work/android-sdk-macosx/tools/lib/commons-compress-1.0.jar
/Users/jollychang/Work/android-sdk-macosx/tools/lib/commons-codec-1.4.jar
/Users/jollychang/Work/android-sdk-macosx/tools/lib/asm-tree-4.0.jar
/Users/jollychang/Work/android-sdk-macosx/tools/lib/asm-4.0.jar
/Users/jollychang/Work/android-sdk-macosx/tools/lib/proguard-project.txt
/Users/jollychang/Work/android-sdk-macosx/tools/lib/plugin.prop
/Users/jollychang/Work/android-sdk-macosx/tools/lib/devices.xml
/Users/jollychang/Work/android-sdk-macosx/tools/lib/build.template
/Users/jollychang/Work/android-sdk-macosx/tools/lib/sdkuilib.jar
/Users/jollychang/Work/android-sdk-macosx/tools/lib/sdkmanager.jar
/Users/jollychang/Work/android-sdk-macosx/tools/lib/sdklib.jar
/Users/jollychang/Work/android-sdk-macosx/tools/lib/emulator
/Users/jollychang/Work/android-sdk-macosx/tools/lib/x86_64
/Users/jollychang/Work/android-sdk-macosx/tools/lib/x86
/Users/jollychang/Work/android-sdk-macosx/tools/lib/pc-bios
/Users/jollychang/Work/android-sdk-macosx/tools/lib/monitor-x86_64
/Users/jollychang/jython2.5.2/Lib/site-packages/robot/libraries
/Users/jollychang/jython2.5.2/Lib/site-packages
/Users/jollychang/jython2.5.2/bin
/Users/jollychang/jython2.5.2/Lib
__classpath__
__pyclasspath__/
.
/Users/jollychang/.pythonbrew/lib
CLASSPATH:
/Users/jollychang/jython2.5.2/jython.jar
==============================================================================
Test Monkey :: monkey lib
==============================================================================
test_shell | FAIL |
No keyword with name 'Shell' found.
------------------------------------------------------------------------------
Test Monkey :: monkey lib | FAIL |
1 critical test, 0 passed, 1 failed
1 test total, 0 passed, 1 failed
==============================================================================
Output: /Users/jollychang/Downloads/MonkeyrunnerLibrary/output.xml
Log: /Users/jollychang/Downloads/MonkeyrunnerLibrary/log.html
Report: /Users/jollychang/Downloads/MonkeyrunnerLibrary/report.html
jybotshell.sh
Shell
1
java -cp /Users/jollychang/Downloads/android-sdk-macosx/tools/lib/chimpchat.jar:/Users/jollychang/Downloads/android-sdk-macosx/tools/lib/ddmlib.jar:/Users/jollychang/Downloads/android-sdk-macosx/tools/lib/guavalib.jar:/Users/jollychang/Downloads/android-sdk-macosx/tools/lib/monkeyrunner.jar:/Users/jollychang/Downloads/android-sdk-macosx/tools/lib/sdklib.jar:/Users/jollychang/Downloads/robotframework-2.7.4.jar -Dcom.android.monkeyrunner.bindir="/Users/jollychang/Downloads/android-sdk-macosx/tools" -Djava.library.path="/Users/jollychang/Downloads/android-sdk-macosx/tools/lib" org.robotframework.RobotFramework test_monkey.txt
resource_monkey.txt
1 2
*** Settings ***
Library /Users/jollychang/Downloads/MonkeyrunnerLibrary/MonkeyrunnerLibrary.py
test_monkey.txt
1 2 3 4 5 6 7 8 9
*** Settings ***
Documentation monkey lib
#Suite Setup 启动测试
#Suite Teardown 结束测试
Resource resource_monkey.txt
 
*** Test Cases ***
test_shell
Shell ls

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.