Introducing Native Driver for Android; iPhone (iOS) Version Coming Soon!

NativeDriver is an implementation of the WebDriver API which drives the UI of a native application rather than a web application. Matt DeVore, Google's Engineering Productivity Team announced that the Android version is now available for download.Also, an iPhone (iOS) version is under development and will be available soon."Android NativeDriver uses Instrumentation to monitor and […]

NativeDriver is an implementation of the WebDriver API which drives the UI of a native application rather than a web application. Matt DeVore, Google's Engineering Productivity Team announced that the Android version is now available for download.

Also, an iPhone (iOS) version is under development and will be available soon.

"Android NativeDriver uses Instrumentation to monitor and manipulate the application under test. Instrumentation is a standard feature of Android but it has some limitations. For instance, it cannot drive UI which's part of another process. (If it could a malicious app could hijack the device.) This's where ADB saves the day. The ADB is a connection from outside the device and isn't tied to a particular app, so with it we can inject events across apps. ADB also made it possible to add screenshot support, and we plan to utilize it in new ways as NativeDriver matures. This's one way Android NativeDriver tests are more powerful than standard Instrumentation tests," DeVore explains.

google cites following reasoning why anyone would use the WebDriver API to test native applications:

  • user interactions with a native app and a web app are essentially the same: click, type, switch window, read text
  • test writers will've to write the same test for each platform they want to support
  • no one wants to learn yet another API
  • WebDriver already has a user base and a tool ecosystem that can migrate easily to a new API if it's WebDriver-like
  • therefore: let's re-use our favorite UI testing API

In the video below you can see a NativeDriver test against the Google Maps Android app:

You can try out Android NativeDriver right away with the tutorials for running a sample test or instrumenting your own app.

[Source: Open Source at Google]