<dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><s id="yhprb"><strike id="yhprb"></strike></s></dfn><small id="yhprb"></small><dfn id="yhprb"></dfn><small id="yhprb"><delect id="yhprb"></delect></small><small id="yhprb"></small><small id="yhprb"></small> <delect id="yhprb"><strike id="yhprb"></strike></delect><dfn id="yhprb"></dfn><dfn id="yhprb"></dfn><s id="yhprb"><noframes id="yhprb"><small id="yhprb"><dfn id="yhprb"></dfn></small><dfn id="yhprb"><delect id="yhprb"></delect></dfn><small id="yhprb"></small><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn> <small id="yhprb"></small><delect id="yhprb"><strike id="yhprb"></strike></delect><dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"><s id="yhprb"><strike id="yhprb"></strike></s></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn>

新聞中心

EEPW首頁(yè) > 嵌入式系統 > 設計應用 > Android壓力測試Monkey工具

Android壓力測試Monkey工具

作者: 時(shí)間:2016-10-08 來(lái)源:網(wǎng)絡(luò ) 收藏

最近在A(yíng)ndroid程序測試過(guò)程中接觸到了自動(dòng)化測試方法,對其中的一些工具、方法和框架做了一些簡(jiǎn)單的整理,其中包括android測試框架、CTS、Monkey、Monkeyrunner其它test tool等等。因接觸時(shí)間很短,很多地方有不足之處,希望能和大家多多交流和指點(diǎn)在這里簡(jiǎn)單對monkey做簡(jiǎn)單的介紹吧。

本文引用地址:http://dyxdggzs.com/article/201610/305869.htm

一、 什么是Monkey

Monkey是Android中的一個(gè)命令行工具,可以運行在模擬器里或實(shí)際設備中。它向系統發(fā)送偽隨機的用戶(hù)事件流(如按鍵輸入、觸摸屏輸入、手勢輸入等),實(shí)現對正在開(kāi)發(fā)的應用程序進(jìn)行壓力測試。Monkey測試是一種為了測試軟件的穩定性、健壯性的快速有效的方法。

二、 Monkey的特征

1、測試的對象僅為應用程序包,有一定的局限性。

2、 Monky測試使用的事件流數據流是隨機的,不能進(jìn)行自定義。

3、可對MonkeyTest的對象,事件數量,類(lèi)型,頻率等進(jìn)行設置。

三、Monkey的基本用法

基本語(yǔ)法如下:

$ adb shell monkey [options]

如果不指定options,Monkey將以無(wú)反饋模式啟動(dòng),并把事件任意發(fā)送到安裝在目標環(huán)境中的全部包。下面是一個(gè)更為典型的命令行示例,它啟動(dòng)指定的應用程序,并向其發(fā)送1500個(gè)偽隨機事件:

$ adb shell monkey -p your.package.name -v 1500

$ monkey -p(package的意思) 指定文件名 -v(測試的次數和頻率) number(次數)

四、Monkey測試的一個(gè)實(shí)例

通過(guò)這個(gè)實(shí)例,我們能理解Monkey測試的步驟以及如何知道哪些應用程序能夠用Monkey進(jìn)行測試。

Windows下(注:2—4步是為了查看我們可以測試哪些應用程序包,可省略):

1、 通過(guò)eclipse啟動(dòng)一個(gè)Android的emulator

2、 在命令行中輸入:adb devices查看設備連接情況

C:Documents and SettingsAdministrator>adb devices

List of devices attached

emulator-5554 device

3、 在有設備連接的前提下,在命令行中輸入:adb shell 進(jìn)入shell界面

C:Documents and SettingsAdministrator>adb shell

#

4、 查看data/data文件夾下的應用程序包。注:我們能測試的應用程序包都在這個(gè)目錄下面

C:Documents and SettingsAdministrator>adb shell

# ls data/data

ls data/data

com.google.android.btrouter

com.android.providers.telephony

com.android.mms

com.android.providers.downloads

com.android.deskclock

com.android.email

com.android.providers.media

com.android.settings

jp.co.omronsoft.openwnn

com.android.providers.userdictionary

com.android.quicksearchbox

com.android.protips

com.android.browser

com.android.launcher

com.android.term

com.android.speechrecorder

com.android.server.vpn

com.android.defcontainer

com.svox.pico

com.android.customlocale

com.android.development

com.android.soundrecorder

com.android.providers.drm

com.android.spare_parts

com.android.providers.downloads.ui

com.android.fallback

com.android.providers.applications

com.android.netspeed

com.android.wallpaper.livepicker

android.tts

com.android.htmlviewer

com.android.music

com.android.certinstaller

com.android.inputmethod.pinyin

com.android.providers.subscribedfeeds

com.android.inputmethod.latin

com.android.gallery

com.android.systemui

com.android.contacts

com.android.phone

com.android.sdksetup

com.android.calculator2

com.android.packageinstaller

com.android.camera

com.android.providers.settings

com.thestore.main

com.android.providers.contacts

5、 以com.android.camera作為對象進(jìn)行MonkeyTest

#monkey -p com.android.camera -v 500

其中-p表示對象包 –v 表示事件數量

運行過(guò)程中,Emulator中的應用程序在不斷地切換畫(huà)面。

按照選定的不同級別的反饋信息,在Monkey中還可以看到其執行過(guò)程報告和生成的事件。

注:具體參數的設定可參考:

http://developer.android.com/guide/developing/tools/monkey.html

五、關(guān)于Monkey測試的停止條件

Monkey Test執行過(guò)程中在下列三種情況下會(huì )自動(dòng)停止:

1、如果限定了Monkey運行在一個(gè)或幾個(gè)特定的包上,那么它會(huì )監測試圖轉到其它包的操作,并對其進(jìn)行阻止。

2、如果應用程序崩潰或接收到任何失控異常,Monkey將停止并報錯。

3、如果應用程序產(chǎn)生了應用程序不響應(application not responding)的錯誤,Monkey將會(huì )停止并報錯。

通過(guò)多次并且不同設定下的Monkey測試才算它是一個(gè)穩定性足夠的程序。



關(guān)鍵詞:

評論


相關(guān)推薦

技術(shù)專(zhuān)區

關(guān)閉
国产精品自在自线亚洲|国产精品无圣光一区二区|国产日产欧洲无码视频|久久久一本精品99久久K精品66|欧美人与动牲交片免费播放
<dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><s id="yhprb"><strike id="yhprb"></strike></s></dfn><small id="yhprb"></small><dfn id="yhprb"></dfn><small id="yhprb"><delect id="yhprb"></delect></small><small id="yhprb"></small><small id="yhprb"></small> <delect id="yhprb"><strike id="yhprb"></strike></delect><dfn id="yhprb"></dfn><dfn id="yhprb"></dfn><s id="yhprb"><noframes id="yhprb"><small id="yhprb"><dfn id="yhprb"></dfn></small><dfn id="yhprb"><delect id="yhprb"></delect></dfn><small id="yhprb"></small><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn> <small id="yhprb"></small><delect id="yhprb"><strike id="yhprb"></strike></delect><dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"><s id="yhprb"><strike id="yhprb"></strike></s></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn>