Mobile Application Test Automation with Appium for Android
Testing mobile applications is crucial for ensuring application quality and enhancing user experience. Appium, an open-source automation tool compatible with both Android and iOS platforms, plays a pivotal role in this process. In this article, I’ll delve into the core installation procedures and explore how to use Appium for Android OS.
STEP 1: Environmental Preparations
1.1 Java Development Kit (JDK) Installation:
We need a Java Development Kit (JDK) to run Appium. You can install [1] Java for Windows via this link.
- The thing to pay attention to here is to download Java which is suitable for the operating system of your computer.
Advanced system settings> Environment Variables
Browse File > New > This PC > Local Disk (C:) > Program Files > Java > jdk-21
Copy your chosen address and paste the variable value.
User Variables > Edit > New > Paste copied addresses.
· Path settings will vary depending on the files you install on your device, I recommend that you perform this step carefully.
You can check whether Java is installed on your computer with the “ java -version “ command via Command Prompt.
1.2 Android Studio and Android SDK Installation
To test Android applications, Android Studio must be downloaded, and SDK installed. You can obtain the relevant versions from Android Developers [2].
· It is necessary to start the installation by clicking on the file downloaded to the computer.
· There is no need to make any changes as the information comes automatically during the installation phase.
SDK Manager
After clicking edit follow these steps:
This Pc > Local Disk (C:) > AppData > Local > Android > Sdk
SDK Platforms
SDK Tools
Android Studio Environment Settings
This Pc > Local Disk (C:) > Users > (Example username) > AppData > Android > Local > Platforms > Sdk
Copy the resulting address and paste it into the environment variables path section.
After completing all this, you should choose an emulator. You need to select it from the Device Manager section in Android Studio.
What should we pay attention to when choosing an emulator?
API Level and Features
Emulator Performance
Emulator Version
Emulator Speed and Loading Time
STEP 2: Installing Appium with Node.js and Npm
To install Appium, Node.js and NPM must be installed. You can download the relevant versions from the Node.js official [3] website and then install Appium globally by typing the following command in the terminal or command prompt:
sudo npm install -g appium
STEP 3: Appium Libraries
Appium necessitates distinct driver libraries tailored for Android and iOS platforms. To seamlessly integrate these libraries into your project, execute the subsequent commands:
3.1 For Android:
appium driver install uiautomator2
STEP 4: Starting the Appium server
Once Appium is successfully installed, initiate the Appium server by entering the following command in your terminal or command prompt:
appium
To start with default settings:
appium -a 0.0.0.0 -p 4723
STEP 5: Appium Inspector Installation
You can use Appium Inspector to apply actions to elements within the application. You can download Appium Inspector from the GitHub [4] repo and install the appropriate version for your device.
To access the elements facilitating interaction with your application, input details like platform, device, and application path into the Appium Inspector. Then, click the ‘Start Session’ button to initiate the session.
STEP 6: IDE Installation
You need to choose an IDE to write test cases. I am using IntelliJ IDEA. If you wish, you can choose a different IDE. You can download it for Windows [5] via this link.
If you encounter issues with interacting with the application, you may attempt to troubleshoot by executing the following commands in the terminal [6] :
adb uninstall io.appium.uiautomator2.server
adb uninstall io.appium.uiautomator2.server.test
By adhering to these steps, you can effectively install Appium and commence testing your mobile applications.
REFERENCES
[2] Download Android Studio & App Tools — Android Developers
[3] Node.js — Download Node.js® (nodejs.org)
[5] Download IntelliJ IDEA — The Leading Java and Kotlin IDE (jetbrains.com)
[6] https://medium.com/@abdurrahmanpulat9/mobile-test-automation-installation-steps-3ffe5c85c6d2