Monkey学习(4)简单测试实例
1、首先测试设备是否连接成功,在命令行中输入:
adb devices
如果出现设备信息,代表链接成功。我这里的设备名称是“emulator-5554”
2、得到测试apk的包名,如果有APK源码包的话直接将“.apk”后缀改为“.zip”然后打开包中的AndroidManifest.xml可以查看包名,
如果没有或者已经安装的点击应用程序,然后查看logcat信息,也能够找到包名,同时在/data/data/目录下面有全部的应用程序的包名,
查询命令是:
adb shell
#cd /data/data
#ls
我们要测试的包名为:com.chaozh.iReaderFree
3、设定参数
首先用一个最简单的例子分析
adb shell monkey -p com.chaozh.iReaderFree -v -v -v 100
-p参数:表示指定测试的程序
-v参数:表示查看Monkey生成的一些详细的随机的事件名 数字100:表示测试事件数为100
4、结果分析
F:\>adb shell monkey -p com.chaozh.iReaderFree -v -v -v 100
:Monkey: seed=0 count=100
:AllowPackage: com.chaozh.iReaderFree
:IncludeCategory: android.intent.category.LAUNCHER
:IncludeCategory: android.intent.category.MONKEY
// Selecting main activities from category android.intent.category.LAUNCHER
//(百度翻译)选择主要活动范畴android.intent.category.launcher
// 查看下方显示的信息,加黑部分,发现 (from package com.chaozh.iReaderFree)包前面是“+”号,代表这个包是活动的,就是咱们现在正在测试的
// - NOT USING main activity com.android.calendar.AllInOneActivity (from packa
ge com.android.calendar)
// - NOT USING main activity com.android.music.MusicBrowserActivity (from pack
age com.android.music)
// - NOT USING main activity com.android.deskclock.DeskClock (from package com
.android.deskclock)
// - NOT USING main activity com.android.mms.ui.ConversationList (from package
com.android.mms)
// - NOT USING main activity com.android.email.activity.Welcome (from package
com.android.email)
// - NOT USING main activity com.android.camera.GalleryPicker (from package co
m.android.gallery)
// - NOT USING main activity com.android.settings.Settings (from package com.a
ndroid.settings)
// - NOT USING main activity com.android.browser.BrowserActivity (from package
com.android.browser)
// - NOT USING main activity com.android.camera.Camera (from package com.andro
id.camera)
// - NOT USING main activity com.android.contacts.activities.DialtactsActivity
(from package com.android.contacts)
// - NOT USING main activity com.android.contacts.activities.PeopleActivity (f
rom package com.android.contacts)
// - NOT USING main activity com.example.android.apis.ApiDemos (from package c
om.example.android.apis)
// - NOT USING main activity com.android.widgetpreview.WidgetPreviewActivity (
from package com.android.widgetpreview)
// - NOT USING main activity com.android.gesture.builder.GestureBuilderActivit
y (from package com.android.gesture.builder)
// + Using main activity com.chaozh.iReader.ui.activity.WelcomeActivity (from
package com.chaozh.iReaderFree)
// - NOT USING main activity com.android.customlocale2.CustomLocaleActivity (f
rom package com.android.customlocale2)
// - NOT USING main activity com.android.providers.downloads.ui.DownloadList (
from package com.android.providers.downloads.ui)
// - NOT USING main activity com.android.quicksearchbox.SearchActivity (from p
ackage com.android.quicksearchbox)
// - NOT USING main activity com.android.calculator2.Calculator (from package
com.android.calculator2)
// - NOT USING main activity com.android.speechrecorder.SpeechRecorderActivity
(from package com.android.speechrecorder)
// - NOT USING main activity com.android.development.Development (from package
com.android.development)
// - NOT USING main activity com.example.redmi.MainActivity (from package com.
example.redmi)
// - NOT USING main activity com.example.android_image.MainActivity (from pack
age com.example.android_image)
// - NOT USING main activity com.example.android_mp3.MainActivity (from packag
e com.example.android_mp3)
// - NOT USING main activity com.wiseweb.activity.Splash (from package com.wis
eweb.movie)
// Selecting main activities from category android.intent.category.MONKEY
// - NOT USING main activity com.android.launcher2.Launcher (from package com.
android.launcher)
// - NOT USING main activity com.android.settings.Settings$RunningServicesActi
vity (from package com.android.settings)
// - NOT USING main activity com.android.settings.Settings$StorageUseActivity
(from package com.android.settings)
// Seeded: 0
// Event percentages:
//(百度翻译)事件百分比
// 分别代表的意思如下 0~9 ,都是百度翻译的,不知道正确与否
// 0::[--pct-touch PERCENT] → 触摸百分比
// 1和2:[--pct-motion PERCENT] → 运动百分比
// 3:[--pct-trackball PERCENT] → 追踪球百分比
// 4:[--pct-syskeys PERCENT] → syskeys百分比
// 5:[--pct-nav PERCENT] → 网络百分比
// 6:[--pct-majornav PERCENT] → 主要网络百分比
// 7:[--pct-appswitch PERCENT] → app转换百分比
// 8:[--pct-flip PERCENT] → 翻转百分比
// 9:[--pct-anyevent PERCENT] → 任何情况百分比
// 0: 15.0%
// 1: 10.0%
// 2: 2.0%
// 3: 15.0%
// 4: 25.0%
// 5: 15.0%
// 6: 2.0%
// 7: 2.0%
// 8: 1.0%
// 9: 13.0%
//表示跳转到com.chaozh.iReaderFree里面的Gallery这一个Activity
:Switch: #Intent;action=android.intent.action.MAIN;category=android.intent.categ
ory.LAUNCHER;launchFlags=0x10000000;component=com.chaozh.iReaderFree/com.chaozh.
iReader.ui.activity.WelcomeActivity;end
//表示在com.chaozh.iReaderFree包上允许启动程序(act=...)
// Allowing start of Intent { act=android.intent.action.MAIN cat=[android.in
tent.category.LAUNCHER] cmp=com.chaozh.iReaderFree/com.chaozh.iReader.ui.activit
y.WelcomeActivity } in package com.chaozh.iReaderFree
//表示睡眠的时间0毫秒,直接开始,然后开始发送一系列指令,如点击、放开、移动
//可以用--throttle来设置一个起效的事件发生后时延时
Sleeping for 0 milliseconds
:Sending Key (ACTION_DOWN): 22 // KEYCODE_DPAD_RIGHT
:Sending Key (ACTION_UP): 22 // KEYCODE_DPAD_RIGHT
Sleeping for 0 milliseconds
:Sending Key (ACTION_DOWN): 23 // KEYCODE_DPAD_CENTER
:Sending Key (ACTION_UP): 23 // KEYCODE_DPAD_CENTER
Sleeping for 0 milliseconds
:Sending Flip keyboardOpen=false
Sleeping for 0 milliseconds
:Sending Key (ACTION_DOWN): 20 // KEYCODE_DPAD_DOWN
:Sending Key (ACTION_UP): 20 // KEYCODE_DPAD_DOWN
Sleeping for 0 milliseconds
:Sending Touch (ACTION_DOWN): 0:(153.0,207.0)
:Sending Touch (ACTION_UP): 0:(153.19875,207.49512)
Sleeping for 0 milliseconds
:Sending Key (ACTION_DOWN): 82 // KEYCODE_MENU
:Sending Key (ACTION_UP): 82 // KEYCODE_MENU
Sleeping for 0 milliseconds
:Sending Touch (ACTION_DOWN): 0:(267.0,244.0)
:Sending Touch (ACTION_UP): 0:(272.7109,242.90211)
Sleeping for 0 milliseconds
:Sending Trackball (ACTION_MOVE): 0:(-1.0,-1.0)
:Sending Trackball (ACTION_MOVE): 0:(-5.0,0.0)
:Sending Trackball (ACTION_MOVE): 0:(3.0,4.0)
:Sending Trackball (ACTION_MOVE): 0:(0.0,4.0)
:Sending Trackball (ACTION_MOVE): 0:(3.0,-5.0)
:Sending Trackball (ACTION_MOVE): 0:(-2.0,0.0)
:Sending Trackball (ACTION_MOVE): 0:(1.0,3.0)
:Sending Trackball (ACTION_MOVE): 0:(-5.0,-3.0)
:Sending Trackball (ACTION_MOVE): 0:(3.0,-3.0)
:Sending Trackball (ACTION_MOVE): 0:(-2.0,1.0)
:Sending Key (ACTION_DOWN): 20 // KEYCODE_DPAD_DOWN
:Sending Key (ACTION_UP): 20 // KEYCODE_DPAD_DOWN
Sleeping for 0 milliseconds
:Sending Key (ACTION_DOWN): 21 // KEYCODE_DPAD_LEFT
//拒绝此跳转,因为它是跳转的到非它自己的包的Activity,本测试中是指测试它程序所在的包,此跳转是跳出本程序,进入桌面。
// Allowing start of Intent { cmp=com.chaozh.iReaderFree/com.zhangyue.iReade
r.read.ui.Activity_BookBrowser_TXT } in package com.chaozh.iReaderFree
//继续发送指令
:Sending Key (ACTION_UP): 21 // KEYCODE_DPAD_LEFT
Sleeping for 0 milliseconds
:Sending Key (ACTION_DOWN): 46 // KEYCODE_R
:Sending Key (ACTION_UP): 46 // KEYCODE_R
Sleeping for 0 milliseconds
:Sending Key (ACTION_DOWN): 23 // KEYCODE_DPAD_CENTER
:Sending Key (ACTION_UP): 23 // KEYCODE_DPAD_CENTER
Sleeping for 0 milliseconds
:Sending Key (ACTION_DOWN): 21 // KEYCODE_DPAD_LEFT
:Sending Key (ACTION_UP): 21 // KEYCODE_DPAD_LEFT
Sleeping for 0 milliseconds
:Sending Trackball (ACTION_MOVE): 0:(1.0,-3.0)
:Sending Trackball (ACTION_MOVE): 0:(-5.0,3.0)
:Sending Trackball (ACTION_MOVE): 0:(-5.0,-1.0)
:Sending Trackball (ACTION_MOVE): 0:(2.0,-5.0)
:Sending Trackball (ACTION_MOVE): 0:(-2.0,2.0)
:Sending Trackball (ACTION_MOVE): 0:(-1.0,2.0)
:Sending Trackball (ACTION_MOVE): 0:(-4.0,-5.0)
:Sending Trackball (ACTION_MOVE): 0:(-3.0,-4.0)
:Sending Trackball (ACTION_MOVE): 0:(-2.0,2.0)
:Sending Trackball (ACTION_MOVE): 0:(1.0,3.0)
:Sending Key (ACTION_DOWN): 82 // KEYCODE_MENU
:Sending Key (ACTION_UP): 82 // KEYCODE_MENU
Sleeping for 0 milliseconds
:Sending Key (ACTION_DOWN): 178 // KEYCODE_TV_INPUT
:Sending Key (ACTION_UP): 178 // KEYCODE_TV_INPUT
Sleeping for 0 milliseconds
:Sending Trackball (ACTION_MOVE): 0:(-1.0,-2.0)
:Sending Trackball (ACTION_MOVE): 0:(4.0,3.0)
:Sending Trackball (ACTION_MOVE): 0:(-5.0,2.0)
:Sending Trackball (ACTION_MOVE): 0:(0.0,2.0)
:Sending Trackball (ACTION_MOVE): 0:(0.0,3.0)
:Sending Trackball (ACTION_MOVE): 0:(-4.0,0.0)
:Sending Trackball (ACTION_MOVE): 0:(-2.0,0.0)
:Sending Trackball (ACTION_MOVE): 0:(-4.0,2.0)
:Sending Trackball (ACTION_MOVE): 0:(2.0,1.0)
:Sending Trackball (ACTION_MOVE): 0:(-2.0,4.0)
:Sending Trackball (ACTION_DOWN): 0:(0.0,0.0)
:Sending Trackball (ACTION_UP): 0:(0.0,0.0)
Sleeping for 0 milliseconds
:Sending Key (ACTION_DOWN): 3 // KEYCODE_HOME
:Sending Key (ACTION_UP): 3 // KEYCODE_HOME
//表示在com.chaozh.iReaderFree包上允许启动程序(cmp=...),然后开始发送一系列指令,如点击、放开、移动
// Rejecting start of Intent { act=android.intent.action.MAIN cat=[android.i
ntent.category.HOME] cmp=com.android.launcher/com.android.launcher2.Launcher } i
n package com.android.launcher
Sleeping for 0 milliseconds
:Sending Touch (ACTION_DOWN): 0:(257.0,143.0)
:Sending Touch (ACTION_UP): 0:(248.47726,134.0601)
Sleeping for 0 milliseconds
:Sending Key (ACTION_DOWN): 126 // KEYCODE_MEDIA_PLAY
:Sending Key (ACTION_UP): 126 // KEYCODE_MEDIA_PLAY
Sleeping for 0 milliseconds
:Sending Key (ACTION_DOWN): 20 // KEYCODE_DPAD_DOWN
:Sending Key (ACTION_UP): 20 // KEYCODE_DPAD_DOWN
Sleeping for 0 milliseconds
:Sending Key (ACTION_DOWN): 21 // KEYCODE_DPAD_LEFT
:Sending Key (ACTION_UP): 21 // KEYCODE_DPAD_LEFT
Sleeping for 0 milliseconds
:Sending Trackball (ACTION_MOVE): 0:(-1.0,-2.0)
:Sending Trackball (ACTION_MOVE): 0:(1.0,1.0)
:Sending Trackball (ACTION_MOVE): 0:(-1.0,-2.0)
:Sending Trackball (ACTION_MOVE): 0:(4.0,2.0)
:Sending Trackball (ACTION_MOVE): 0:(3.0,4.0)
:Sending Trackball (ACTION_MOVE): 0:(2.0,-4.0)
:Sending Trackball (ACTION_MOVE): 0:(-5.0,-2.0)
:Sending Trackball (ACTION_MOVE): 0:(-4.0,-1.0)
:Sending Trackball (ACTION_MOVE): 0:(-4.0,-2.0)
:Sending Trackball (ACTION_MOVE): 0:(-2.0,3.0)
:Sending Touch (ACTION_DOWN): 0:(33.0,453.0)
:Sending Touch (ACTION_POINTER_DOWN 1): 0:(37.53572,452.94702) 1:(283.0,88.0)
:Sending Touch (ACTION_MOVE): 0:(38.494465,452.9393) 1:(289.34943,87.55577)
:Sending Touch (ACTION_POINTER_UP 1): 0:(44.913345,452.7924) 1:(295.43988,87.318
954)
:Sending Touch (ACTION_UP): 0:(47.022545,452.70322)
Sleeping for 0 milliseconds
:Sending Touch (ACTION_DOWN): 0:(300.0,208.0)
:Sending Touch (ACTION_MOVE): 0:(301.1697,213.4518)
:Sending Touch (ACTION_MOVE): 0:(304.233,218.98541)
:Sending Touch (ACTION_MOVE): 0:(305.48483,225.51746)
:Sending Touch (ACTION_MOVE): 0:(307.53262,234.67958)
:Sending Touch (ACTION_MOVE): 0:(310.49463,238.96536)
:Sending Touch (ACTION_MOVE): 0:(312.6929,247.50093)
:Sending Touch (ACTION_MOVE): 0:(314.07666,254.9053)
:Sending Touch (ACTION_MOVE): 0:(315.71674,256.64383)
:Sending Touch (ACTION_UP): 0:(318.2656,263.68002)
Sleeping for 0 milliseconds
:Sending Trackball (ACTION_MOVE): 0:(-1.0,-4.0)
:Sending Trackball (ACTION_MOVE): 0:(2.0,1.0)
:Sending Trackball (ACTION_MOVE): 0:(-5.0,2.0)
:Sending Trackball (ACTION_MOVE): 0:(2.0,-5.0)
:Sending Trackball (ACTION_MOVE): 0:(-4.0,-1.0)
//事件完成数100,丢弃的键 2 ,指针 3, 轨迹球 0 , 翻转 0
Events injected: 100
:Dropped: keys=2 pointers=3 trackballs=0 flips=0
//网络统计:共用 12388ms,其中12388ms用在手机上,0ms用来无线网上,没有连接的时间为0ms
## Network stats: elapsed time=12388ms (12388ms mobile, 0ms wifi, 0ms not connec
ted)
// Monkey finished
Monkey学习(4)简单测试实例的更多相关文章
- Rabbit简单测试实例
Rabbit简单测试实例 安装环境: Yum -y install python-pip Pip install pika 生产者 1 2 3 4 5 6 7 8 9 10 11 import pik ...
- spring再学习之简单测试
一.spring是怎么工作的那,通过一个类装载进容器进行描述: 首先创建一个类user: package cn.itcast.bean; public class User { public User ...
- C++动态链接库测试实例
前话 上一章节我导出了一个动态链接库 要使用该链接库,我们还需要该链接库对外公开的函数,即头文件 下面开始实例 测试实例 第一步--将动态链接库的dll.lib.和头文件导入项目中 文件目录如下: 项 ...
- Android studio测试软件——Monkey学习及运用
Android studio测试软件——Monkey学习及运用 在第十五周的个人博客上,王老师安排我们根据最终的团队大作业所用的软件(Android studio)进行软件测试的介绍,而我选择的是基于 ...
- Monkey学习(2)简单命令合集
Monkey命令的简单帮助 执行所有命令的前提是,必须先链接模拟器或者实体机,否则会报如下错误信息: 打开命令行窗口,WIN+R,输入CMD 在命令行窗口执行:adb shell monkey –he ...
- Javascript学习-简单测试环境
Javascript学习-简单测试环境 在<JavaScript忍者秘籍>2.4测试条件基础知识中,作者给出了一个精简版的assert和assert组的实现,对于初学者而言,这无疑是一个很 ...
- JMeter学习篇(一):测试实例讲解
1.JMeter的下载与安装 Jmeter官方下载地址:http://jmeter.apache.org/download_jmeter.cgi,下载jmeter是一个zip压缩包,解压后,直接运行a ...
- IIC驱动学习笔记,简单的TSC2007的IIC驱动编写,测试
IIC驱动学习笔记,简单的TSC2007的IIC驱动编写,测试 目的不是为了编写TSC2007驱动,是为了学习IIC驱动的编写,读一下TSC2007的ADC数据进行练习,, Linux主机驱动和外设驱 ...
- 【C语言C++编程学习笔记】基础语法,第一个简单的实例编程入门教程!
C语言/C++编程学习:一个简单的实例 让我们来看一个简单的C语言程序.从下面的程序可以看出编写C语言程序的一些基本特征. 如果你能知道该程序将会在显示器上显示一些内容,那说明你还是知道一些的! ...
随机推荐
- Greenplum的全量恢复之gpdbrestore
gpdbrestore命令是对gp_restore命令的一个包装,提供了更灵活的选项,比如,使用gpcrondump自动备份的文件来恢复.使用gpdbrestore恢复必须具备: 1. 存在gpcro ...
- Greenplum的全量备份之gpcrondump
gpcrondump是对gp_dump的一个包装,可以直接调用或者从crontab中调用.这个命令还允许备份除了数据库和数据之外的对象,比如数据库角色和服务器配置等. gpcrondump 常用到的参 ...
- java面试每日一题10
题目:利用递归方法求5! public class Recursion { public static void main(String args[]) throws NumberFormatExce ...
- css弹性盒子学习
css3弹性盒子是一种布局方式,在适应不同的屏幕大小的时候,能够确保元素拥有更恰当的排布行为.它只是视觉呈现上的,即显示顺序适应显示空间,与源代码无关,源代码顺序不受影响. 定义一个弹性盒子: 在cs ...
- YTU 3013: 皇后问题(递归)
3013: 皇后问题(递归) 时间限制: 1 Sec 内存限制: 128 MB 提交: 2 解决: 2 题目描述 编写一个函数,求解皇后问题:在n*n的方格棋盘上,放置n个皇后,要求每个皇后不同行 ...
- 参考_Android中,如何新建一个界面,并且实现从当前界面切换到到刚才新建的(另外一个)界面
参考地址: http://www.crifan.com/android_how_to_create_new_ui_and_switch_to_another_new_ui/ 想要实现,在Android ...
- Mix and Build(简单DP)
Mix and Build Time Limit: 5000MS Memory Limit: 65536K Total Submissions: 3936 Accepted: 1203 Case Ti ...
- 滑雪 分类: POJ 2015-07-23 19:48 9人阅读 评论(0) 收藏
滑雪 Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 83276 Accepted: 31159 Description Mich ...
- UML类图几种关系的总结(转)
原文:http://gjhappyyy.iteye.com/blog/1422515 在UML类图中,常见的有以下几种关系: 泛化(Generalization), 实现(Realization), ...
- C#事物执行数据
public class sqlservershiwu { public string sqlconString = "Data Source=.;Initial Catalog=TestD ...