Setting up Appium environment

This section will guide you through the process of installing Appium Server on your host PC.

Mobile Testing Environment Prerequisites

Setup Android Environment

Installing JDK

  1. Download the proper installation file from Oracle for your operating system. Java SE Development Kit 11.0.5 LTS is recommended.

  2. Run the installer, then wait until the installation is complete. JDK Installed

  3. Set JAVA_HOME in your system’s environmental variables to the JDK installation path.

    Firstly, find your JDK installation path. On Windows, the path should be C:\Program Files\Java\jdk-<VERSION NUMBER> by default. It should be /usr/libexec/java_home on OS X and /usr/lib/jvm/java-<VERSION NUMBER>-openjdk-amd64 on Linux (Ubuntu).

    • Windows: Hit Windows + R combination then type “sysdm.cpl” in Run dialog box. It will open the Advanced System Setting window, then click Environment Variables... on Advanced tab. Click New button in the User Variables section for adding the variable detail. Enter JAVA_HOME for variable name and the JDK 8 folder location on your computer in variable value field (e.g. C:\Program Files\Java\jdk-11.0.5). Editing the environment variables

    • OS X:

      For OS X use zsh as default shell (OS X 10.15): Open ~/.zprofile with a text editor (e.g. run open -e ~/.zprofile from terminal).

      For OS X use bash as default shell (OS X 10.14 and below): Open ~/.bash_profile with a text editor (e.g. run open -e ~/.bash_profile from terminal).

      Then add a new line export JAVA_HOME=<JDK INSTALLATION PATH> to the opened file and save it. See this article for OS X update details from Apple.

      ヒント: 
      You can check the default shell on your system by the title of any running terminal.

    zsh zsh shell

    or bash bash shell

    • Linux: Find the path to your java installation, it depends on which version of Linux you are using. Open ~/.bashrc with a text editor (e.g. gedit ~/.bashrc on Ubuntu 18.04.3) and add the line export JAVA_HOME=<JDK INSTALLATION PATH>. Save the file.
  4. PATH variable configuration: Add the JDK bin folder path to your system’s environment variable PATH (or Path on Windows 10). You’ll need to intialize this variable using the same method you used for the JAVA_HOME variable if you have not already done this.

    On the other hand, you just have to edit by click Edit button after select it and add new value %JAVA_HOME%\bin by click New button (for Windows). On OS X, depend on the system default shell that you have to add new line export PATH=$PATH:$JAVA_HOME/bin to ~/.zprofile or ~/.bash_profile file. For Linux, users have to add new line export PATH=$PATH:$JAVA_HOME/bin to ~/.bashrc.

  5. Run source ~/.bash_profile or source ~/.zprofile (for OS X) and source ~/.bashrc (for Linux) or restart the machine. Remember to run these commands (or restart) everytime you modify these files. Windows users don’t need to do this step.

ヒント: 
For instructions on setting up the JDK, please refer to Oracle’s JDK Installation guide.

Installing Android Studio

Android Studio is an IDE for creating Android applications. The Android SDK tools are included when you install Android Studio.

ヒント: 
If you don’t want to install Android Studio, you can download the basic Android CLI tools which come with the sdkmanager. However, Android Studio is the recommended choice as it’s easier to set up.

  1. Go to the Android Studio website and click Download Android Studio.
  2. Run the application file (e.g. android-studio-ide-182.5314842-windows.exe).
  3. In the Choose Components screen, select the Android Studio Android Studio Choose Components
  4. Configure your settings, then click Install to start the installation process.
  5. Click the Finish button on the Completing Android Studio Setup screen to finish the process.
    Finish installing Android Studio

Installing Android SDK Tools

After installing Android Studio, you’ll need to install Android SDK Tools in order to use Appium.

When launching Android Studio for the first time, the setup process will start and ask if you want to install the required Android SDK Tools (If you’ve already set up Android Studio go to Step 6) :

  1. Launch Android Studio

  2. Android Studio Setup Wizard will be displayed like below Android Studio Setup Wizard

  3. Click Next, then select Standard on the Install Type screen

  4. Continue navigating to Verify Settings, you will see the list of SDK Components to be downloaded

    ヒント: 
    The items in the list depend on the current version of Android Studio. If you already have an older version installed, the list might be different.

  5. Click the Finish button and then wait until the installation is completed.

  6. If you’ve already set up Android Studio, open up the SDK Manager by selecting Configure > SDK Manager from the menu bar.
    Android SDK Manager

  7. Select Android SDK > SDK Tools
    Android SDK Tools

  8. Ensure that the components below have been installed or updated:

    • Android SDK Build-Tools (version 33.0 is recommended)
    • Android Emulator
    • Emulator Accelerator (if available)
  9. Configure the ANDROID_HOME environmental variable: Initialize this variable using the same method you use for the JAVA_HOME environmental variable.

    • For Linux, add the line export ANDROID_HOME=~/Android/Sdk to your .bashrc file.
    • On Windows, the variable’s value should be C:\Users\<UserName>\AppData\Local\Android\Sdk.
    • On OS X, add the line export ANDROID_HOME=/Users/<UserName>/Library/Android/sdk to your.bash_profile or .zprofile.

Checking the adb command

Android Debug Bridge (adb) is a powerful tool that’s provided as part of the Android SDK. With adb, you can run commands and communicate with connected devices or emulators.

First, you can check whether adb has been installed with adb devices command:

adb devices
* daemon not running; starting now at tcp:5037
* daemon started successfully

If you get the daemon started successfully message, then adb is installed and is working properly.

If the command adb devices fails to run (like in the Windows example below), please follow the next TIP.

adb devices
'adb' is not recognized as an internal or external command,
operable program or batch file.

ヒント: 
You have to add path to <platform-tools> folder to your PATH variable to run adb command from any directory.

For Windows, users have to add C:\Users\[username]\AppData\Local\Android\Sdk\platform-tools to your PATH using the same method you used for installing the JDK

On OS X just add this :<path to platform-tools folder> to the line that contains the PATH variable value in .zprofile or .bash_profile. The whole line should look like this : export PATH=$PATH:$JAVA_HOME/bin:$ANDROID_HOME/platform-tools or export PATH=$PATH:$JAVA_HOME/bin:/Users/test/Library/Android/sdk/platform-tools in case ANDROID_HOME wasn’t set.

On Linux you have to add :<path to platform-tools folder> to the PATH variable by using either of these commands: export PATH=$PATH:$JAVA_HOME/bin:$ANDROID_HOME/platform-tools or export PATH=$PATH:$JAVA_HOME/bin:~/Android/Sdk/platform-tools

adb is included in the Android SDK Platform-Tools package. If it hasn’t been installed yet, you can install adb via the SDK Manager in Android Studio as above.

ヒント: 
For advanced adb usage, please refer to Android Debug Bridge (adb)

Installing Appium Server

Appium Server is required for testing on mobile, users can choose between installing it via npm or the Appium Desktop package which contains:

Note: Appium Desktop only runs on 64-bit systems. If you’re using a 32-bit (x86) system, please skip to the TIP below.

Click here to download and install the right package for your OS (version 1.22+ is recommended for Android). Typically:

ヒント: 
Only Appium Server is required for running tests, you can install Appium Server by following the instructions here instead of installing the Appium Desktop package.

Appium Desktop

Now open Appium Desktop and click the Edit Configurations button.

Appium Settings

Save the settings and restart Appium Desktop.

Appium Server with Command Line

If you choose not to use Appium Desktop, Appium Server has to be installed using the command line. You also have to use the command line to configure and control it. Follow the steps below to install Appium Server using the command line:

  1. Ensure that NodeJS is installed
  2. Open the command line and install Appium using npm
   npm install -g appium

Before running a test, users need to start Appium Server by running appium from the terminal.


Copyright © 2024 LogiGear Corporation. All rights reserved. LogiGearはLogiGear Corporationの登録商標であり、Action Based TestingおよびTestArchitectはLogiGear Corporationの商標です。ここに記載されているその他の商標は、各所有者の財産です。

LogiGear Corporation

1730 S. Amphlett Blvd. Suite 200, San Mateo, CA 94402

Tel: +1 (650) 572-1400