Installing different software

To get started with Appium, we need to install some software on our machines. Let's start the installation process on different machines.

Appium installation for Android

The prerequisites for the installation of Appium on Android are as follows:

  • JDK (Java development kit)
  • Android SDK (Software development kit)
  • Appium for different OSes

Installing JDK on Windows

In order to install the JDK, you can visit http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html.

After installing the JDK, you need to set the environment variables. To do this, perform the following steps:

  1. Open System Properties by pressing the Windows logo + Pause key or right-click on My Computer and then click on Properties.
  2. Click on Advanced system settings.
  3. Click on Environment Variables.
  4. Under User variables, click on New. Then, you will get the following screenshot:
    Installing JDK on Windows
  5. Enter the Variable name as JAVA_HOME.
  6. Enter the Variable value as the installation path for the JDK, for example, C:Program FilesJavajdk1.8.0_20jre.
  7. In the System variables section, double-click on Path; then, in Variable value, add the new path %JAVA_HOME%in. Just ensure that there is a semicolon separating this entry from the preexisting value, as shown in the following screenshot:
    Installing JDK on Windows
  8. Finally, click on the OK button to apply the changes.

Now, open the command prompt and enter the command java -version to check the Java path setting. This will return the Java version available on the system.

Installing the Android SDK

We need to install the Android SDK to drive the test scripts on devices. You can download the Android SDK from http://developer.android.com/sdk/index.html for your operating system.

We will set the system variables for Windows using the following steps:

  1. Follow steps 1 to 4 from the preceding section, in which we set the path for Java.
  2. Type Variable name as ANDROID_HOME and enter the Variable value of where you have your Android SDK installed. For example, C:android-sdk.
  3. Now, we need to add the paths %ANDROID_HOME%platform-tools and %ANDROID_HOME% ools to the Path variable under System Variables.
  4. Click on the OK button to apply the changes.

To verify the Android path, type android on the command prompt and press Enter. The following window will appear:

Installing the Android SDK

Install the packages, as shown in the preceding screenshot. If you are testing API 19, then you just need to install SDK tools (22.6), Platform-tools (19.0.1), Build-tools (19.0.3), and Android 4.4.2.

Setting the system variables for Mac

If you are setting the system variables for the first time, then you need to create the.bash_profile file with the help of following steps:

  1. Open the terminal.
  2. Type touch ~/.bash_profile and press enter/return.
  3. Type open ~/.bash_profile. The system will open the bash_profile file.

Now, we have a bash_profile file. In order to set the Java and Android SDK paths, we need to configure the JAVA_HOME and ANDROID_HOME variables in bash_profile. Add the following paths into the file:

  • export JAVA_HOME=path/to/the/java/home
  • export ANDROID_HOME=path/to/the/android/sdk
  • export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools

Once you have completed all the steps, type java –version in the terminal to check the Java path setting. This will return the Java version available on the system; type android on the terminal and install the desired Android packages.

Appium for iOS

The following are the prerequisites for installing Appium on iOS:

  • Xcode
  • Homebrew
  • Node and npm

Installing Xcode

We need to perform the following steps to install Xcode:

  1. Visit https://itunes.apple.com/us/app/xcode/id497799835 to install Xcode. Then, click on View in Mac App Store.
  2. The system will launch the App Store automatically on your Mac and open the Xcode page.
  3. Now, click on the Free button and then click on Install App.

To launch Xcode, you can go to the Applications folder and then double-click on Xcode. Now you are done with the installation.

Installing Homebrew

Homebrew is a software package management system for Mac, which is used to install the stuff you need that Apple didn't provide. With Homebrew, you can install many open source tools. Perform the following steps to install Homebrew:

  1. Open the terminal and enter the following command:
    ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)".
    
  2. Follow the instructions prompted by the terminal.
  3. After installing the Homebrew, run the command brew doctor. You will get the message Your system is ready to brew; if you don't, then try to fix the warnings and errors using the brew doctor.

Node and npm

npm is a Node.js package manager; it is an online repository of open source Node.js projects. It is command-line utility to package installation.

The Appium server is written in Node.js; that's why we need it to download Appium. There are other ways to download the Appium server as well, which will be discussed later.

Let's install Node using brew commands. You need to run the following command to install Node:

brew install node

Appium for different OSes

There are different methods to install the Appium server on Windows/iOS. Let's discuss them one by one.

Appium for Windows

You can download Appium for Windows directly from Appium's official website (http://appium.io/), or you can clone Appium from https://github.com/appium/appium.git.

Just to ensure that we are ready to start with the Appium server, enter the following command on the Command Prompt:

node Appium-doctor

You don't need to download Node; you can get it from the Appium bundle. To run the Node commands, you need to set the path for Node (for example, C:AppiumForWindows). Before running the command, set the directory as C:AppiumForWindows ode_modulesappiumin.

Appium for Mac

Appium for Mac can be downloaded from the Appium website, alternatively you can download it using npm commands.

Run the following command to install Appium:

npm install –g appium

After installation, run the appium-doctor command to ensure that we are ready to use Appium.

Note

Make sure you have not installed Appium with sudo, otherwise you will face authorization problems while running Appium.

Downloading the necessary JAR files

We need to download some executable binaries to work with Appium. They are listed as follows:

Tip

The download links can be changed; I suggest you visit the official websites in the case of an address change.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
44.200.94.150