Introduction To Appium: What is Appium And Its Architecture

This Tutorial Explains What is Appium, Its Architecture, Workflow, And How to use This Open-source Tool for Mobile Automation on Android & iOS:

Appium is an open-source Mobile Automation tool that provides automation on platforms like Android, iOS, etc.

It also supports automation using multiple programming languages like Java, PHP, Perl, Python, etc. So, users can use any programming language they are comfortable with and write automated scripts.

=> Watch Out The Simple Appium Training Series Here.

What is Appium

What Is Appium?

Here is a Video Tutorial:

Overview Of Apps

All applications can be automated including Native, Hybrid and Web apps. Given below is a simple overview of various types of applications.

  • Native Apps: These apps are written using iOS, Android, or Windows SDKs. These can be accessed only after installation in the device. For Example, Skype, which can be used only after installation in the device. We cannot open the app through the browser.
  • Web Apps: Mobile Web apps can be accessed using a mobile browser. Web apps can be accessed via browser only. For Example,  softwaretestinghelp.com can be accessed only through the browser. We do not have a separate App available for the website.
  • Hybrid Apps: These apps have a wrapper around a “webview” — a native control that enables interaction with web content. These can be installed in the device as well as accessed through browser URL. For Example,  Amazon can be installed as a separate app in the device and can also be accessed via browser as Amazon. 

More importantly, this tool is “cross-platform”- which allows you to write tests against multiple platforms (iOS, Android, Windows), using the same API. This enables code reuse between iOS, Android, and Windows devices.

Architecture Of Appium

This is an HTTP server written in Node.js programming language that handles WebDriver sessions. The Appium server receives HTTP requests from the client libraries in JSON format. The requests are then handled in different ways, depending on the platform on which it is running on. 

It follows the Client-Server Architecture. There are 3 components included in it:

  1. Appium Client
  2. Appium Server
  3. End device

#1) Appium Client

The automation scripted code is what we call as Appium Client.

The code is scripted in any programming language like PHP, Java, Phyton, etc. This automation script holds the configuration details of the Mobile device and the application. Along with that, the logic/code to run the test cases of the application are scripted.

Appium Client

#2) Appium Server

Appium server is written using Node.js programming language. It receives connection and command requests from the Appium client in JSON format and executes that command on mobile devices. The Server is necessary to be installed in the machine and is started before invoking the automation code.

The server interacts with various platforms such as iOS and Android. It creates a session to interact with end devices of mobile apps. It is an HTTP server written in Node.js programming language which reads the HTTP requests from the client libraries and sends these requests to the appropriate platform.

To start the server, users need to download the source or install it directly from Npm. It also provides the GUI version of the server. You can download it from the official Appium site.

In the next chapter, we will discuss the GUI version in more detail. One of the biggest advantages of this tool is that the code you use to interact with it is written in many languages such as Java, C#, Ruby, Python, etc. since Appium is REST API at its core.

Appium cmd

#3) End Device

This is mostly a real-time mobile device or an emulator. The automation scripts are executed in the end device by the Appium server by the commands from the client.

The WorkFlow Of Appium Architecture

Workflow

The Appium Client which holds the configuration details and the automation script for the test cases sends the commands to the server in JSON format. The automation script is converted into JSON format by in-built jar files in the client.

Appium Server then recognizes the command and establishes a connection with the corresponding end device. Once the connection is made, it triggers the execution of test cases in the end device. The End Device responds to the request in the form of HTTP to the Appium.

As and when the test cases are executed in the Mobile device/emulator, it populates the log of all the actions performed in the device/emulator.

Working of Appium on iOS 

This tool uses Apple’s UIAutomation API to interact with the UI elements of the application on an iOS device.  UIAutomation is a JavaScript library provided by Apple Company. It uses these libraries to automate the applications in iOS.

When we execute the test scripts, the commands in the test scripts are taken in the form of JSON through an HTTP request to the Appium server. The server sends the command to these instruments, and the instruments look for the bootstrap.js file.

Then, these commands are executed in the bootstrap.js file within the iOS instruments’ environment. After the execution of the command, the client sends back the message(success/failure) to the Appium server with the log details of the executed command.

Working of Appium on Android 

Appium uses the UIAutomator framework to interact with the UI elements of the application on an Android device. The UIAutomator is a framework that is developed by the Android developers to test its user interface.

Here, Instead of UIAutomation API as we saw in Apple, we have a UIAutomator/Selendroid and bootstrap.jar in place of the bootstrap.js file. It supports all Android versions that are greater than or equal to 17; for earlier versions of Android, Appium uses the Selendroid framework.

When we execute the test scripts, Appium sends the command in JSON format to the UIAutomator or Selendroid based on the Android version. Here, bootstrap.jar acts as a TCP server, which we can use to send the test command to execute the action on the Android device using UIAutomator/Selendroid.

Conclusion

In this chapter, we got a basic understanding of Appium, it's Architecture, Workflow, and Working of Appium on iOS/Android.

In the next chapter, we will see how to setup Appium and other basic software to be installed for Mobile Automation on real devices.

PREV Tutorial | NEXT Tutorial