Open In App

Architecture of the Appium Framework

Last Updated : 08 Apr, 2024
Improve
Improve
Like Article
Like
Save
Share
Report

Appium framework is used for testing mobile applications to ensure the quality of the software product using a client-server architecture. Appium is capable of automating the testing process seamlessly on iOS, Android, and Windows using the same API. In this article, we are going to explore the architecture of the Appium framework.

Architecture of the Appium Framework

Appium in Python, is capable of supporting both native and hybrid mobile applications and provides a client-server architecture where tests are written in one programming language and executed on multiple platforms. It also follows the WebDriver protocol for automating interactions with mobile devices and applications, making it a versatile and powerful tool for mobile app testing.

Architecture-of-the-Appium-Framework-1

Why to Use Appium Framework?

Mobile testing tools are responsible for ensuring the quantity and functionality of mobile apps to enhance user experience. The tools identify and address the potential issues before app development as these tools minimize the bugs and enhance the overall reliability. Some of the mobile testing tools are Kobiton, Robotium, Test Complete, and more, but, Appium is preferred over the other testing tools:

  • Appium’s support for multiple languages enhances scalability and eliminates the need to set up multiple platforms during integration, thereby reducing costs.
  • Appium’s open-source nature encourages testing on simulators, emulators, and real devices, providing cost-effective testing options.
  • Appium offers extensions to work with both native and hybrid mobile applications, ensuring a seamless testing experience without the need for code changes.
  • Appium allows users to access back-end APIs and databases directly from their test code, facilitating comprehensive testing practices.
  • Users can leverage their preferred testing practices, tools, and frameworks with Appium, ensuring flexibility and adaptability in their testing processes.

Uses of Appium Framework

The Appium framework Use client and server components. The client initiates the test commands and send them to the server. The server component (Appium server) receives commands from the client, translates them into actions, and executes them on the device or emulator.Communication Protocol between the Client and the Server

  • Appium relies on the JSON wire protocol or the newer WebDriver protocol for communication between the client and server.
  • The client sends HTTP requests to the Appium server, specifying desired capabilities and commands.
  • The server interprets these requests, interacts with the mobile device or emulator, and sends back responses to the client.
  • This protocol ensures seamless communication between the testing script and the automation engine, facilitating efficient test execution.

Appium on Android

For Android app test, Appium leverages the UIAutomator2 driver that allows to facilitate interactions with the UI element on Android devices. The driver can automate complex gestures, handle system level interactions and validate behavior across different Android versions.

  • The user writes test commands, which are converted into a JSON object format by the client libraries.
  • The formatted requests are sent to the Appium server, which acts as a bridge between the user’s client and the Android device or emulator. Appium employs the WebDriver protocol to communicate with the device.
  • Within the Android device, the Bootstrap.jar component receives and processes these commands. It utilizes the UI Automator framework to interpret and execute UI interactions specified in the commands.
  • The interpreted tests are executed on the Android device, carrying out actions such as tapping buttons, entering text, or swiping screens.
  • After which, the outcomes of these tests, along with any relevant data, are sent back to the Appium server by the Bootstrap.jar component.
  • Finally, the Appium server transmits these results back to the user’s client.

Appium on iOS

The interaction with iOS devices using Appium and the XCUITest framework are similar to those for Android devices, but there are some differences in the implementation:

  • The user writes test commands, which are converted into a JSON object format by the client libraries.
  • The formatted requests are sent to the Appium server, acting as an intermediary between the user’s client and the iOS device or simulator. Appium communicates with the device using the WebDriver protocol.
  • Within the iOS device, the WebDriverAgent.app receives and processes these commands. It extracts them from the IPA file and uses the XCUITest framework to convert and execute them. The interpreted tests are executed on the iOS device or simulator.
  • After which the results are sent to the Appium server by the WebDriverAgent.app.
  • Then, the Appium server transmits these results back to the user’s client, where they can be displayed, analyzed, or utilized as needed.

Architecture of the Appium Framework

Architecture of the Appium Framework

How Does Appium work?

Let’s have a look at the working of Appium framework with respect to WebDriver Protocol, Client-Server Communication, Appium Sessions and JSON Wire Protocol. Below, are the some working parts of Appium.

  • WebDriver Protocol
  • Client-Server Communications
  • Appium Session
  • JSON Wire Protocol

WebDriver

  • The WebDriver protocol is used to enable automation of tasks similar to those performed by a human user. The protocol offers a range of commands that simplify common interactions with an application, such as navigating, clicking, or retrieving element states.
  • Appium exposes a set of APIs that obeys the specifications defined by the WebDriver protocol. These APIs provide clients with a uniform interface for sending commands and interacting with mobile applications.

Client-Server Communications

  • The client could be an automation engineer who has written scripts in Java, Ruby, Python or C#.
  • The role of server is played by Appium itself. Appium server acts as a bridge between the client and the mobile device or emulator.
  • The client communicates with the Appium server over HTTP using RESTful APIs. Whenever the client sends the command, the client packages the command into HTTP request and sends it to the Appium server’s designated endpoint. The HTTP request usually contains information like desired capabilities, the intended action, and any extra parameters necessary for execution.

Appium Session

  • Upon receiving the HTTP request, the Appium server interprets the command and executes it on the connected mobile device or emulator.
  • The execution involves interacting with the mobile application’s user interface, simulating user actions such as tapping, swiping, inputting text, etc.
  • The Appium server utilizes vendor-provided automation frameworks (e.g., UIAutomator for Android, XCUITest for iOS) to interact with the mobile application’s elements and perform the requested actions.

JSON Wire Protocol

  • JSON Wire Protocol is a wire protocol used by WebDriver for communication between the client and the server. It specifies the format of the messages exchanged between them.
  • Appium, being a WebDriver implementation, adheres to the JSON Wire Protocol. This means that commands sent from the client to the Appium server, as well as responses from the server to the client, are formatted as JSON objects.
  • For example, a command to find an element on a mobile app might be sent as a JSON object containing the element locator strategy and value, and the server responds with a JSON object containing information about the located element.

Advantages of Appium

  • Supports automated testing across multiple platforms
  • Freely available and flexible.
  • Provides wide language support that includes Java, Python, C# and more that enable tests in the desired language.
  • Can automate testing for native and hybrid model applications
  • Does not require any modification of the app code.

Disadvantages of Appium

  • Relies on third party tools like UI Automator, XCUITest.
  • Limited support for non-mobile platforms such as web applications/
  • Slow execution speed compared to the native testing frameworks.
  • Setting up Appium can be complex and time-consuming.
  • Test scripts may become brittle and require frequent maintenance.

Conclusion

In conclusion, while Appium offers cross-platform mobile testing capabilities, its reliance on third-party tools, limited support for non-mobile platforms, and comparatively slower execution speed pose challenges. However, its architecture provides flexibility and scalability for mobile application testing needs.



Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads