DEV Community

Cover image for Appium-based mobile app testing with automation technology.
Aravind B N
Aravind B N

Posted on

Appium-based mobile app testing with automation technology.

Hello Reader's,
I'm Aravind, and I'm a Junior Software Engineer with Luxoft India. In this essay, I've attempted to provide a succinct introduction to Appium-based automated testing. This is one of my areas of Experience in standard testing. You may find a fundamental article on Mobile app testing here.


Automation testing becomes crucial in recent years due to wireless network expansion and evolving smart phone applications. Compared with traditional testing, mobile phone testing breaks away from the traditional architecture of PC in hardware, & is quite different in the way users interact. Mobile software has unique operation modes in use, such as user's sliding, tapping and clicking operations. How to achieve the automated testing execution on mobile clients has become the difficulty in this kind of testing.

The mobile application testing process

Mobile applications are usually developed in the agile development model. Agile development is characterized by its development speed and embracing change. Agile development takes the evolution of users' needs as its core, & adopts an iterative and step-by-step approach to software development. That is to say, the whole development process is divided into several iteration cycles. Each iteration cycle usually lasts for a short period of time, usually 1 to 6 weeks. The results of each sub-project have been tested, and have the characteristics of visibility, integration and operational use. In each iteration, developers design and code for the requirements of the iteration, and testers do test the software according to the requirements.

After all test cases are executed & passed, the testing task for the iteration is completed, & the requirement review for the next iteration can begin. Once all iterations are completed, all functions of the software version are developed, and system testing and acceptance testing can be carried out.

Appium Introduction

Appium is an open source automation testing tool with
the following characteristics:
1) It is applicable to testing native, Web applications or hybrid mobile applications. Mobile native applications refer to applications written in iOS or Android SDK. Mobile Web applications refer to the applications accessed by mobile browsers. Hybrid applications refer to native code encapsulating web views, native code interacting with Web contents.
2) Appium is a cross-platform testing framework, which supports mobile application testing on iOS, Android and Firefox OS platforms.
3) Appium test scripts can be written in Python, Ruby, C#, Java, Objective-C, JavaScript and other languages

Appium principle architecture

Appium is a CS model tool that drives Android and iOS applications based on web driver protocols. For the testingon iOS platform, Appium iOS encapsulates Apple's Instruments framework, mainly uses UI Automation in Instruments. Mobile devices are monitored by injecting bootstrap.js, bootstrap.js returns the execution results to Appium server, and Appium server returns the results to Appium client. Fig 1 is the schematics for Appium supporting iOS.

Image description

Fig 1. Appium is compatible with iOS schematics

Appium server forwards Android testing request to bootstrap.jar on mobile device. Bootstrap is responsible for monitoring Appium commands and calling UiAutomator on the mobile device toimplement the operation. Finally, Bootstrap returns the execution result to Appium server, and Appium server returns the execution result to the client. Fig 2 is the schematics for Appium supporting Android.

Image description

Fig 2. Appium supports Android schematics

The setup of Appium automation testing environment

To test the Android application using Appium, the steps to set up the testing environment are as follows:

1) Set up Android development environment. When configuring the Android development environment, the first step is to get the ADT installation file online for installation. For example, is used for Windows 64-bit operating system. It provides many functions, which can control the mobile device and obtain various data of Android and decompressing the installation file, system variables need to be configured on the computer, for example, download and decompress the file, the system variable ANDROID_HOME needs to be added; and %ANDROID_HOME%\tools, %ANDROID_HOME%\build-tools\android-4.4W and %ANDROID_HOME%\platform-tools need to be added into the system variable "Path".
2) Install Appium Desktop, a comprehensive tool with Appium Server and inspector, from
3) Install Appium Server, a core Appium service. After the installation, the command "appium" can be entered in the CMD window and the port of 4723 is opened locally.
4) Install Appium Client. Appium Client is a client encapsulation library in various languages for connecting to Appium Server. To run the test script successfully, Appium Client needs to be installed.

Automating testing using Appium

1) To obtain the app's package name and entry activity information, use the "aapt" command in the format "aapt dump badging APK filename > log.txt". Open the CMD window, run the command, and search for "package" and "launchable-activity" in log.txt.

2) To start an Appium test on an Android mobile device, connect it to a computer and enable USB debugging. Check if the device exists and start Appium Desktop. Click the "Start Server" button to start the Appium Server. Start the Appium Inspector session by entering platformName, appPackage, appActivity, deviceName, and noResearch information. If noReset is set to true, the data may not be clear when starting the App.

Image description

Fig 3. Appium Desktop Startup View

Image description

Fig 4. Appium Inspector Configuration View

3) Use Appium Inspector to track App elements' properties. When the App to be tested is started by Appium Inspector, the App page displayed on the mobile device will be synchronized to the Appium Inspector view. Click on the page element to be tracked, and the Source view of Appium Inspector will be displayed with the elementId, text, resource-id and other properties of the element, as shown in Fig 5.

Image description
Fig 5. Appium Inspector Source View

4) Use Appium Inspector to simulate manual operations. On the Appium Inspector view, select the elements that can be tapped, click the "Tap" button, you can simulate the manual tap operation; click the "Send Keys" button, you can simulate the manual character input operation. In this way, the basic testing for the elements can be implemented viaAppium Inspector.

5) Record test scripts with Appium Inspector. The test script can be recorded by clicking "Start Recording" button on the Appium Inspector view. At this time, the tester can click the "Tap" or "Send Keys" button to simulate the operation of the manual test scenario. Appium automatically generates the corresponding test script (as shown in Fig 6). After recording, the test script can be exported to the code of Python, Java and other languages

Image description

Fig 6. Appium Inspector Test Script Recording Page

6) Execute automated tests with Appium Client. If the Appium Client of the corresponding programming language is installed on the computer, the exported test script can be executed to drive the execution of the automated test. Fig 7 below is the login scenario test script "" in Python. After exporting the test script, open the CMD window on the computer and run the command "python app" directly to drive the script execution. During the execution of the script, you can see that a login scenario is automatically completed on the mobile device.

Image description
Fig 7. Appium Test Script in Python

Image description
Fig 8. Appium Output

In summary, using Appium can simulate manual operations to effectively realize automation testing of mobile applications. Testers can get the test results by analyzing the execution log of the automated testing, & work out test reports. Appium can make regression testing more convenient, & accelerate the development and iteration of mobile applications. Appium-based UI and functional testing can be integrated into automation platforms for continuous integration, reducing software development costs and risks.

Do let me know in case of any queries in comments below.

Thanks for reading.

Top comments (0)