Using the Monkey command to operate the screen fast sliding _python

Source: Internet
Author: User

Introduction of Monkey Test

Monkey Test is an Android platform automated testing means, through the Monkey program simulation of User touch screen, sliding trackball, buttons, and other operations to the device on the pressure test procedures, the detection of how long time will occur abnormal.

Ii. Introduction of Monkey procedure

1 Monkey Program is brought by the Android system, written in the Java language, in the Android file system storage path is:/system/framework/monkey.jar;

2 The Monkey.jar program is initiated by a shell script called "Monkey", where the shell script is stored in the Android file system:/system/bin/monkey; This can be done through the cmd window: adb Shell Monkey {+ command parameters} for monkey testing.

There are more than 10 kinds of item in the list, and there are several heavy-duty controls that have an infinite scrolling horizontal banner and a Taobao headline-like control that can scroll infinitely vertically. Worry about memory leaks or other problems, so use the Mokey test to quickly slide to discover hidden problems.



View the Android Monitor memory is also released

The test code is as follows

The code is as follows

#!/usr/bin/env monkeyrunner
Import time
from import Monkeyrunner, Monkeydevice
device = monkeyrunner.waitforconnection (5)
# fling up
def scrollupfling ():
Device.touch (100, 500, Monkeydevice.down)
Device.touch (MB, monkeydevice.move)
Device.touch (MB, monkeydevice.up)
Print "Fling Up"
# Fling down
def scrolldownfling ():
Device.touch (MB, monkeydevice.down)
Device.touch (M, monkeydevice.move)
Device.touch (+, monkeydevice.up)
print "Fling Down"
Def Fling (): For
I in range (1,1000):
scrollupfling ()
Time.sleep (0.1)
scrolldownfling (
) Time.sleep (0.1)
Fling ()

The above is a small set to introduce the use of Monkey command operation screen Fast sliding, I hope to help everyone, if you have any questions please give me a message, small series will promptly reply to everyone. Here also thank you very much for the cloud Habitat Community website support!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.