BT

Your opinion matters! Please fill in the InfoQ Survey!

Native Mobile Apps Test Automation with NativeDriver

| by Abel Avram Follow 4 Followers on Jun 23, 2011. Estimated reading time: 1 minute |

A note to our readers: As per your request we have developed a set of features that allow you to reduce the noise, while not losing sight of anything that is important. Get email and web notifications by choosing the topics you are interested in.

NativeDriver offers test automation for Android and iOS native applications. It implements the WebDriver API.

Google has created NativeDriver, an implementation of the WebDriver API, a test automation framework that uses the native UI instead of a browser UI, as Selenium does, to run functional tests on an application. Google has decided to reuse the WebDriver API for native applications instead of creating a new one due to many similarities between them - they both control the same UI operations such as click, type, read text, switch window-, and users familiar with WebDriver do not need to learn another API and can start using NativeDriver immediately.

NativeDriver can be used to perform automated UI commands in a native application in order to test how the application behaves under various conditions. On Android, NativeDriver uses Instrumentation, a mechanism for programmatically controlling various OS components outside of their natural functioning cycle inside of an application. An example of a simple NativeDriver test looks like this:

AndroidNativeDriver driver = new AndroidNativeDriverBuilder().withDefaultServer().build();
driver.startActivity("com.google.android.maps.MapsActivity");
// Open the Places activity by clicking the places button (to the right of the search box)
AndroidNativeDriver btn= driver.findElement(By.id("btn_header_places"));
btn.click();
// Dismiss the Places window. Equivalent to pressing the Android Back button
driver.navigate().back();
// Rotate the device to show the UI in landscape mode
driver.rotate(ScreenOrientation.LANDSCAPE);

Currently only the Android version is available, but Google promises to release an iOS version soon. Also, a Windows version is in a prototype phase.

Beside this test framework for mobile OSes, Google made available the WebDriver for mobile browsers, which offers testing support for web applications running in a browser on Android, iOS, and there is project started for Blackberry.

Rate this Article

Adoption Stage
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread
Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Discuss

Login to InfoQ to interact with what matters most to you.


Recover your password...

Follow

Follow your favorite topics and editors

Quick overview of most important highlights in the industry and on the site.

Like

More signal, less noise

Build your own feed by choosing topics you want to read about and editors you want to hear from.

Notifications

Stay up-to-date

Set up your notifications and don't miss out on content that matters to you

BT