monkeyrunner

How to use monkey and monkeyrunner tools for android testing?

两盒软妹~` 提交于 2019-12-04 17:48:00
问题 How do you use monkey and monkeyrunner tools for android testing? What are the basic commands needed? 回答1: adb shell monkey -p com.bla.yourpackage -v 1000 First is your package that you want monkey to run in and be restricted to. Second is i verbose mode, third is number of events to run. You can find out more by doing adb shell monkey -help 回答2: Here are some useful tips when using monkey test. Specify one activity Add category in manifest: <activity android:name="MonkeyActivity"> <intent

Monkey Runner throwing socket exception broken pipe on touuch

可紊 提交于 2019-12-04 13:38:41
I see the below error sometimes while running monkeyrunner scripts. 140501 17:01:58.950:S [MainThread] [com.android.chimpchat.adb.AdbChimpDevice] Error sending touch event: 500 515 DOWN_AND_UP 140501 17:01:58.950:S [MainThread] [com.android.chimpchat.adb.AdbChimpDevice]java.net.SocketException: Broken pipe 140501 17:01:58.950:S [MainThread] [com.android.chimpchat.adb.AdbChimpDevice] at java.net.SocketOutputStream.socketWrite0(Native Method) 140501 17:01:58.950:S [MainThread] [com.android.chimpchat.adb.AdbChimpDevice] at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92) How do

MonkeyRunner——Mac

我的梦境 提交于 2019-12-04 11:43:04
/*--> */ /*--> */ 1. MonkeyRunner介绍: Android的SDK中集成了三个可用来进行自动化测试的工具:Monkey、MonkeyRunner和Robotium。这三个测试工具都是基于黑盒测试。 MonkeyRunner工具提供了一个API,使用此API写出的程序可以在Android代码之外控制Android设备和模拟器。通过monkeyrunner,可以写出一个Python程序去安装一个Android应用程序或测试包,运行它,向它发送模拟击键,截取它的用户界面图片,并将截图存储于工作站上。monkeyrunner工具的主要设计目的是用于测试功能/框架水平上的应用程序和设备,或用于运行单元测试套件。 /*--> */ /*--> */ Monkeyrunner工具是使用Jython(使用Java编程语言的一种Python实现)写出来的。Jython允许MonkeyrunnerAPI与Android框架轻松的进行交互。 Python是一门强大的面向对象的编程语言,可以跨平台运行。 2. MonkeyRunner环境搭建 /*--> */ /*--> */ 安装JDK,配置环境变量 在Mac中已经为我们预装了JDK,因此JDK对我们来说直接使用即可,查看Mac中的JDK版本方法是在命令行中输入"java -version”并回车即可。 vim .bash

How do I catch SocketExceptions in MonkeyRunner?

混江龙づ霸主 提交于 2019-12-04 06:12:49
When using MonkeyRunner, every so often I get an error like: 120830 18:39:32.755:S [MainThread] [com.android.chimpchat.adb.AdbChimpDevice] Unable to get variable: display.density 120830 18:39:32.755:S [MainThread] [com.android.chimpchat.adb.AdbChimpDevice]java.net.SocketException: Connection reset From what I've read, sometimes the adb connection goes bad, and you need to reconnect. The only problem is, I'm not able to catch the SocketException . I'll wrap my code like so: try: density = self.device.getProperty('display.density') except: print 'This will never print.' But the exception is

monkey

时间秒杀一切 提交于 2019-12-04 04:21:43
一、monkey简介 在 Android的官方自动化测试领域有一只非常著名的“猴子”叫Monkey,这只“猴子”一旦启动,就会让被测的Android应用程序像猴子一样活蹦乱跳,到处乱跑。人们常用这只“猴子”来对被测程序进行压力测试,检查和评估被测程序的稳定性。 monkey官方文档: http://www.android-doc.com/tools/help/monkey.html Moneky 路径 Monkey程序是Android系统自带的,其启动脚本是位于Android系统的/system/bin目录的Monkey文件,其jar包是位于Android系统的/system/framework目录的Monkey.jar文件。用户主要是通过adb命令来启动Monkey的,Monkey在运行时,会根据命令行参数的配置,生成伪随机的事件流,并在Android设备上执行对应的测试事件。同时,Monkey还会对测试系统进行监测,当出现以下三种情况时会进行特殊处理: 如限定了 Monkey运行在特定包上,当监测到试图转到其他包的操作,将对其进行阻止。 如应用程序崩溃或接收到任何失控异常, Monkey将记录对应的错误日志,并根据命令行参数判断是停止运行还是继续运行。 如果应用程序发生了程序无响应( application not responding)的错误,Monkey将记录对应的错误日志

Setup MonkeyRunner on Android

不羁岁月 提交于 2019-12-04 03:56:31
问题 I'd like to use MonkeyRunner. I've got a monkeyrunner.jar and import it into my project. How can I use it now? Could you tell me what should I do step-by-step. I've seen some code snippet on python, but I don't understand how can I use python in eclipse. 回答1: Maybe this link can help you how to use monkeyrunner in eclipse: http://fclef.wordpress.com/2011/11/24/using-android-monkeyrunner-from-eclipse-in-windows/ 来源: https://stackoverflow.com/questions/7556037/setup-monkeyrunner-on-android

How can I make a Java app using the Monkeyrunner API?

試著忘記壹切 提交于 2019-12-03 17:33:15
问题 The Android SDK has an API for sending commands to the phone called Monkeyrunner. It appears to be a Python API. Is there anyway I can use it in a Java application? 回答1: Well I have been trying to do this, here is what I found (Thanks to google and some help from members on the internet) Here is a little Java program that uses monkeyrunner to print the name of the device import com.android.monkeyrunner.MonkeyDevice; import com.android.monkeyrunner.adb.AdbBackend; public class Monk { public

How to determine whether softkeyboard is shown on the screen - while using monkeyrunner

二次信任 提交于 2019-12-03 17:29:23
I am trying to automate few screen clicks and entries using monkeyrunner(using AndroidViewClient ) Whenever there is a edittext in the screen, the soft keyboard is popping up, and if I want to press a button though findViewById, (assuming that this particular button is behind the soft keyboard) fails. Instead of clicking this button, it clicks on some button in the soft keyboard. So as a work around I need to press back key through monkey runner, to hide the soft keyboard. My question is how to determine whether soft keyboard is shown in the screen or not while running from monkeyrunner. When

Keyevent to click on Alert Dialog of Android screen

ぃ、小莉子 提交于 2019-12-03 17:08:44
Is there any way to simulate keyevent on "OK" or "CANCEL" buttons of Android dialogue box using adb commands? One indirect way is:- adb shell uiautomator dump /data/view.xml adb shell cat /data/view.xml calculate OK button coordinates from the relative coordinates given in the xml file. Then do adb shell input tap <x> <y> Hope works. Using AndroidViewClient/culebra you can simply do: run java -jar androidviewclient-2.3.25.jar culebra --verbose --verbose-comments --find-views-with-text=true --output=myscript.py edit myscript.py and add vc.findViewWithTextOrRaise('Cancel').touch() at the end

How can I pass an Extra to an Android intent using MonkeyRunner?

不想你离开。 提交于 2019-12-03 16:08:17
I am trying to test my app using the MonkeyRunner tool. I am trying to add an EXTRA to my activity. The python script executes without error: device = MonkeyRunner.waitForConnection() device.wake() extra = {'MY_EXTRA', True} device.startActivity(component="org.mycompany.myapp/.activity.Show",extras=extra) But when I inspect the intent in my app I do not get the value passed: boolean myExtra = i.getBooleanExtra("MY_EXTRA", false); What am I missing? Am I passing in the intent wrong? Am I inspecting the value in the Android app wrong? Bill This is a bug in MonkeyRunner . It is not correctly