With Appium as your guide, you’ll conquer the complexity of mobile app testing, delivering polished user experiences in the dynamic digital landscape.
You may also check our Flutter app development services.
Before diving, into the details of the Appium architecture let’s start by understanding the concepts associated with it.
Appium Client-Server Architecture:
The server operates on a client-server architecture.
The Appium client consists of automated code written in a language of your choice like Java, C#, Javascript, Python, Ruby, etc. Client libraries send requests using the W3C WebDriver Protocol to communicate with the Appium server.
The Appium server itself is an HTTP server developed using Node.js. It listens Appium client code for connection and command requests in JSON format.
Appium Sessions:
A session encloses all “testing” activities. When the client sends the initial request to the server, it establishes a session.
The client sends post requests to the server, and these are known as session requests. These requests contain data formatted as JSON Objects.
WebDriverAgent.app
WebDriverAgent is an implementation of a WebDriver server specifically designed for the iOS platform.
It allows control of iOS devices by enabling actions such, as launching and terminating applications, tapping, scrolling views, and more.
We achieve this by linking the XCUITest framework and utilizing Apple’s API to execute commands on devices or simulators.
When Appium initially interacts with a device or simulator it verifies the existence of WebDriverAgent.app. If the app is not found, it proceeds to first install WebDriverAgent.app.
WebDriver Protocol:
The WebDriver protocol is central in Appium. Originally, it was developed to automate the browser. Selenium, on which Appium is based, uses this protocol.
It allows us to access some commands, which can mirror the user behavior. WebDriver can fulfill behaviors like clicking or swiping.
The WebDriver protocol receives data in a POST request. Here, in the POST request body, it receives the JSON format object containing data.
Wire Protocol for JSON:
Appium uses the mobile JSON Wire Protocol, a modified version of the JSON Wire Protocol, to streamline client-server communication.
The client software creates a JSON object and sends it to the server when the client wants to deliver data. The server then responds to the client.
Note: The W3C WebDriver Protocol, a standard that Appium has long supported, serves as the foundation for its API.
Selenium and Appium both made use of previous protocols, specifically “JSONWP” (JSON Wire Protocol) and “MJSONWP” (Mobile JSON Wire Protocol), before the W3C WebDriver Protocol became a web standard. For more information
Let’s now examine the Appium architecture in more detail.
Using Appium Architecture
The Appium server functions as an HTTP server, receiving JSON-formatted HTTP requests from client libraries and forwarding them to the respective platform.
The server recognizes these requests and starts a session of automation with the relevant end device. After establishing the session, the Appium server starts running test cases on the end device.
The Appium server handles requests differently depending on whether it is working with iOS or Android.
Appium Architecture for Android Device:
Android smartphones use the UI Automator framework.To interact with the UI components of the Application Under Test (AUT), Appium uses UI Automator APIs.
- User-written code is transformed into REST API requests via client libraries.
- The Mobile JSON Wire Protocol is then used to transmit these requests to the Appium Server.
- The Appium server sends these requests to the target Android device or emulator.
- These instructions are translated into a format that the mobile UI Automator can understand by bootstrap.jar, which interprets them.
- On the actual device or emulator, carries out the UI Automator commands.
- The device or emulator then uses bootstrap.jar to communicate the results of the command execution back to the Appium server.
- The Appium server delivers this response to the client.
Appium Architecture for iOS Device:
iOS devices use the XCUITest framework. To interact with the UI components of the Application Under Test (AUT), Appium uses Apple’s XCUITest API.
- User-written code is transformed into REST API requests via client libraries.
- The Mobile JSON Wire Protocol is then used to send these queries to the Appium Server.
- The Appium server sends these requests to the target iOS device or emulator.
- By using Apple’s XCUITest API, the WebDriverAgent.app interprets these commands and translates them into a mobile-friendly manner.
- The machine or simulator carries out the commands.
- The device or simulator then uses the WebDriverAgent.app to communicate the results of the command execution back to the Appium server.
- The Appium server delivers this response to the client.
Conclusion:
Unquestionably, one of the best platforms for testing mobile applications is Appium. You now have a better understanding of the Appium architecture’s overview, its process, and how it works on both iOS and Android platforms.
The perfect tool before you debug your app!
Thanks for reading this blog. You can read more interesting blogs by Mobikul