2019 / 9 / 5
Appium is an open-source test automation tool which allows you to write functional tests to automate iOS and Android mobile applications. One big advantage of Appium over other test automation tools is that Appium tests can be written in any language that has Selenium Client Library including Python, Ruby, Node.js.
Appium supports native, hybrid and web application testing and also supports testing on emulators, simulators and real devices.
It supports cross-platform application testing i.e. single API works for both Android and iOS platform test scripts.
In this post we will walk through the steps involved in testing the Android sample app. We will be discussing this blog post in 2 parts: Part 1: Getting environment setup with Appium and TestNG.
And Part 2: Writing your Test Cases.
Part 1: Getting environment setup with Appium and TestNG.
The most difficult part of getting automated mobile testing, is to determine the correct set of tools to use, which version to use and how to install everything correctly so that it works seamlessly together. Sadly, it is not that easy, not a job of just a few clicks to install everything you need.
In this tutorial, we have discussed the recommended tools, that we will be using to show how to automate an Android app. But, there are plenty of other variations also. Below is a comprehensive list of all the tools, which we will be discussing one by one in detail.
Steps to install Chocolatey:
Chocolatey is simply a package management software that makes it easier for us to install and manage other software.
Click on “Yes” button in the dialog that appears.
In case of command prompt enter the following command to install chocolatey-
@"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
In case of powershell enter following command to install chocolatey:
Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
Steps to Install Node and NPM:
Use chocolatey to install Node. NPM comes installed with Node. SO, you don’t need to install it separately.
choco install nodejs.install
Steps to install JDK and set JAVA_HOME:
Since our tests will be written using Java language, so we will be requiring JDK- Java Development Kit.
Steps to install Android Studio and Android SDK:
We need Android Studio to write and run tests on Android Apps and Devices.
From the “SDK Tools”, ensure following options are selected:
a. Android SDK Build-Tools
b. Android SDK Platform-Tools
c. Android SDK Tools
d. Intel x86 Emulator Accelerator (HAXM installer)
e. Android Support Repository
f. Google Repository
Click “OK” and install if there are any additions.
Edit the Path Variable under the System Variables to add path of Sdk folder under Android directory “C:\Users\Rashi\AppData\Local\Android\Sdk\”
Steps to install Appium:
Appium is an open-source test automation framework and the hero of today’s tutorial.
Open the Node.js command prompt from the start menu.
Type the following command in the terminal:
npm install -g [email protected]
Successful installation of appium can be checked by entering the command- appium in command prompt. If no error message is displayed, it means appium is successfully installed.
Steps to install Appium Doctor:
Appium Doctor is the mini software, whose job is to check whether all of the preconditions for the execution of appium are true or not.
Open the Node.js command prompt.
Type the following command in the terminal :
npm install -g appium-doctor
Steps to install Gradle:
Gradle is used to create apk and jar files. It is an open-source build automation system.
Open the command prompt.
Type the following command:
choco install gradle
Steps to install Maven:
Maven is a tool used to build and manage Java based projects.
Open the command prompt..
Type the following command:
choco install maven
Steps to install Eclipse:
Eclipse is an Integrated Development Environment (IDE). We are going to use eclipse to write, compile and run test scripts.
Steps to install TestNG:
With this we are done with all the installation. Now it’s time to get your setup ready and get started with the actual coding of test cases in the next blog post.