Appium works on simple Client Server Architecture (as shown below) and it uses https protocol for communication between your automation code and the mobile device:
Let me explain the Appium Client Server Architecture in a detailed and step by step manner. Follow the below steps to understand the Appium Client Server Architecture:
1) We will be first writing the Appium Automation in IDE editors like Eclipse using any of its supported languages (In this article, we are using Java) as shown below:
Note: Don’t worry about the code we have written in this example. This is just a sample code, that we will be explaining in detail in the upcoming articles.
Desired capabilities mentioned in the below code will communicate the required Mobile device on which the Appium automation code to be executed.
In order to write the below Appium code, we need to configure the Project in our IDEs with appropriate client libraries (i.e. For writing in Java, we need Appium Client Libraries for Java). This configurations will be explained in the upcoming articles.
2) Now we need to start the Appium Server (i.e. Before executing the Selenium Automation Scripts in our Eclipse IDE editor) – Process to start the Appium Server via command prompt will be explained in the upcoming articles.
3) We will be executing the Appium Automation code written in Eclipse IDE and the executed automation code will be carried to the above started Appium server over JSON wire protocol.
4) Now the Appium Server will consume all your Appium Automation code and convert the Java code to mobile device understandable instructions using its inbuilt drivers (i.e. UIAutomator2 for Andriod and XCUITest for iOS) appropriately.
5) Appium Server sends the instructions to the appropriate Mobile device based on the desired capabilities we mentioned in our Appium Automation code.
6) Device Under Test (DUT) will receive the instructions from the Appium Server and will be executed accordingly on specified application in the device.
7) Once the execution on the device under test (DUT) is completed, the DUT will reply to Appium Server with appropriate response (i.e. In case of failure, an exception will be sent in the response).
In the sample code written in first step, we are just launching an App and after its execution, you will see 200 status code in the results. That means the appium automation code has successfully launched the App on the device under test).
8) Appium Server will forward the same response as success or fail (with exception) to the Eclipse IDE.
On the top of all the above mentioned things, automation is always performed in Appium Client Server architecture in the context of a session.
Client (Appium Code in Eclipse + Appium Client libraries) will initiate a session with Appium Server by sending a POST/session request to the Appium Server.
This Post/session request carry the JSON object called the ‘desired capabilities’ object.
The Appium Sever will receive this JSON object and start the automation session and respond with a Session ID back to the Client. The Client then uses this Session ID for sending further commands to the Appium Server.
- > To learn more about Appium, continue to the next post (Click on Next Post Link Below)
- > Check complete Appium Tutorial Contents here (Click here)
Please leave your questions/comments/feedback below.
Happy Learning 🙂
On a mission to contribute to the Software Testing Community in all possible ways.