Skip to Content
Android Developer Tools深入精要
book

Android Developer Tools深入精要

by Mike Wolfson
July 2014
Intermediate to advanced
248 pages
5h 19m
Chinese
GoTop Information, Inc.
Content preview from Android Developer Tools深入精要
Monkeyrunner
|
217
monkeyrunner
工具是一個
Java
程式,跟其他工具一樣可以在
${android.home}/tools
料夾內找到它;要執行它,新建一組你想模擬的指令接著傳進工具中,這是一個指令
化應用程式(
scripted application
),所以我們需要給該工具命令列表以供其執行;你
可以在互動模式中一次執行一個指令,或者也可以新建一個指令碼檔案而同時執行一
組指令。
你可以利用
monkeyrunner
做到更多,它提供自動化的工具平台,這使得重複一個
UI
操作變得更簡單;因為它可以在多種裝置間執行,這也使得按標準檢驗功能性測試變
得更容易。
使用
Python
產生指令檔
該工具開發人員選擇使用現存名為
Python
的語言而不是創造另一個腳本語言;使用
Python
語言是合理的,因為它是一個強大且流行的語言;它是一個動態的程式語言,
被設計於專注在產生清楚、可讀且具模組化及可擴充的程式碼;
Python
結合許多實用
與物件導向的概念,而使得它可以很容易地表達程序化的程式;更多有關
Python
語言
的介紹已超出本書的範圍,不過我們可以透過一個簡單的
monkeyrunner
腳本來介紹如
何使用;即使不知道
Python
你仍可以遵循。
[Page-222]
我們會透過一個簡單的例子介紹如何安裝一個應用程式、執行一個
activity
、取得功能
表選項的螢幕截圖,並且儲存該螢幕截圖以供之後檢視。
#menu_script.py
#
com.android.monkeyrunner ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Android 高效能多執行緒

Android 高效能多執行緒

Anders Goransson
深入淺出 jQuery

深入淺出 jQuery

Ryan Benedetti, Ronan Cranley
HTML5 錦囊妙計

HTML5 錦囊妙計

Christopher Schmitt, Kyle Simpson

Publisher Resources

ISBN: 9789863470861