Appium is an open source project which can test mobile application automatically. Before you can use it to run test case for mobile application, you need to setup test environment for it. This article will show you how to setup Appium test environment step by step.
1. Install Jdk
You can read below articles to learn how to install jdk and set java environment variables.
2. Install Android SDK
Article Setup Android App Development Environment will tell you how to install Android Studio. During that process, it will install Android SDK for you if you select the check box as below.
In the next wizard dialog, you can specify where your android sdk installed. In our example, android sdk is installed in folder
C:\Users\Jerry\AppData\Local\Android\Sdk. Save this directory in a text file.
You can also find android sdk directory after Android Studio installation. Click ” Tools —> Android —> SDK Manager ” in android studio top menu.
Then you can find android sdk install directory in the popup dialog as below.
3. Setup Android SDK Environment Variables
After install Android SDK in your windows OS, you need to setup android related environment variables to execute Appium.
Add ANDROID_HOME environment variable.
- Click ” Start Menu —> Control Panel —> System and Security —> System”.
- Click “Advanced system settings —> Environment Variable”, then popup below dialog.
- Click New button to add ANDROID_HOME environment variable, the value is just android sdk installation directory which you saved in step 2.
Add Android Path environment variable.
- Edit Path in above Environment Variables dialog, append below value at the end of exist value.
4. Create Android Virtual Device
Before you can run Appium, you should first create and launch an android virtual device. Because Appium windows version only support android os from os version 1 to version 6, so we should create an android 6.0 virtual device.
- Open Android Studio, click ” AVD manager ” icon button located at the top tool bar.
- If there has android virtual device exist, then you can see avd list. Whether avd list exist or not, you can create a new one by click create virtual device button at bottom.
- After you click ” Create Virtual Device ” button, you can choose which device simulator you want to create.
- Choose a virtual device name, then click Next button to go to next page to see which android os version that device support. Because we want to use android os 6.0, so we choose “Galaxy Nexus” device. If you see a Download link beside Release name, then you need to click it to download and install that os image in your PC, this process may take some time.
- Click ” Next —> Finish ” to complete avd creation, this may take some time also.
- After that you can see the new created avd in the list, click the green triangle button in Actions column to launch it.
5. Install Node.js
Appium is written use Node.js. So we need to install Node.js to run Appium.
- Go to Node.js download page.
- Download related version. In this example we need to download windows version node-v6.11.4-x64.msi.
- Then double click the node.js installer to install it as normally, you do not need to do any special configuraton during the installation process.
6. Install Appium
- Go to Appium download page to download windows version.
- After download, unzip it to a local folder. Click appium-installer.exe to install.
- Just use default value during the install process, do not need to do any special settings.
- After your installation, you can see an icon in startup menu.
- Click above button to open Appium server window as below.
7. Launch Android App From Appium
Now you can use Appium to launch app from it.
- Start android virtual device emulator “Galaxy Nexus ” which runs os 6.0 in step 4, this may take some time.
- Click android settings button to open a dialog as below. Select your apk file path which you want to test in application section, select Platform name, automation name and PlatformVersion in capabilities section. The maximize value for PlatformVersion is 6.0. Input a device name as you like.
- In general settings dialog, check “Pre-Launch Application” and “Override Existing Session” checkbox.
- Now you can click Launch button to start your android app from appium. During this process you can see a lot of log data print out in appium console.
- Now the Appium test environment for Windows has been setup completely. You can test the app manually or by automation testing code. We will show you how to write test code in later articles.