Вы находитесь на странице: 1из 10
Test (Automation) for Mobile Phone Applications for StarEast 2011 Julian Harty 10 Apr 2011 1
Test (Automation) for
Mobile Phone Applications
for StarEast 2011
Julian Harty
10 Apr 2011
1
Client Applications 2
Client Applications
2
What are Client Applications? Software that installs on a computer / device Typically compiled 3
What are Client Applications?
Software that installs on a computer / device
Typically compiled
3
Mobile Programming Languages Language 1 st Class Citizen 2 nd Class Citizen C, C++ Bada, Brew
Mobile Programming Languages
Language
1 st Class Citizen
2 nd Class Citizen
C, C++
Bada, Brew MP, MeeGo, Symbian,
Windows Phone Classic
Android (NDK), iOS, webOS
(all partly supported)
C
Windows Phone & Windows Phone
Classic
Java
Android, BlackBerry, Java ME
Symbian, Windows Phone Classic
JavaScript
webOS
BlackBerry (Widget), Nokia (WRT)
Objective-C
iOS
Roots of Mobile Programming Languages
Table based on data in Mobile Developer's Guide 7 th edition http://www.enough.de
4
Building Client applications Client applications are difficult to build & test Unit test tools generally less
Building Client applications
Client applications are difficult to build & test
Unit test tools generally less mature
UI code hard to automatically test
Tested on emulators and on devices
Sometimes entirely different executables e.g.
Symbian applications
5
Test strategy for client applications Unit testing System testing when practical Manual testing on devices Use
Test strategy for client applications
Unit testing
System testing when practical
Manual testing on devices
Use emulators with network analyzers
Custom clients help:
Diagnose client capabilities
Identify and isolate the cause of problems
Model-based testing helps drive the client
6
Unit testing frameworks Exists for the key mobile platforms: Platform Framework iOS Unnamed[0] Android JUnit 3.x
Unit testing frameworks
Exists for the key mobile platforms:
Platform
Framework
iOS
Unnamed[0]
Android
JUnit 3.x
BlackBerry
J2MEUnit
[1]
J2ME
J2MEUnit
[2]
Intrinsic
Yes
Yes
No - opensource
No - opensource
[0] Older versions of iOS relied on opensource frameworks such as OCUnit
[1] Customised versions used e.g.
http://www.logicmail.org/browser/trunk/J2MEUnit Other options are also
available e.g. btest
[2] Some manufacturers provide other options e.g. Sony Ericsson, and other
opensource options are available.
7
System testing Android: ! Instrumentation ! Robotium ! TEMA http://tema.cs.tut.fi/ iPhone: UIAutomation for IOS 4 J2ME:
System testing
Android:
!
Instrumentation
!
Robotium
!
TEMA http://tema.cs.tut.fi/
iPhone: UIAutomation for IOS 4
J2ME: http://code.google.com/p/jinjector/
Breaking news:
Google engineers demonstrated proof-of-concept code @
Selenium Conference on 6 th April 2011, which implements the
WebDriver protocol to test native client applications for Android,
iOS and other mobile platforms. Cross-platform opensource
mobile test automation!
8
Robotium It's like Selenium, but for Android™ Open Source http://code.google.com/p/robotium/ Based on Android's Test Instrumentation Framework
Robotium
It's like Selenium, but for Android™
Open Source http://code.google.com/p/robotium/
Based on Android's Test Instrumentation Framework
Simplifies and reduces the amount of test automation code while
increasing the capabilities of the automation
9
Example Robotium Code private Solo solo; protected void setUp() throws Exception { solo = new Solo(getInstrumentation(),
Example Robotium Code
private Solo solo;
protected void setUp() throws Exception {
solo = new Solo(getInstrumentation(), getActivity())
}
public void testOpenHelp(){
solo.clickOnButton("Help");
boolean lableIsShown = solo.searchText("Instructions for the DAISY player");
//The // is to state that ( should not be treated as a special reg ex symbol
boolean scrolledTextIsShown = solo.searchText(
"and sections \\(where the depth might be level 2\\)");
solo.clickOnButton("Close Instructions")
assertTrue("Lable is not shown", lableIsShown);
assertTrue("Last part of text is not shown", scrolledTextIsShown);
}
10
From: DaisyReaderTest.java
Using emulators Over-the-air (OTA) emulator Wireless program network Internet Web GPRS network server modem Host operating
Using emulators Over-the-air (OTA)
emulator
Wireless
program
network
Internet
Web
GPRS
network
server
modem
Host operating
Carrier
system
network
We can combine the emulator with OTA
Disable non-essential network traffic
13
Simplifying the Problem 14
Simplifying the Problem
14
Probes A good way to discover the capabilities and quirks of the client device Rough and
Probes
A good way to discover the capabilities and quirks of the
client device
Rough and Ready applications that explore the
capabilities (and limitations) of devices, platforms, etc.
Design them to report information back faithfully
Take advantage of network connectivity to report results
to a central server
15
Examples of Prober clients Examples of tests: JSR support Effect of signing Size of application RMS
Examples of Prober clients
Examples of tests:
JSR support
Effect of signing
Size of application
RMS access
Memory management
Performance characteristics
16
'Headless' Clients A variation on Prober Clients Headless applications don't include a pretty UI Consists of:
'Headless' Clients
A variation on Prober Clients
Headless applications don't include a pretty UI
Consists of:
core application logic
networking stack
a minimal UI
Should be a thin wrapper around core code
Helps test carrier, and some device & platform bugs
e.g. the network communications
17
Signature testing Signature testing is a way to simplify the diagnosis of problems, for instance by
Signature testing
Signature testing is a way to simplify the diagnosis of
problems, for instance by creating a desktop application that
emulates the network characteristics of the mobile application
that's encountered problems.
Signature testing can:
Help identify and isolate network, carrier and server issues
Reuse the non-UI client code
We can vary the signature, ideally with minimal effort, to
ascertain how the behavior varies, and to find a sweet-spot of
reliable behavior for the mobile application.
c.f.: The 'Turing Test' and emulation for fresh ideas
18