Mobile Test Automation Installation Steps (EN)
Appium for Mobile App Test Automation
Testing mobile applications is crucial for improving application quality and enhancing user experience. Appium is an open-source automation tool that works on both Android and iOS platforms. In this article, you will learn the fundamental installation steps and usage of Appium.
Step 1: Environmental Setup
1.1 Java Development Kit (JDK) Installation
To run Appium, you need the Java Development Kit. If you prefer to perform this process via Terminal on a Mac, you should install Homebrew first. Use the following commands to install JDK:
brew update # optional
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install openjdk@11
echo 'export PATH="/opt/homebrew/opt/openjdk@11/bin:$PATH"' >> ~/.bash_profile
source ~/.bash_profile
echo 'export JAVA_HOME=$(/usr/libexec/java_home)' >> ~/.zshrc # veya .bash_profile
echo 'export PATH=${JAVA_HOME}/bin:$PATH' >> ~/.zshrc # veya .bash_profile
Additional path settings for Android:
export ANDROID_HOME=/Users/$(whoami)/Library/Android/sdk
export ANDROID_SDK_ROOT=$ANDROID_HOME
export ANDROID_AVD_HOME=/Users/$(whoami)/.android/avd
export PATH=$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools:$ANDROID_SDK_ROOT/emulator:$PATH
Note: Path settings may vary depending on the files you installed on your device. Carefully execute this step.
Check the successful installation by using the following command:
java -version
1.2 Android Studio and Android SDK Installation
To test Android applications, download and install Android Studio and Android SDK. You can find the relevant versions on the Android Developer website.
After successfully installing Android Studio and obtaining your Android SDK, you need to create and configure an Android emulator. You can do this through the “AVD Manager” in Android Studio. Prepare the emulator you created for use in your Appium tests.
1.3 Xcode Installation (For iOS Tests)
To test iOS applications, download and install Xcode. You can acquire Xcode from the App Store.
After installing Xcode, download uicatalog from GitHub. This tool allows you to run the desired iOS device through Xcode.
This tool will allow you to run any iOS device you want via Xcode.
Step 2: Node.js and Npm Installation
To install Appium, Node.js and Npm must be installed. Download the relevant versions from the official Node.js website. Then, type the following command in the terminal or command prompt to install Appium globally:
sudo npm install -g appium
Step 3: Appium Libraries
Appium requires specific driver libraries for Android and iOS. You can install the relevant libraries with the following commands:
3.1 For Android:
appium driver install uiautomator2
3.2 For iOS:
appium driver install xcuitest
Step 4: Starting Appium Server
After installing Appium, you can start the Appium server by typing the following command in the 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. Download Appium Inspector from the GitHub repository and install the appropriate version on your device.
Provide information about the platform device and application path you want to run through Appium Inspector. Click the start session button to interact with elements in your application.
Step 6: IDE Installation
You need to choose an Integrated Development Environment (IDE) to write test scenarios. You can download one of the popular IDEs, such as Eclipse or IntelliJ IDEA. I prefer IntelliJ IDEA and you can download it from the JetBrains website for Mac devices. If you are using Windows, find the suitable version for your device on the same website.
Quick Notes:
If you cannot interact with the application, try resolving the issue by running the following commands in the terminal:
adb uninstall io.appium.uiautomator2.server
adb uninstall io.appium.uiautomator2.server.test
By following these steps, you can successfully install Appium and start testing your mobile applications.