An Introduction to Appium

Appium is an open-source framework for testing native, mobile web, and hybrid applications on iOS and Android mobile devices, emulators, and simulators. Native apps are those written using the iOS or Android SDKs. Mobile web apps are web apps accessed using a mobile browser. For automating mobile web apps, Appium supports Safari on iOS and Chrome or the built-in 'Browser' app on Android. Hybrid apps have a native container wrapped around a "webview" -- a special control that enables interaction with web content via an invisible web browser embedded into an application.

Appium is "cross-platform": it allows you to write tests against multiple platforms (iOS, Android), using the same API. This enables code reuse between iOS and Android testsuites.

Appium Philosophy

Appium is very opinionated! In fact, Appium was designed from the outset to meet mobile automation needs according to a philosophy outlined by the following four tenets:

  1. You shouldn't have to recompile your app or modify it in any way in order to automate it.
  2. You shouldn't be locked into a specific language or framework to write and run your tests.
  3. A mobile automation framework shouldn't reinvent the wheel when it comes to automation APIs.
  4. A mobile automation framework should be open source, in spirit and practice as well as in name!

So how does the structure of the Appium project live out this philosophy? It meets requirement #1 by using vendor-provided automation frameworks under the hood. That way, it doesn't need to compile in any Appium-specific or third-party code or frameworks to your app. This means you're testing the same app you're shipping. The vendor-provided frameworks Appium uses are:

  • iOS: Apple's UIAutomation
  • Android 4.2+: Google's UiAutomtor
  • Android 2.3+: Google's Instrumentation. (Instrumentation support is provided by bundling a separate project, Selendroid)

Appium meets requirement #2 by wrapping the vendor-provided frameworks in one API, the WebDriver API. WebDriver (aka "Selenium WebDriver") specifies a client-server protocol (known as the JSON Wire Protocol). Given this client-server architecture, a client written in any language can be used, since every language supports HTTP calls. There are already clients written in every popular programming language. This also means that you're free to use whatever test software you want; the client libraries are simply HTTP clients and can be mixed into your code any way you please. In other words, Appium is simply a "automation libraries". You can manage your test environment any way you like!

Appium meets requirement #3 in the same way: WebDriver has become the de facto standard for automating web browsers, and is a W3C Working Draft. There's no reason to build a totally new automation API for mobile. Instead Appium has extended the protocol with extra API methods useful for mobile automation.

#4 should be a given. Appium is well and truly open source!

Sauce Labs has the best Appium cloud support available, and contributes more than any other vendor to the development of the project. If you're curious about how to get started writing tests for your mobile application using Appium, be sure to check out our Appium Bootcamp!