Is Appium: Mobile App Automation Made Awesome?

What is Appium?
Appium is an open source test automation framework. Appium allows native, hybrid and web application testing of IOS and android and also supports Simulators or Emulators.
What Appium Do?
It provides cross platform application testing that is single API works for both iOS and Android platform testing. Appium works with all programming languages that have Selenium user libraries like Objective-C, Java, PHP, JavaScript with node.js, Ruby, C#, Python, etc.
Why Need Appium?
If you are mobile app software test engineer, Appium can makes your mobile app regression testing task easy. Specially for large mobile apps where continues apps are updating with new features and functionalities. Another main benefit of using appium for mobile app automation is : It supports bellow given multiple platforms and languages. Also you can use any testing framework.
Multiple Platforms Support

  • Appium support bellow given different platforms.
  • Android
  • IOS
  • FirefoxOS
    Multiple Languages Support
  • Appium supports bellow given languages with the Selenium WebDriver API and language-specific client libraries.
  • Java
  • Objective-C
  • JavaScript with Node.js
  • PHP
  • Python
  • Ruby
  • C#
  • Clojure
  • Perl

Also there are other advantages like no source code is needed to test app as you can test it directly, also you can engage built in apps like camera, calendar etc in your test script if required.

APPIUM Design Concepts

  • Appium is an ‘HTTP Server’ written using Node.js platform and drives iOS and Android session using Webdriver JSON wire protocol. Hence, before initializing the Appium Server, Node.js must be pre-installed on the system.
  • When Appium is downloaded and installed, then a server is setup on our machine that exposes a REST API.
  • It receives connection and command request from the client and execute that command on mobile devices (Android / iOS).

*It responds back with HTTP responses. Again, to execute this request, it uses the mobile test automation frameworks to drive the user interface of the apps. Framework like:-

       * Apple Instruments for iOS (Instruments are available only in Xcode 3.0 or later with OS X v10.5 and later)
       * Google UIAutomator for Android API level 16 or higher
       * Selendroid for Android API level 15 or less

Desired Capabilities:
‘Desired Capabilities’ help us to modify the behavior of server while Automation.

In Appium, it is a type of hash map or key-value pair, used to send a command to APPIUM server. In APPIUM, all the client commands are running in the context of a session.

For example, a client sent POST/session request containing JSON object to APPIUM server.

Hence, to send any desired request or to maintain any desired session with the server, a set of Key and value pair is used. This is known as ‘Desired Capabilities.’

        import io.appium.java_client.AppiumDriver;
        import org.openqa.selenium.remote.DesiredCapabilities;
                   DesiredCapabilities capabilities = new DesiredCapabilities();
                   capabilities.setCapability("deviceName","Android Emulator");
                   capabilities.setCapability("platformVersion", "4.4");

5 features of Appium tool for both iOS and Android platforms that stands out

The main concept of Appium is that native apps should not need an SDK and should be able to use preferred test frameworks and tools. Appium thus allows to automate any mobile app, native or hybrid, developed from any language and any framework.

It uses the JSON wire protocol to interact with iOS and Android along with Selenium WebDriver It is this interaction between Selenium client libraries and node.js server which works together with the mobile application. One of the core features of Appium is that the test codes can be written in any framework or language without having to modify them. Appium is able to run on a variety of devices and emulators making it one of the most apt choices for mobile automation.

Appium on iOS
Apple provides an application called instruments which is used to perform a lot of activities like profiling, controlling and building iOS apps. It also has a component for automation where javascript commands can be written using UIAutomation APIs to interact with the AppUI. To automate iOS Apps, Appium makes use of these libraries.

In context of a command life cycle, the Selenium WebDriver sends a command in the form of JSON via http request to the Appium Server. The Appium Server understands the automation context and sends the command to the Instruments command server. This further waits to be picked up by the Instruments command client and execute it in Bootstrap.js in the iOS environment. Once the command is executed, this message is sent back to the Appium server by the command client. This cycle repeats itself until all the commands get executed.

Appium on Android
The cycle in Android is similar in to iOSl. Here Appium proxies the command to a UIAutomator test case running on the device. The UIAutomator is Android’s native UI automation framework which supports running JUnit test cases from the command line directly into the device. Although it uses Java as the programming language, but Appium makes it run from any of the WebDriver supported languages. Unlike iOS, here the Bootstrap.jar is in place of Bootstrap.js. It represents the test case when compiled in java.

On getting launched, it spawns a TCP server. Here, the TCP server resides in the device and the client resides in the Appium process. This is exactly opposite to the way it is is iOS.

The pros and cons of Appium

  • All the complexities here are under the Appium Server. This makes the whole experience same for an automation developer irrespective of the platform being automated.
  • Appium opens up the door to cross platform
  • mobile testing . This makes it possible to execute the same test on multiple platforms.
  • Appium can automate Native, Hybrid and Web mobile applications.
  • Appium uses UIAutomator for Android which only supports Android SDK platform. Fro older APIs, Selendroid is available. This may not be taken as a limitation, but can be considered as an overhead in the configuration.
  • Online Training also available for Appium now days for beginners.

The Appium architecture has grown continuously with new feature additions and is constantly under regression. Hence a fair amount of rearchitecture is under consideration to solve these issues and migrate the codebase to JS which is easier to understand and work with. Apart from these you can Easy setup process, run a test with appium also supports for both platforms iOS and android.Last but not least it doesn’t require an APK for use, although automating certain apps do.

1 Like