The Pros and Cons of different UI automation test tools - Appium
The majority of the last open-source testing tools I’ve written about have been primarily web focused. Appium though is different as it is built with the purpose of automating native, web, and hybrid applications that run on mobile devices, primarily iOS and Android apps, but is also capable of running Windows applications and therefore able to achieve a certain level of desktop app automation as well. Something which has been critical in a world increasingly dominated by mobile devices.
Appium – first released in 2012 by Dan Cuellar, is an open-source framework that is built on the foundations of Selenium, making use of the same WebDriver API that Selenium uses for web browsers. As such, it operates on a very similar basis making use of a Mobile JSON Wire Protocol for its testing scripts. Appium consists of a REST API in which commands can then flow between the different devices and the machine/server hosting Appium and driving the flow of control between the different devices.
How Appium works on an Android device
How Appium works on an iOS device
Additionally, like Selenium, Appium is designed in a modular fashion with individual drivers operating each independent device connection. This allows it to handle automation across different devices in a parallel and independent fashion, while also making the core functionality of the service itself quite easy to maintain as core functionality can be altered with the use of different modules and drivers to suit the needs of the automation.
And while the core Appium application may be Node.JS based, this modular design allows the tool to support many different programming languages, making it easy to integrate into many existing test formworks that companies already have. Its similarity to Selenium also means it can interact with a lot of the same plugins, creating a wide range of interoperability with existing tools.
Typically, in order to use Appium for test automation, it’s good to have an understanding of its basic architecture and workflow:
Appium server: Appium is a client-server architecture, where the Appium server is the backend that interacts with the mobile device and the application being tested.
Desired capabilities: Before executing tests, the user specifies desired capabilities such as the device type, platform version, application path, etc., that Appium uses to create a session with the device and application.
Session creation: Appium creates a session with the device and application by sending a request to the Appium server with the desired capabilities.
Appium client libraries: The test script interacts with the Appium server using client libraries available for multiple programming languages. These libraries provide methods to interact with the mobile device, such as tapping, swiping, scrolling, entering text, and more.
5Automation frameworks: Appium uses the automation frameworks provided by mobile platforms (such as UIAutomation for iOS and UiAutomator for Android) to interact with the application being tested. The client libraries send requests to the Appium server, which in turn sends commands to the automation frameworks on the device.
Once all of these steps have been done, the Appium server can use the needed driver to execute on the device under test.
Appium does behave differently depending on the device it is testing with the below two diagrams showing the difference in approach between how it works across the two most popular mobile operating systems, Android and iOS.
Some of the pros of using Appium include:
Based on the same framework as Selenium: If companies are already using Selenium for web automation or are building their mobile apps off of existing web apps, there is a lot that can be shared across the tools to make the test automation efforts easier.
Cross-platform compatibility: Appium supports both iOS and Android platforms, allowing users to write tests once and run them on multiple platforms.
Open-source: Appium is free to use and can be easily integrated with other open-source tools and frameworks.
Large community: Appium has a large and active community of users and developers, which means that users can easily find help and support when needed.
Robust API: Like Selenium, its API allows for easy integration with other tools which can use the powerful API to automate a lot of commands.
No need for recompilation of app: Appium does not require recompiling the app under test and can interact with the app just like a user would. This provides fairly realistic results as they relate to user feedback.
Seamless integration with testing frameworks: Appium integrates with popular testing frameworks such as TestNG, JUnit, and NUnit, making it easy to incorporate mobile testing into existing testing workflows.
Supports cloud-based testing: Appium can be used with cloud-based testing platforms such as Sauce Labs, making it easy to run tests on multiple devices and platforms simultaneously.
Wide range of capabilities: Appium offers a wide range of testing capabilities, including testing of gestures, screen rotations, device notifications, and more.
Parallel Testing: Thanks to the independent execution of different drivers, this tool is perfect for parallel execution across different devices.
Some of the cons of using Appium include:
Limited support for other application types: Appium is primarily designed for testing mobile applications and may not be as well-suited for testing other types of applications, such as web or desktop applications.
Steep learning curve for non-coders: Like Selenium, Appium requires a certain level of programming knowledge in order to design the test scripts correctly and they can be complex to write and maintain.
Depends on 3rd-party support for reporting: Appium does not have built-in reporting capabilities and requires additional tools to generate reports.
Flaky tests: Appium can lose sync with the devices/emulators being tested and therefore not register every object action or response correctly, increasing the possibility of test failures when the application may be working as expected,
Works best with actual devices: While Apium can work with device emulators that are connected to a Windows or Mac machine, these emulators require a level of management from the host machines and therefore don’t offer some control and protocol interaction as an actual device, so if you want to get a high-automation coverage across a wide variety of devices, it is best that you will need a device farm of some sort with a lot of different devices that best meets your application needs.
When to select Appium:
When you have mobile applications that need to be automated but don’t want to spend money on a bigger licensed tool.
When you already make use of Selenium in your automation suite and are comfortable working with open-source tooling.
Your test automation team has a strong understanding of programming fundamentals
When you have a wide variety of different devices you want to support and need to automate your testing across all different devices.
If you have a big mobile presence and aren’t prepared to pay for very expensive automation tools, then Appium should be on your list of tools to assist you with your test automation efforts. It offers a lot of features, provides coverage across different platforms and devices, and integrates well with existing frameworks, making it the obvious choice for open-source mobile automation.