我在上看到了一个很好的教程,其中介绍了如何使用robotframework自动执行sikuli脚本
http://blog.mykhailo.com/2011/02/how-to-sikuli-and-robot-framework.html@H_419_0@使用robotframework和Monkeyrunner有什么办法做类似的事情?@H_419_0@这是我的示例monkeyrunner脚本,使用monkeyrunner调用时可以正确执行.@H_419_0@
from __future__ import with_statementfrom com.androID.monkeyrunner import MonkeyRunner, MonkeyDevicedef testCase() : device = MonkeyRunner.waitForConnection() result2 = device.takeSnapshot() # Writes the screenshot to a file result2.writetofile("scr.png","png")def my_keyword(): print 'Hello, world!'if __name__ == '__main__': testCase()
@H_419_0@我想用roboframework调用相同的东西.我正在尝试以下方法.我不确定以下调用是否正确,我只是从sikuli自动化示例中复制并修改了它.@H_419_0@monkey_jar=/home/user/androID-sdks/tools/lib/monkeyrunner.jarguava_jar=/home/user/androID-sdks/tools/lib/guavalib.jarjava -cp "robotframework-2.7.4.jar:$monkey_jar:$guava_jar" -Dpython.path="/home/user/androID-sdks/tools/lib/" \org.robotframework.RobotFramework --pythonpath=./ --outputdir=results --loglevel=TRACE
@H_419_0@当我这样做时,出现以下错误.@H_419_0@ importing test library 'Mylibrary' Failed: NoClassDefFoundError: Could not initialize class com.androID.monkeyrunner.MonkeyDevicejava.lang.NoClassDefFoundError: at java.lang.class.forname0(Native Method) at java.lang.class.forname(Class.java:247) at Mylibrary$py.fexport cpath=$(echo libs/*.jar | tr ' ' ':')java -Dpython.path=$cpath -jar robotframework-2.7.4.jar robo-tests.txt
(/home/user/automation/DemoScripts/Mylibrary.py:9) at Mylibrary$py.call_function(/home/user/automation/DemoScripts/Mylibrary.py) at robot.utils.importer$py._import(/Users/jmalinen/documents/workspace/robot/tmp-jar-dir/lib/robot/utils/importer.py:154) at robot.utils.importer$py.call_function(/Users/jmalinen/documents/workspace/robot/tmp-jar-dir/lib/robot/utils/importer.py) at robot.utils.importer$py.import_(/Users/jmalinen/documents/workspace/robot/tmp-jar-dir/lib/robot/utils/importer.py:241) at robot.utils.importer$py.call_function(/Users/jmalinen/documents/workspace/robot/tmp-jar-dir/lib/robot/utils/importer.py) at robot.utils.importer$py._import_class_or_module(/Users/jmalinen/documents/workspace/robot/tmp-jar-dir/lib/robot/utils/importer.py:67) at robot.utils.importer$py.call_function(/Users/jmalinen/documents/workspace/robot/tmp-jar-dir/lib/robot/utils/importer.py) at robot.utils.importer$py.import_class_or_module(/Users/jmalinen/documents/workspace/robot/tmp-jar-dir/lib/robot/utils/importer.py:64) at robot.utils.importer$py.call_function(/Users/jmalinen/documents/workspace/robot/tmp-jar-dir/lib/robot/utils/importer.py) at robot.run$py.main(/Users/jmalinen/documents/workspace/robot/tmp-jar-dir/lib/robot/run.py:367) at robot.run$py.call_function(/Users/jmalinen/documents/workspace/robot/tmp-jar-dir/lib/robot/run.py) at robot.utils.application$py._execute(/Users/jmalinen/documents/workspace/robot/tmp-jar-dir/lib/robot/utils/application.py:87) at robot.utils.application$py.call_function(/Users/jmalinen/documents/workspace/robot/tmp-jar-dir/lib/robot/utils/application.py) at robot.utils.application$py.execute_cli(/Users/jmalinen/documents/workspace/robot/tmp-jar-dir/lib/robot/utils/application.py:45) at robot.utils.application$py.call_function(/Users/jmalinen/documents/workspace/robot/tmp-jar-dir/lib/robot/utils/application.py) at robot.run$py.run_cli(/Users/jmalinen/documents/workspace/robot/tmp-jar-dir/lib/robot/run.py:396) at robot.run$py.call_function(/Users/jmalinen/documents/workspace/robot/tmp-jar-dir/lib/robot/run.py) at robot.jarrunner$py._run(/Users/jmalinen/documents/workspace/robot/tmp-jar-dir/lib/robot/jarrunner.py:60) at robot.jarrunner$py.call_function(/Users/jmalinen/documents/workspace/robot/tmp-jar-dir/lib/robot/jarrunner.py) at robot.jarrunner$py.run(/Users/jmalinen/documents/workspace/robot/tmp-jar-dir/lib/robot/jarrunner.py:53) at robot.jarrunner$py.call_function(/Users/jmalinen/documents/workspace/robot/tmp-jar-dir/lib/robot/jarrunner.py) at org.robotframework.RobotFramework.run(RobotFramework.java:62) at org.robotframework.RobotFramework.main(RobotFramework.java:37)PYTHONPATH: /home/user/automation/DemoScripts /home/user/automation/DemoScripts/robotframework-2.7.4.jar/lib/robot/librarIEs /home/user/automation/DemoScripts/robotframework-2.7.4.jar/lib /home/user/androID-sdks/tools/lib/ /home/user/automation/DemoScripts/lib __classpath__ __pyclasspath__/ . /home/user/automation/DemoScriptsCLAsspATH: robotframework-2.7.4.jar /home/user/androID-sdks/tools/lib/monkeyrunner.jar /home/user/androID-sdks/tools/lib/guavalib.jar==============================================================================
@H_419_0@我相信与roboframework一起执行Monkeyrunner测试用例是很有可能的.@H_419_0@有输入吗?解决方法:
@H_419_0@好吧,尝试了几天后,我发现可以将RobotRunner脚本与MonkeyRunner脚本一起使用.@H_419_0@简而言之,您可以使用以下工具与Monkeyrunner一起启动机器人框架.@H_419_0@@H_419_0@但是唯一的问题是,没有调用Monkeyrunner的main,因此没有初始化ChimpChat对象,这导致空指针异常.我在MonkeyRunner.java中修复了该问题,并创建了一个新的monkeyrunner.jar.这样,我就可以从roboframework运行monkeyrunner脚本.我将尝试创建一个分步教程并将其发布. 总结以上是内存溢出为你收集整理的android-具有Robotframework的MonkeyRunner全部内容,希望文章能够帮你解决android-具有Robotframework的MonkeyRunner所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)