Appium Tutorial for Mobile Application Testing
By Akshay Pai, Community Contributor and Pradeep Krishnakumar, Manager - August 19, 2019
No matter where you go your mobile phone is that inseparable mate, which you would always like to keep by your side. The smartphones have gone way ahead from being just the medium of telecommunication to becoming an allrounder assistant who is always there to serve.
Whether you are traveling, stuck in traffic, or are sitting idle, the smartphone always serves you the best with its treasure of applications ranging from entertainment to utility. With the rise of tech-consumerism, the demand for mobile applications has been rapidly increasing over the past few years, making it the hotbed of opportunities.
As per a report from Statista, the number of mobile application downloads worldwide is projected to rise from being approximately 178 billion in the year 2017 to over 258 billion by 2022.
As the industry has geared up to cater to these growing needs of software applications, the global mobile application market revenue is projected at $462 billion for 2019, indicating the massive size of the market.
Mobile applications have tapped the pulse of the modern-day consumers who are on a lookout for extensive features at the reach of a click that is available to them no matter wherever they go.
Companies are targeting customer engagements for their applications by introducing new features every few weeks with a new version of software applications. With the need to deliver the applications in record time, the pressure to deliver a reliable product that is bug-free and performs well surmounts over the companies.
This makes it essential to have a testing process that is not only quick but also has more comprehensive coverage to meet the requirements successfully. Naturally, Automation testing comes as the best choice to meet these requirements.
To keep up with the growing expectations of customers, they need mobile applications that are high performing and compatible with a fleet of devices that are available in the market. Hence companies are leaving no stone unturned to ensure cross-platform compatibility.
Appium is one such open-source automation framework that makes mobile app testing a lot more efficient by offering scalability and flexibility. It has gained traction in the mobile application industry with its extensive features in such a short period. Bitbar, Testbytes, and Intuz have also ranked Appium among the top mobile testing tools with over 35% of market share in Android applications and over 40% share in iOS applications.
This guide aims to offer you a detailed overview of Appium, covering all the necessary knowledge and its benefits that could help you leverage this fantastic automation testing framework for your mobile applications.
What is Appium?
Appium is an open-source framework that allows you to conduct automation testing of mobile applications on different platforms like Android, iOS, and Windows.
It automates the testing for:
- Native Mobile Applications that are written using iOS, Android or Windows SDKs
- Mobile Web Applications that can be accessed using mobile phone browsers such as Safari, Chrome or the in-built native browser applications for android devices
- Hybrid Mobile Applications that have a native wrapper around the web view
Appium is a cross-platform testing framework that is flexible, enabling you to write the testing code against multiple platforms such as iOS, Windows, and Android using the same API. This means you can use the same code for iOS that you have written for Android, saving lots of time and effort.
Architecture of Appium Framework
Appium is an HTTP server that is written on the Node.js platform whose set up represents a REST (Representational State Transfer) API and implements Selenium WebDriver. It works on a client/server architecture. Appium allows you to use the available WebDriver client for firing the tests.
The REST API performs the following actions:
- Receives the connection from the client-side
- Listen to the command
- Execute the command on a mobile device
- Responds the command execution status as an HTTP response to the client
It is then that the server starts the automation session and responds with a session ID that is further used for sending other commands relevant to the given session.
How does Appium work?
Appium allows you to interact with your application automatically, by leveraging the behavior of the various components such as buttons and text labels that are available in the user interface of the application.
It can be reused to write and run tests repeatedly against the given application at various sessions.
Here’s how Appium works for Android and iOS mobile devices:
Appium on Android device
Appium uses the UIAutomator framework (or Selendroid), which is meant for testing the Android user interface for automating applications on Android devices. The bootstrap.jar file works as a TCP server that sends the test command for acting on the Android device with the help of the UIAutomator or Selendroid framework.
Source: Appium Essentials by Manoj Hans
Appium on iOS device
Similar to that of Android device, Appium uses the JSON wire protocol for iOS devices as well. Here, it uses Apple’s UIAutomation API to interact with the user interface elements to automate the applications on iOS devices. The bootstrap.js file works as a TCP server that sends the test command for acting on the iOS device with the help of Apple’s UIAutomation API framework.
Source: Appium Essentials by Manoj Hans
What makes Appium an absolute favorite?
When it comes to mobile testing, regardless of whether the mobile application is native, hybrid, or mobile web in nature, or the device platform is Android, iOS, or Windows, Appium always remains the first choice for conducting automation testing on mobile applications. Here’s what makes it the most favored mobile automation testing framework:
- It is a server and runs in the background
- It can be synchronized with TestNG testing framework offering a wider range of features
- With an in-built UIAutomator, Appium is capable of producing a detailed information log and has a detailed reporting structure that makes the analysis of the test results better and improves the debugging
- It also offers reusability of the same code for different device platforms such as iOS, Android, and Windows. This saves a lot of time and effort that would otherwise go into writing separate test codes
- It allows you to take full control of the back-end APIs and databases using the test code. This helps in gauging any defect that comes from the back-end APIs or databases
- You do not have to modify or recompile the app, which is under test in any way, as Appium uses the standard automation APIs on all the platforms. This means you do not need to access the source code of the application that is under testing
- It allows you to test the mobile applications by either using emulators or simulators or real devices, giving you the flexibility to choose your testing device and environment
- It offers cross-platform compatibility, enabling the same tests to run on multiple platforms widening the coverage
- It offers real-life monitoring of the tests making the execution more robust
- Appium allows parallel execution of test automation scripts on different Android or iOS sessions using UIAutomator, UIAutomation, or Xcode9. This speeds up the testing process and ensures scalability
- You test the same app that the users are going to access
With so many amazing features, Appium is an automation testing framework that is undeniably the best choice for mobile application testing.
How to get started with Appium?
To get started with the Appium automation mobile application testing, you can go through the BrowserStack’s App Automate documentation to get started. Install the prerequisite components, based on the scripting language and framework chosen.
Try running a few sample test cases to get better hands-on.
To perform extensive cross-platform testing for your mobile application, try App Automate, which enables you to have instant access to Appium, along with a fleet of over 2000 real iOS, and Android devices.
On a closing note
To keep up with the demands of fast and reliable testing that spans over various platforms, devices, and versions, automation testing using Appium, seems to be the best choice. Preferred throughout the industry, Appium offers the feasibility, flexibility, and cost-friendliness above other testing methods, enabling teams to deliver great user experiences within the realms of continuous delivery approach.