monkeyrunner

Delay between “type” commands in AdbClient (which doesn't exist in monkeyrunner)

ⅰ亾dé卋堺 提交于 2020-01-06 20:38:13
问题 I am making a switch from monkeyrunner to AndroidViewClient. It is nice because it is all Python. However, when issuing type or press commands, the lag between each command is like one second: import sys import os import time try: sys.path.append(os.path.join(os.environ['ANDROID_VIEW_CLIENT_HOME'], 'src')) except: pass from com.dtmilano.android.adb.adbclient import AdbClient, Device device.type("hello") # type a space device.press('KEYCODE_SPACE', 'DOWN_AND_UP') device.type("world") The above

Monkeyrunner. Connect to multiple devices at the same time

天大地大妈咪最大 提交于 2020-01-06 05:14:28
问题 I used this script to connect to multiple Android devices at the same time (i.e. to send files via adb): from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice import time import sys import time import os devices = os.popen('adb devices').read().strip().split('\n')[1:] device1 = MonkeyRunner.waitForConnection( devices[0].split('\t')[0]) package = 'com.android.browser' activity = 'com.android.browser.BrowserActivity' runComponent = package + '/' + activity device1.startActivity

Where is the help.py for Android's monkeyrunner

非 Y 不嫁゛ 提交于 2020-01-01 03:03:07
问题 I just can't find the help.py file in order to create the API reference for the monkeyrunner . The command described at the Android references monkeyrunner <format> help.py <outfile> does not work when i call monkeyrunner html help.py /path/to/place/the/doc.html . It's quite obvious that the help.py file is not found and the monkeyrunner also tells me "Can't open specified script file". But a locate on my system doesn't bring me a help.py file that has anything to do with monkeyrunner or

Can monkeyrunner interact with android notifications?

穿精又带淫゛_ 提交于 2019-12-25 05:03:58
问题 I'm starting to look at android monkeyrunner, and would like to test my application with it. My application opens a Notification in the android pull-down menu, and I would like monkeyrunner to test if the notification behaves correctly. Is it possible to use monkeyrunner to "click" on an incoming notification and verify the result? I've searched the documentation, and it seems like I can only test activities, but maybe I'm missing something. 回答1: MonkeyRunner is able to interact with the

Touch, swipe or drag events emulating on Android not working

笑着哭i 提交于 2019-12-22 09:24:42
问题 After reading posts I figured out how to emulate a touch event : adb shell input tap 100 100 I've installed MagicMarker in order to see if anything is drawn, nothing appears. I've also tried with monkeyrunner/androidViewClient Touch functions : device.touch(100 , 100, 'DOWN_AND_UP'); My whole code for AndroidViewClient : #! /usr/bin/env python # -*- coding: utf-8 -*- import getopt, sys import os # Add android to path becayuse it seems to not appear on windows sys.path.append("D:/Dev/adt

Monkey、Monkeyrunner 概述

Deadly 提交于 2019-12-18 12:21:09
软件测试是软件产品开发过程中的重要环节,对于保重软件质量具有重要的意思。手动测试和自动化测试是软件测试的两个基本手段。本文主要介Android – 自动化测试 Android平台上提供了一些自动化测试工具:Monkey、Monkeyrunner。 Monkey、Monkeyrunner 概述 一、Monkey 概述 monkey可以直接在XP/WIN7上运行,只要XP/WIN7上能用adb,即可使用。 Monkey测试是Android平台自动化测试的一种手段,通过Monkey程序模拟用户触摸屏幕、滑动Trackball、按键等操作来对设备上的程序进行压力测试,检测程序多久的时间会发生异常,Monkey测试是一种为了测试软件的稳定性、健壮性的快速有效的方法。 Monkey程序由Android系统自带,使用Java语言写成,在Android文件系统中的存放路径是:/system/framework/monkey.jar。 Monkey.jar程序是由一个名为“monkey”的Shell脚本来启动执行,shell脚本在Android文件系统中的存放路径是:/system/bin/monkey;这样就可以通过在shell窗口中执行: adb shell monkey {+命令参数}来进行Monkey测试了。 二、Monkeyrunner 概述 1

Android monkey runner: Touch with MOVE

懵懂的女人 提交于 2019-12-18 07:15:12
问题 I am trying to use monkeyrunner to simulate complex touch events. A swipe from a to b with... device.drag((300,500),(300,650),0.5,50) works great but a complex movement from a to b to c doesn't work trying with that device.touch(100,500, 'DOWN') device.touch(300,500, 'MOVE') device.touch(300,400, 'MOVE') device.touch(300,400, 'UP') Was seaching for a solution and found this.. https://android-review.googlesource.com/#/c/50991/ Is this already implemenet in the offical android sdk? or did i

Android monkey runner: Touch with MOVE

自作多情 提交于 2019-12-18 07:15:05
问题 I am trying to use monkeyrunner to simulate complex touch events. A swipe from a to b with... device.drag((300,500),(300,650),0.5,50) works great but a complex movement from a to b to c doesn't work trying with that device.touch(100,500, 'DOWN') device.touch(300,500, 'MOVE') device.touch(300,400, 'MOVE') device.touch(300,400, 'UP') Was seaching for a solution and found this.. https://android-review.googlesource.com/#/c/50991/ Is this already implemenet in the offical android sdk? or did i

monkeyrunner的图片对比

╄→гoц情女王★ 提交于 2019-12-17 14:44:16
环境安装: jdk、android sdk、python编译器 安装基本是傻瓜式的,主要是配环境变量 注意:下载完整的android sdk,有些简化包没有monkeyrunner工具 用Python编写测试脚本,然后执行 py文件内容如下: from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice, MonkeyImagedevice = MonkeyRunner.waitForConnection()#读取本地的图片result = MonkeyRunner.loadImageFromFile('D:\\android_sdk_ceshi\\Test.png')#循环对比截图和本地图片for i in range(5): MonkeyRunner.sleep(2) device.touch(50, 150, 'DOWN_AND_UP') MonkeyRunner.sleep(5) image = device.takeSnapshot() if image.sameAs(result,0.5): print('success') else: print('fail')#返回初始页面 device.touch(0, 0, 'DOWN_AND_UP') MonkeyRunner.sleep(1) device

Monkeyrunner介绍

时间秒杀一切 提交于 2019-12-17 07:23:16
Monkeyrunner概述 Monkeyrunner是由Google开发、用于android系统的自动化测试工具,由android系统自带,存在于android sdk中(sdk:software development kit,软件开发工具包) Monkeyrunner提供了一个API,用此API写出的程序可以在Android代码之外控制Android设备和模拟器。(API: Application Programming Interface 应用 程序接口) Monkeyrunnerd主要设计目的:用于测试功能/框架水平上的应用程序和设备,或运行单元测试套件。 Monkeyrunner通过运行python脚本,来执行脚本中预先定义好的一系列操作事件,如:安装卸载某个应用、进入任一模块、点坐标、按键、编辑文本、截图对比等 Monkeyrunner API类别 MonkeyRunner为MonkeyRunner程序提供工具方法的类。 这个类提供了用于连接MonkeyRunner至设备或模拟器的方法。 它还提供了用于创建一个MonkeyRunner程序的用户界面以及显示内置帮助的方法。 MonkeyDevice表示一个设备或模拟器。 这个类提供了安装和卸载程序包、启动一个活动以及发送键盘或触摸事件到应用程序 的方法。您也可以用这个类来运行测试包。 MonkeyImage