How Appium works - a beginner's guide

Quick overview of fundamentals to kickstart your Appium learning

Introduction

When one starts with your learning journey for a new tool like Appium for test automation, it is so easy to sucked into the "doing" rather than "learning". To be honest, there are valid reasons for it. First, there is a hell lot of installation/setup to be done and secondly, it is not very exciting to learn the concepts/theory either when you get right into "doing" stuff and see a Mobile application adding an item to the cart automatically.

However, if you take a bit of time to learn what's going on behind the scene i.e how Appium works, it would be like dating (may not super exciting) but you might get a good feeling and organically fall in love with Appium so that when you are solving some technical problems you know how to navigate through it and may even know what is the "right" question to ask

Learning Objectives

  • Understand the nuts and bolts of Appium

  • Understand what happens when you trigger the Appium test from your machine

  • Overview of What primary installations are required to get started and Why

Important Summary Points

  1. Appium is a cross-platform tool for automating user journeys for Native, Hybrid, and Mobile Web Apps on iOS, Android, and Windows desktop platforms

  2. Appium is reusing the automation solution devised by each platform (read Android, iOS, windows) by using their respective framework under the hood, of course by abstracting all the complexities of working with different platforms for users of Appium. Appium uses the following frameworks

    • XCUITest - by Apple for iOS 9.3 and above

    • UIAutomation - by Apple for iOS 9.3 and lower

    • UiAutomator2 - by Google for Android 4.3+

    • WinAppDriver - by Microsoft for Windows

  3. Appium uses Client-Server architecture where,

    • Client - is the automation runner, the one who is asking for a service like finding the 'Submit' button and clicking it

    • Server - is the one who fulfils Client's request

    • Communication between the Client and Server happens over the network via the HTTP protocol, which means they don't have to coexist on the same machine.

  4. Client - is required to write and run Appium Scripts to automate actions on Mobile Apps. First, you need to choose a programming language, then you need to install the Client. For example, if you choose Java, you need to get the Appium Java Client to get started

  5. Server - When you are ready to run the Appium Script, you need to make sure that before triggering the Client code

    • The Appium server is installed and running

    • You have the IP and Port# on which the server is running

    • From the Client code, you are pointing to the right server IP and Port

  6. Appium can provide automation capabilities for each platform by creating a separate "driver" for each platform.

    For eg, Appium has implemented

    • xcuitest driver that under the hood utilizes XCUITest automation tech by Apple

    • uiautomator2 driver that under the hood utilizes UiAutomator2 automation tech by Google

After you have installed the Appium server, you can choose to install the driver depending on the platform you want to automate. For eg,

a. output of list of appium drivers installed (before installing xcuitest)

b. installing xcuitest driver

c. output of list of appium drivers installed (after installing xcuitest)

  1. Appium Client-server communication always starts with the Client requesting a SessionID from the Server and providing a list of Capabilities it needs from the Server in JSON format, known as DesiredCapabilities

    DesiredCapabilities is a way for the Appium Client to notify the Server of things like

    • Operating System

    • Mobile App path

    • The device used for automation

    • Appium Driver required

The server responds to the Client's request by providing a SessionID and all automation via Appium happens in the context of the SessionID. All automation actions eg, finding an element, and clicking the element is done via API and all endpoints have will sessionID returned by the Server

Diagrammatic view Appium workflow

Android App Automation using Java Client

iOS App Automation using Java Client

Did you find this article valuable?

Support Himanshu Pandey by becoming a sponsor. Any amount is appreciated!