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语言程序的一些基本特征. 如果你能知道该程序将会在显示器上显示一些内容,那说明你还是知道一些的! ...
随机推荐
- 事务的隔离级别及mysql对应操作
/* 本次高并发解决之道 1,更改事务隔离级别为 read uncommitted读未提交 2,查询前设定延迟,延迟时间为随机 50-500 微秒 3,修改数据前将 超范围作为 限定修改条件 事务是作 ...
- 使用Jil序列化JSON提升Asp.net web api 性能
JSON序列化无疑是Asp.net web api 里面性能提升最重要的一环. 在Asp.net web api 里面我们可以插入自定义的MediaTypeFormatter(媒体格式化器), 说白了 ...
- jqeury轮播
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta http ...
- jquery 判断checkbox是否为空的三种方法
//方法一: if ($("#checkbox-id")get(0).checked) { // do something } //方法二:也适用于单选按钮 if($('#chec ...
- hdu 2053 Switch Game 水题一枚,鉴定完毕
Switch Game Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total ...
- CentOS 安装SolrCloud
1.什么是SolrCloud SolrCloud(solr 云)是Solr提供的分布式搜索方案,当你需要大规模,容错,分布式索引和检索能力时使用 SolrCloud.当一个系统的索引数据量少的时候是不 ...
- Java提高篇---Stack
在Java中Stack类表示后进先出(LIFO)的对象堆栈.栈是一种非常常见的数据结构,它采用典型的先进后出的操作方式完成的.每一个栈都包含一个栈顶,每次出栈是将栈顶的数据取出,如下: Stack通过 ...
- 解决maven项目将model version改成3.0版本问题
找到项目目录,找到.setting文件 找到org.eclipse.wst.common.project.facet.core.xml文件 修改如下标签 <installed facet=&qu ...
- 土豪聪要请客(stol)
土豪聪要请客(stol) 众所周知,聪哥(ndsf)是个土豪,不过你们不知道的是他的MZ和他的RMB一样滴多…… 某天土豪聪又赚了10^10000e的RMB,他比较开心,于是准备请客.他在自己在XX星 ...
- Redis的WEB界面管理工具phpRedisAdmin
下载地址:http://down.admin5.com/php/75024.html 官方网址:https://github.com/ErikDubbelboer/phpRedisAdmin