The Complete Appium Guide to Run Tests on Real Device - Codoid
Select Page
Mobile App Testing

The Complete Appium Guide to Run Tests on Real Device

Here is our all-inclusive Appium Guide that will enable you to run tests on real devices using both Windows and macOS systems.

The Complete Appium Guide to Run Tests on Real Device - Blog
Listen to this blog

Appium is a great choice if you are on the lookout for open source tools to automate mobile applications. Be it native, web, or hybrid applications, Appium will be able to automate it. In addition to that, it has cross-platform support across Android, iOS, and Windows as well. Last but not the least, its support for multiple programming languages like C#, Python, Java, Ruby, PHP, JavaScript with node.js, and so on. As a leading QA company, Appium has been always been our go-to tool in many of our projects. So in this Appium guide, we will be giving you a thorough walkthrough of how you can run tests on real devices using Appium. Let’s take a look at a few other advantages that Appium has to offer before we proceed further.

Advantages of Appium

  • Appium is an open-source tool that is very easy to install. Reinstallation of the application is also not needed when there are any small changes that have to be made.
  • Appium doesn’t require any application source code or library.
  • It has an active and helpful community.
  • Unlike other testing tools, you wouldn’t have to include any additional agents in your app for making it compatible with Appium for automation. It will test the same app that will be uploaded to the App or Play Store.
  • Beyond testing the mobile apps from Android and iOS, it can also be used to test windows desktop applications.
  • Parallel execution of test scripts can be achieved by using Appium.

Prerequisites for using Appium

Now in this Appium Guide, let’s take a look at few of the prerequisite you’ll be needing in order to get Appium up and running. You would have to install the following,

  • Java (JDK)
  • Android Studio
  • Additional Android SDK tools
  • Appium jar file
  • Appium Desktop Client
  • Eclipse IDE for Java

Note: Node.js and NPM will be there by default whenever the Appium server is installed. It is not required to install node.js and NPM separately as would be already included in the current version of Appium.

Appium Guide to install Appium with Node.js

Step 1: Check if node.js is installed on your system by entering the below-mentioned code in Command prompt. Step 1 isn’t the only step where we have mentioned the codes. So make sure to use the appropriate codes we have highlighted in the command prompt.

node --version 
npm –version

Step 2: Download the node.js installer

Step 3: Run the installer & install node.js & npm

Step 4: Check if node.js & npm are installed.

node --version
             npm --version
             where node
             where npm

Step 5: Install Appium with node.js

npm install -g appium 

Step 6: Check if Appium has been installed

appium -v
where appium

Step 7: Start Appium

Installing Appium with APPIUM DESKTOP CLIENT in Windows

Step 1: Download the Appium desktop client

Step 2: Install the Appium desktop client

Step 3: Start Appium through the desktop client

Appium Guide to install Appium on MacOS

Step 1: Check if node is installed on your system

node -v

Step 2: Install node.js

brew install node

Step 3: Check if node is installed using these codes

node -v
npm -v

Step 4: Install Appium

npm install -g appium

Step 5: Check if Appium is installed

appium -v

Step 6: Use the below code to start appium


Installing Appium with Appium desktop client

Step 1: Download the Appium desktop client

Step 2: Double click on the .dmg file to install the Appium desktop client

Step 3: Start the Appium desktop client

To verify Appium’s installation and its dependencies

Install Appium-doctor as it is a tool used to verify Appium installation. We can install it by using npm as we’ve already installed node

npm install appium doctor -g

If you want to check the version of Appium doctor, use the following code

appium -doctor --version

How to uninstall Appium

If you had installed through node.js, then use the below code,

npm uninstall -g Appium

If you had installed the Appium Desktop Client, then just delete the app

Appium Guide to connect a Real Android Mobile Device on Windows

Step 1: Download SDK tools

Step 2: Unzip the folder and then extract the platform-tools using the below code

sdkmanager “platform-tools” “platforms;android-28”

This command will extract the platform-tools

Step 3: Set the environment variables

ANDROID_HOME=location of SDK folder

Path: Append the path of the plaform_tools folder

Step 4: Check the command ‘adb devices’ in the command line

Step 5: Make the device ready

Enable developer mode to turn on ‘USB Debugging’

Step 6: Connect the real device to the computer using a USB cable.

Step 7: Run the below command

adb devices
adb = android debug bridge

Check if your device ID is displayed.

Appium Guide to Connect Real Android Device on macOS

To achieve this, you must have Java installed on your system, and the JAVA_HOME should be set in the environment variables command to check the Java –version. You should have also installed homebrew.

Step 1: Download the Android SDK

You can download it using this link directly and install it using the below-mentioned codes.

brew install android-sdk
brew cask install android-sdk

Step 2: Extract the platform-tools folder using the following command

sdkmanager “platform-tools” “platforms;android-28”

Step 3: Add environment variables

ANDROID_HOME = path of android-sdk folder

Path: Append the path of the platform-tools folder

export ANDROID_HOME=/usr/local/share/android-sdk
   export PATH="/usr/local/Caskroom/android-sdk/4333796/platform-tools:${PATH}"

Use the below code to set the environment variables permanently on the Mac system

   cd ~/
   cat .bash_profile

If bash_profile does not exist

touch .bash_profile

Press i and add the following

For setting the PATH for ANDROID_HOME

   export ANDROID_HOME=/usr/local/share/android-sdk

For adding the platform tools to the PATH


Press the ‘Esc’ key


Hit ‘Enter’

Now Android Home and Path have been set permanently.

   echo $PATH

You should be able to run the command ‘adb devices’ now.

Step 4: Same as Windows, make your mobile device ready for automation by enabling developer options and turning on the ‘USB Debugging’ option.

Step 5: Connect the real device with your computer system using a USB cable.

Step 6: Run the following command

adb devices

Check if the Device ID is displayed

Running Your First Test on a Real Mobile Device

Step 1: Download Eclipse or any other IDE for Java

Step 2: Create a Java project

Step 3: Add the following libraries

1. Selenium Java

2. Appium Java client

Step 4: Connect your device and run the below command

adb devices

Step 5: Start the Appium server either from the command line or using the Appium Desktop Client

Step 6: Add the code to start automation on your mobile device.

Set the desired capabilities and start the calculator application.



Step 7: Run and validate

Appium Test Case for Native Android App (Calculator)

Step 1: Download the ADT Eclipse plugin or download the ADT bundle separately

Step 2: Open Eclipse and Create a new Project >> Package >> Class

Step 3: Import the Selenium library and TestNG inside that new project.

Step 4: Now create a small test Program for ‘’ to add two numbers.

package src_Appium;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
//import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.testng.annotations.*;

public class Calculator {
WebDriver driver;

public void setUp() throws MalformedURLException{
           //Set up desired capabilities and pass the Android app-activity and app-package to Appium
           DesiredCapabilities capabilities = new DesiredCapabilities();
           capabilities.setCapability("BROWSER_NAME", "Android");
           capabilities.setCapability("VERSION", "4.4.2"); 

capabilities.setCapability("appPackage", "");
// This package name of your app (you can get it from apk info app)
 capabilities.setCapability("appActivity",""); // This is Launcher activity of your app (you can get it from apk info app)
//Create RemoteWebDriver instance and connect to the Appium server
 //It will launch the Calculator App in Android Device using the configurations specified in Desired Capabilities
   driver = new RemoteWebDriver(new URL(""), capabilities);

public void testCal() throws Exception {
   //locate the Text on the calculator by using
   WebElement two=driver.findElement("2"));;
   WebElement plus=driver.findElement("+"));;
   WebElement four=driver.findElement("4"));;
   WebElement equalTo=driver.findElement("="));;
   //locate the edit box of the calculator by using By.tagName()
   WebElement results=driver.findElement(By.tagName("EditText"));
           //Check the calculated value on the edit box
assert results.getText().equals("6"):"Actual value is : "+results.getText()+" did not match with expected value: 6";


public void teardown(){
           //close the app


So we have done a comprehensive coverage of everything that you would need to know in this Appium Guide like the advantages of Appium, the methods to install Appium on both Windows and macOS, and also saw how to connect a real device on both platforms and run a test. We hope you’ve found this blog to be informative. As one of the best mobile app testing services providers, we highly recommend Appium for your testing projects to get the best results.


Submit a Comment

Your email address will not be published.