Appium is an HTTP server which is written in Node JS that creates and handles WebDriver session. Its Architecture is similar as Selenium WebDriver Server.
Appium Architecture is different from Android to iOS.
The fact that we have a client/server architecture opens up a lot of possibilities: we can write our test code in any language that has a http client API, but it is easier to use one of the Appium client libraries. We can put the server on a different machine than our tests are running on.
Appium iOS Architecture
When we execute the test scripts, it goes in the form of JSON through an HTTP request to the Appium Server. On an iOS device, Appium uses Apple's XCUI Test API to interact with the UI elements. XCUITest is the automation framework that ships with Apple's XCode.
- Appium client (Java/Python/etc) connects with Appium Server and communicates via JSON Wire Protocol.
- Appium Server then creates an automation session for the client and also checks the desired capabilities of the client and connects with the respective vendor-provided framework like XCUI Test.
- XCUI Test will then communicate with bootstrap.js which is running in a simulator/emulator/real device for performing client operations.
- Bootstrap.js will perform the action on our application that is being tested. After the execution of the command, the client sends back the message to the Appium server with the log details of the executed command.
Appium Android Architecture
On Android device, Appium uses the UIAutomator Framework to automate the apps. UIAutomator is a framework that is developed by the Android developers to test the Android user interface.
Appium supports Android versions greater than or equal to 17, for earlier versions it uses the Selendroid framework. When we execute the test scripts, Appium sends the command to the UIAutomator or Selendroid on the basis of the Android version.
- Appium client (C# or Java or python etc.) connects with Appium Server and communicate via JSON Wire Protocol
- Appium Server then creates an automation session for the client and also checks the desired capabilities of client and connects with respective vendor-provided frameworks like UIAutomator or Selendroid.
- UIAutomator will then communicate with bootstrap.jar which is running in Emulator/Real device for performing client operations
- Here, bootstrap.jar plays the role of a TCP server, which we can use to send the test command in order to perform the action on the Android device using UIAutomator.
- After the execution of the command, the client sends back the message to the Appium server with the log details of the executed command.