Appium is an open-source project which can test mobile application automatically. Before you can use it to run a test case for a mobile application, you need to set up a test environment for it. This article will show you how to set up the Appium test environment step by step.
1. Install JDK.
- You can read the below articles to learn how to install JDK and set java environment variables.
- Beginner’s guide for install JDK(java development kit) and eclipse in windows
- How To Set Java Environment Variable JAVA_HOME, CLASSPATH, PATH
2. Install Android SDK.
- Article Setup Android App Development Environment will tell you how to install Android Studio.
- In the Choose Components wizard dialog of the above process, it will install Android SDK for you if you select both the Android Studio, Android SDK, and Android Virtual Device check box.
- In the next Configuration Settings wizard dialog, you can specify where your android SDK will be installed. In our example, android SDK is installed in the folder
C:\Users\Jerry\AppData\Local\Android\Sdk
. Save this directory in a text file. - You can also find the Android SDK directory after Android Studio installation. Click ” Tools —> Android —> SDK Manager ” in the android studio top menu.
- Click Appearance & Behavior —> System Settings —> Android SDK menu item on the Default Settings wizard dialog left side. Then you can find the android SDK install directory in the right side Android SDK Location area.
3. Setup Android SDK Environment Variables.
- After installing Android SDK in your windows OS, you need to setup android related environment variables to execute Appium.
3.1 Add ANDROID_HOME Environment Variable.
- Click ” Start Menu —> Control Panel —> System and Security —> System”.
- Click “Advanced system settings —> Environment Variable”, then popup the Environment Variables settings dialog.
- Click the New button to add the ANDROID_HOME environment variable, the value is just the android SDK installation directory which you saved in step 2.
3.2 Add Android Path Environment Variable.
- Edit the environment variable Path in the above Environment Variables dialog, append the value
;%ANDROID_HOME%\tools;%ANDROID_HOME%\platform-tools
at the end of the current value.
4. Create Android Virtual Device.
- Before you can run Appium, you should first create and launch an android virtual device. Because the Appium windows version only supports android os from os version 1 to version 6, so we should create an android 6.0 virtual device.
- Open Android Studio, click the ” AVD Manager ” icon button located at the top toolbar.
- If there is an Android Virtual Device exists, then you can see it in the AVD list. Whether the AVD list exists or not, you can create a new one by clicking the Create Virtual Device button at the bottom.
- After you click the ” Create Virtual Device ” button in the above dialog window, it will go to the Select Hardware window, you can choose which device simulator you want to create.
- Select the device category in the left side Category list pane, then select the device detail model in the middle pane.
- Choose a virtual device name, then click the Next button to go to the next page to see which android os version that device support. Because we want to use android os 6.0, so we choose the “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 the AVD creation, this may take some time also.
- After that, you can see the newly created AVD in the list, click the green triangle button in the Actions column to launch it.
5. Install Node.js.
- Appium is written using Node.js. So we need to install Node.js to run Appium.
- Go to the 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 normal, you do not need to do any special configuration during the installation process.
6. Install Appium.
- Go to the Appium download page to download the Windows version.
- After download, unzip it to a local folder. Click the appium-installer.exe to install.
- Just use the default value during the install process, do not need to do any special settings.
- After your installation, you can see an icon Appium —> Appium in the Windows Startup menu.
- Click the above button to open the Appium server window.
7. Launch Android App From Appium.
- Now you can use Appium to launch an app from it.
- Start android virtual device emulator “Galaxy Nexus ” which runs os 6.0 in step 4, this may take some time.
- Click the Android Settings button to open the Appium dialog. Select your APK file path which you want to test in the application section, in the Capabilities section select Platform Name, Automation Name, and PlatformVersion. The maximum value for PlatformVersion is 6.0. Input a Device Name as you like.
- In the General Settings dialog, check the “Pre-Launch Application” and “Override Existing Session” checkbox.
- Now you can click the Launch button to start your android app from Appium. During this process, you can see a lot of log data print out in the Appium console.
- Now the Appium test environment for Windows has been set up completely. You can test the app manually or by automation testing code. We will show you how to write test code in later articles.
Unable to enter the text in login username field,
With the same script able to run the script in Appium studio and Device also but the script is not working while running using appium server
Unable to enter the text in login username field