Details on Appium and It’s Architecture

Bertha White - Jun 16 '23 - - Dev Community

What is Appium?

Appium is a free and open-source suite of testing tools and frameworks that you can use to automate the testing of mobile (native, hybrid, and mobile web), desktop (Windows, Mac), and Smart TV apps.

The Appium Philosophy

Language agnostic: To avoid being locked into the programming languages of platform vendors, Appium allows you to use any language binding you like, including Java, Kotlin, Python, JavaScript, Ruby, and C#.

Eliminates the need to start from scratch: To enable effective Appium test automation it provides a simple API that is Web driver protocol compliant, which encapsulates vendor automation libraries (Google UIAutomator2/Espresso, Apple XCUITest/UIAutomation, and Windows WinApp), allowing you to design tests that run on several platforms.

There is no need to update the app’s SDK or recompile it: Appium mobile testing does not necessitate an app compilation phase but can drive the app from a grey box user experience.

Cross-platform: Developers can perform effective Appium automation testing because Appium drives applications across several platforms; if the applications share the same business logic, you can use a single cross-platform test to evaluate them.

Appium Architecture

Appium is a Node.js-based HTTP server responsible for managing WebDriver sessions and receiving HTTP requests in JSON format from client libraries. The requests are then processed differently based on the application’s platform.

It follows the Client-Server Architecture design pattern. There are three components to it:

Appium Client
Appium Server
End Device

Appium Client
The scripted code for automation is known as Appium Client.

Developers can write the code in any programming language, such as PHP, Java, or Python. This automation script contains the Mobile device and application configuration information and the logic/code required to execute the application’s test cases.

Appium Server
Developers use the Node.js programming language to create the Appium server. It receives connection and command requests in JSON format from the Appium client and carries out those commands on mobile devices. The server must be installed on the machine and started before executing the automation code.

The server communicates with multiple platforms, including iOS and Android. It creates a session to communicate with mobile app endpoints. It is a Node.js-based HTTP server that reads HTTP requests from client libraries and forwards them to the corresponding platform.

Users must download or install the code from Npm to start the server. It also provides the server’s GUI interface. You can download it from the Appium website.

End Device
The ‘End Device’ is predominantly a mobile device or an emulator. The Appium server executes the automation scripts on the end device in response to commands from the client.

The Appium Architecture Workflow

The Appium Client, which contains setup information and the test case automation script, sends JSON commands to the server. Integrated jar files within the client convert the automation script to JSON format.

Appium Server then recognizes the command and connects to the associated end device. Once it establishes the connection, it executes test cases on the end device. The End Device responds with an HTTP response to the Appium’s request. Appium populates the log with all actions performed on the device as the testers complete each test case. Appium’s execution, concerning Android and iOS, varies slightly.

Appium on Android

Appium on Android automates using the UIAutomator framework. Android developed the UIAutomator framework for automation reasons. So let’s see how Appium operates precisely on Android.

Appium client (c/Java/Python, and more.) establishes a connection with Appium Server and interacts using the JSON Wire Protocol.
The Appium Server then generates an automation session for the client and verifies the client’s desired capabilities. It then links to the corresponding frameworks given by the vendor, such as UIAutomator.

UIAutomator will connect with bootstrap.jar for client activities, which operate on the simulator/emulator/real device.
Here, bootstrap.jar acts as a TCP server through which we can send the test command to the Android device using UIAutomator.

Appium with iOS

Appium leverages Apple’s XCUI Test API to interact with UI elements on iOS devices. XCUITest is the framework for automation included with Apple’s XCode.

  • Appium client (c/Java/Python, and more.) establishes a connection with Appium Server and interacts using the JSON Wire Protocol.

  • Appium Server then creates an automation session for the client, validates the client’s needed capabilities, and connects to the framework offered by the corresponding vendor, such as XCUI Test.

  • For client operations, XCUI Test will interface with bootstrap.js, which runs on a simulator/emulator/real device.

  • Bootstrap.js will conduct the action on the application under test. After executing a command, the client returns a message to the Appium server containing the command’s log information.

Conclusion

Appium is a comprehensive tool that can help you develop quality apps. It gives you the best platform to write test scripts for Android and iOS. However, trying to work with Appium without help is challenging. A mobile app testing platform like HeadSpin that knows the ins and outs of Appium can help you meet your testing needs. Reach out!

Original source: https://www.europeanbusinessreview.com/details-on-appium-and-its-architecture/

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .