Appium is an open source test automation tool developed and supported by Sauce Labs to automate native and hybrid mobile apps. It uses JSON wire protocol internally to interact with iOS and Android native apps using the Selenium WebDriver.
Automating hybrid and native mobile applications for Android and iOS is a key function handled by Appium, a node.js server. One of the core tenets of Appium is that test codes can be written in any framework or language like Ruby on Rails, C# and Java without having to modify the apps for automation purposes. The interaction between node.js server and Selenium client libraries is what ultimately works together with the mobile application. Appium is open source and can seamlessly run on a variety of devices and emulators making it an apt choice for mobile test automation.
At present Appium only supports Android and iOS based apps but support for Firefox mobile OS is in pipeline.
How Appium works in Android:
Appium runs on real devices and emulators. It takes the Selenium commands from your test code and translates them into a readable format for UIAutomator, using the WebDriver JSON Wire Protocol. UIAutomator is Android’s native UI automation framework which supports running JUnit test cases directly in to the device from the command line. It uses java as a programming language but Appium will make it run from any of the WebDriver supported languages.
- Android SDK API >= 16 (SDK < 16 in Selendroid mode)
- Mac OSX 10.7+ or Windows 7+ or Linux
Download and Launch the Appium Server
- Download Appium for windows from https://github.com/appium/appium/releases (AppiumForWindows-x.xx.x.zip)
- Unzip the AppiumForWindows-x.xx.x folder
- Open the Appium interface by double clicking on the Appium.exe in the Appium folder
- Run the server by clicking on the Launch button in the Appium interface
Not all server implementations will support every WebDriver feature. Therefore, the client and server should use JSON objects with the properties listed below when describing which features a user requests that a session support. If a session cannot support a capability that is requested in the desired capabilities, no error is thrown; a read-only capabilities object is returned that indicates the capabilities the session actually supports
· Appium Sever Capabilities
|App||The absolute local path or remote http URL to an .ipa or .apkfile, or a .zip containing one of these. Appium will attempt to install this app binary on the appropriate device first. Can also be one of chrome or chromium to launch Chrome or Chromium on Android, or safari to launch Mobile Safari on iOS. Note that this capability is not required for Android if you specify app-packageand app-activity capabilities (see below).||
http://myapp.com/app.ipa,chrome, chromium on Android, safari on iOS
|browserName||(for Selenium compatibility)||should always be ”; this exists because some clients require it to be sent|
|Device||The kind of mobile device or emulator to use||iphone, ipad, selendroid, firefoxos, android, mock_ios|
|Version||Android API version, iOS Version||
Android — 4.2/4.3
iOS — 6.0/6.1/7.0
· Android Only
|app-activity||Activity name for the Android activity you want to launch from your package||MainActivity, .Settings|
|app-package||Java package of the Android app you want to run||com.example.android.myApp,com.android.settings|
|app-wait-activity||Activity name for the Android activity you want to wait for||SplashActivity|
Appium’s Pros and Cons:
- The beauty of Appium is that, all the complexities are under the hood of Appium server and for an automation developer the programming language and the whole experience would remain same irrespective of the platform he is automating (iOS or Android).
- The other benefits of Appium is that it opens the door to cross-platform mobile testing which means the same test would work on multiple platforms.
- Unlike other tools Appium doesn’t require you to include some extra agents in your app to make it automation friendly. It believes in the philosophy of testing the same app which we are going to submit in the app store.
- It is developed and supported by Sauce Labs and it is getting picked really fast with in the WebDriver community for mobile automation.
- It can automate Web, Hybrid and Native mobile applications.
- Scaling up is an important consideration with Continuous Integration and Appium comes across as a great tool to fulfill this expectation. The reason for this is a technical limitation, in iOS we can only run one instance on Instruments per Mac OS so we can only run our iOS scripts on one device per mac machine. So if we want to run our tests on multiple iOS devices at the same time then we would need to arrange the same number of Mac machines, which would be costly affair. But this limitation can be resolved if we execute our scripts in Sauce Lab’s mobile cloud which at present supports running scripts on multiple iOS simulators at the same time.
- Appium uses UIAutomator for Android automation which only supports Android SDK Platform, API 16 or higher so to support the older APIs they have used another open source library called Selendroid. So I would not say it as a limitation but it is definitely an overhead on the configuration side.