Appium Tutorial

This Appium tutorial is for learners and beginners, which provide you the conceptual knowledge about the Appium Automation testing tool.

Appium Tutorial

In this tutorial, we are going to discuss the following topics:-

  • What is Appium?
  • Different types of Apps.
  • Advantages of Appium.
  • Disadvantages of Appium.
  • Features of Appium.
  • History of Appium.
  • Philosophy of Appium.
  • The architecture of Appium.
  • Installation of Appium on Windows OS.

What is Appium?

In this technology era, we are surrounded by Software applications. Nowadays, tremendous growth in applications has made the application so handy that even children can make their apps. So, it becomes necessary to test the app on some parameters to certify it. For this process, automation testing tools are made by engineer's that test those applications. Appium is one of them. 

Appium is a tool used for automating apps. Appium is Automation, an open-source tool to automate mobile applications on different platforms. 

 Before going further, we have to understand the word "Automation"-Automation creates application technologies to produce and deliver goods and services with minimal human intervention. Automation is the gift of technology that reduces human efforts.

There are many other automating tools like Money Talk, KIF, Calabash and Frank, which require an extra agent to compile with application code, to connect the tool with the device. Still, Appium doesn’t require any extra agent to connect with the device framework. Appium is an open-source, cross-platform automation testing tool. It does Automation on native, hybrid and web applications based on Android and iOS framework systems.

Now, before going further, we must study about Native, Hybrid and Web app. Appium does automation testing on this type of web. So, firstly gain some knowledge about these apps.

 The difference between native, hybrid and web applications.

Appium Tutorial
NATIVEHYBRIDWEB
Apps that can be downloaded from the play store and App store.Combination of native and web App.These are web apps, basically websites.
For example, WhatsApp, Flipkart, game apps.For example, Flipkart, Amazon.www.javaTpoint.com
Android, iOS operating systems support these apps.These apps are supported by Android, iOS, Windows operating systems. These apps are supported by windows, search engine on mobile phones.
They are fast and reliable.Fast and reliableThey are slower than native and hybrid apps.  
They are written in java in Android and Objective-C in Apple, iOS system.They are written in java, Objective-C and HTML language for Windows.They are written in HTML for windows.
Native apps have a visible ICON.Hybrid apps have both CON and WEBSITE.The web app doesn't have an ICON.

ADVANTAGES AND DISADVANTAGES.

  1. Advantages of an Appium
Appium Tutorial

Some advantages of appium are as follows:-

  • Appium doesn’t depend on the mobile device. It can automate both iOS and Android devices on the same platform.
  • It is an open-source code platform as it supports simulators/Emulators, real devices, native, hybrid and web application testing of iOS and Android.
  • Appium supports JSON protocol.
  • Appium uses standard APIs in all the platforms where the app's recompilation and modification are not required.
  •  For testing apps, developers have to choose the same test framework of the application, but with appium, this is not the case. Appium is a framework free. It can work on any test framework or language used in test cases.
  • Appium provides testing of native, hybrid and web apps. It allows testers to automate native mobile apps for iOS, Android, Windows through the web driver protocol and provide a cross-platform to test the hybrid and native apps. It supports all languages like C, C++, Java, C#, java, Ruby PYTHON etc.
  • Appium doesn't allow the reinstallation of apps after Automation. 
  • Appium is very easy to install through the web and run very easily.
  •  Appium also provides a vital record and playback tool.
  • Appium is designed as an HTTP server so testing professionals can test smoothly without using a server machine.

Disadvantages of an Appium

Appium Tutorial

Some Disadvantages of appium are as follows:-

  • Difficult for new users to work on without guidance from an experienced.
  • Appium doesn't support the earlier versions of Android.
  • Developers have to use appium with selenium to test API for Android.
  • Appium inspector cannot be run on Microsoft.
  • Appium allows developers to execute a single test script to produce a more reliable test result (testers use UIAutomator for Android and Simulator for iOS; Apple has their instrument command client to connect with the appium server).

FEATURES OF APPIUM

Appium- Appium is a free of cost available open-source automation testing tool for automating test cases for native, hybrid and web applications. Appium also supports automation test on physical devices, emulators and simulators. It focuses on Android and iOS apps.

What are Android and iOS?

               ANDROID                            iOS
Android is an Operating System used in mobile technology. Android is an open system as the user can itself customize its phone easily. Google Android is commonly used nowadays by various mobile manufacturers like Samsung, LG etc. Android contains UIAutomator for automation testing in mobile phones.  iOS is also an operating system used in mobile technology. iOS is a closed system as a user don't have permission to customize their phones. Apple controls iOS. It is available on Apple's devices only,  such as the iPhone. It is costlier than Android, and apps are available on the Apple store only. These apps are different from Android and chargeable. iOS has it’s own automation Applications for automation testing.  

Why we Choose Appium?

In this digital world of applications, choosing the best automation testing tool is the key to a successful enterprise.  There are features of appium which will prove why we should choose appium as an application testing tool on a different device.

Appium Tutorial
  • Free and Open Source- Appium is free of cost and has an open-source code framework that makes an appium to support Simulators, Emulators and real devices. Appium can be re-coded by anyone and work accordingly to user whims. The user has all the control over the Back-end API and Database from the test code.
  •  Indeed Cross-platform – Appium can test various mobile applications; maybe it will be a native one, a web one or even a hybrid one. Appium works on Android, iOS, and Apple and installed on Windows, Mac and Linux through appium desktop client. Appium uses the libraries of Android with the help of UIAutomator to automate Android apps. Similarly, with Apple, it uses the libraries with the help of an application called an instrument.  
  • No reinstalling: Appium doesn't require reinstallation of the tested application and can modify it in any way.
  • No need for application Source Code- Various testing tools use the same application code or can modify it for automation framework. Still, appium doesn’t require application code to connect with the device.
  • Appium Support- Appium as a framework gives the flexibility to use a testing framework according to user device choice. Before appium, it was not possible.
  • A lively Community – Appium provides a live and friendly environment. Appium can be set up on a different platform and easy to handle. It provides an attractive community result in faster bug reports and easier troubleshooting, which is key to an automation testing tool's success.
  • Languages Support – Appium supports any WebDriver compatible programming language like Java, WebDriverAPI, Ruby, PHP, Javascript with Node.js and Python, C#, Pearl with Selenium for writing the test cases.
  • There are various competitors of the appium, some of them named Ranorex, Robotium, See test, Test Complete, Jomo solutions, which can prove why appium is the best  Automation testing tool.

Appium Vs. Selendroid Vs. Robotium

SELENDROIDAPPIUMROBOTIUM
It is a free and open-source code platform.It is free and open-source.It is free and open-source.
It only supports Android.It supports both Android and iOS.It only supports Android.
Its community is not as much strong as appiumAppium has a healthy and active community. It doesn’t have a proactive community.
It is only compatible with selenium and jerkin.Appium supports multiple programming languages and frameworks.Robotium supports java language only.  It is not compatible with selenium
It requires an app source code for automation testing.It doesn’t require app source code for automation testing.It doesn’t require app source code for automation testing.
It only supports android 2.3-4.4It doesn't reinstall the application.A Small change in Robotium code leads to a complete rebuilt.

HISTORY OF APPIUM

Inventions are the result of necessities or mistakes. Every creation has a reason, process, circumstances, requirements etc. which makes its history.  Every Invention or creation has a history, so let's learn the journey of appium from a thought to the best automation testing tool. How appium generates and grows up, what it is today?

About DAN CUELLAR

Appium Tutorial
Dan Cuellar

Qualification-  Bachelor’s degree in computer science from Computer School at Carnegie Mellon University in Pittsburgh.

Before creating an appium, he headed the test organization Shazam Entertainment in London and Zoosk in San Francisco. He also worked for Microsoft Outlook for Mac and Microsoft Office Suite.

Appium Tutorial

It was the beginning of the Appium. 

  • Founder of appium, Dan Cuellar was the test manager, working on a dating website at Zoosk in 2011, where he encountered a problem during the dating app testing. The test he was doing on an iOS product was troubling him; its length was getting out of hand. To resolve this issue, Dan surveyed the existing landscape of the tool. He asked his manager to see a better way, and then he realized that Automation was the answer. This is how iOS auto was born.

SELENIUM CONFERENCE IN 2012

  • Selenium Conference was held in 2012 in London, where DAN has to give presentations on an entirely different topic. He showed off iOS Automation using selenium to write platform diagnostic tests that use separate platform-specific page objects with a common interface.

 On the next day of the conference, Dan was about to give the lightning talk where he faced technical difficulties to load his presentation. John Huggins, co-creator of selenium, had moved to the next lightning talk, but at the last moment, Screen turned on, and Dan continues his presentation and explained all the implementation details and how it worked. The crowd responded politely after the presentation over.

JASO CALLS DAN

  • Jason at Sauce Labs was working on iOS testing support for a client. Something was troubling him, so he thought Dan's project might be useful to his work, and he called Dan to meet up after the four months of conference, but Dan's source code was not public. So Jason advised him to public it, Dan thinks it over, and after a week, he showed him the source code for iOS Auto. Jason advised Dan to release the source code under an open-source license.
  • August-  Dan released source code on GitHub in C#.  Afterward, to make the project appealing, Jason advised Dan to change its language to a new version uploaded in python.
  • September-  Jason added a web server, made an appium server, and implemented the web driver wire protocol over http, making iOS scriptable from any selenium WebDriver client library in any language.

MOBILE TESTING SUMMIT

  • Mobile Testing Summit was held in November, where john decided to present the project, but the project needs a title. Firstly the name ‘AppleCart’ was chosen, but due to legal issues, 'AppleCart’ was dropped, and Jason configures the name APPIUM.

2013

  • Sauce lab decided to provide full back support to appium and for that it created a task force lead by Jonathan Lipps to evaluate the state of appium and find the best ways to give new birth appium. Finally, Node.js was chosen as the framework for appium.
  • In 2013, Appium was presented the all-around US in conferences and automation testing meetings.
  • In 2013, Appium firstly understood as a truly cross-platform automation framework with Android and Solenoid's support.

Versions and Award of appium

  • In May 2014 -  Appium 1.0 was released.
  •  BOSSIE Award of InfoWorld.
  • Open Rookie of the Year by Black Duck software.
  • In October 2016, Sauce Lab handover Appium to the JS Foundation to keep Appium as open-source.

Appium Versions are:-

  1. Appium 1.0
  2. Appium 1.5
  3. Appium 1.7.2
  4. Appium 1.8
  5. Appium 1.8.1
  6. Appium 1.9
  7. Appium 1.9.1
  8. Appium 1.10.1
  9. Appium 1.11.0
  10. Appium 1.12.1
  11. Appium 1.13.0
  12. Appium 1.14.0
  13. Appium 1.15.1
  14. Appium 1.16.0
  15. Appium 1.70
  16. Appium 1.71
  17. Appium 1.80
  18. Appium 1.81
  19. Appium 1.82

Philosophy of Appium.

  • For automation testing, it doesn’t require modification and recompilation of apps.
  • Platform and language free automation don't depend on the device.
  • The framework should be open source for mobile automation testing.
  • It uses standard automation API'S for Automation in the ANDROID and iOS operating systems.

ARCHITECTURE OF AN APPIUM

Appium is an open-source code framework written in any language of preference like java, Python, Ruby, JavaScript etc.  Therefore, it is straightforward to understand. It inherits selenium features hence it is easy for selenium users. Appium is an automation testing tool used for testing the native, hybrid and web apps on Android and iOS systems.

APPIUM ARCHITECTURE

Appium Tutorial

Appium is an HTTP server that is written in Node.js. Appium server is requested by test running machine with the help of protocol JSON Wire Protocol. Now appium server connect with an Android and iOS emulator device. 

APPIUM KEY CONCEPTS

Appium Tutorial
  • Appium Client-Server Architecture.

Appium follows the client-server architecture in which a session occurs between client libraries and appium server with JSON wire protocol. Appium HTTP web server sends a request to the mobile device with an automation tool built in their operating system. The command execution response is sent back to the Appim HTTP server.

  • Session

Tasks are performed under a time called a session. The client began a session with the server, and the commands are executed by JSON Protocol, which generates a session ID.

  • Appium server

Appium server is developed in a Node.js platform, which is an HTTP server created over Node.js. When you install an appium, you install an appium server. It can be built and directly installed from the source – www.appium.io.

$ npm install  -g appium

$ appium

  • Appium Clients

Appium clients are the client libraries originally, languages(in Java, Ruby, Python, PHP, JavaScript and C#), which support Appium’s extensions to the web driver protocol. You can use these client libraries directly instead of using your WebDriver client and create your framework. For example, if we want to create an automation framework for mobile testing in java, we can download java, add them to our framework and start creating the request.

  • Appium Desktop

 Appium Server has a Graphical User interface required to run the Appium Server. It can be downloaded for any platform(to work on any language).

  • Desired Capabilities.

 These are a set of keys and value combinations that can be sent along with our request with information like Device name, Version, UDID, platform name. We send our request, or our desired capabilities along with our request. These desired capabilities move to the Appium server as JSON Object. Based on them, the Appium server acts on the framework/ platform for automation testing.

  • JSON wire protocol

      The Appium server directly does not understand the Client request. The JSON wire protocol converts this request into an HTTP  restful request. It controls different mobile phone behavior. JSON wire protocols act as a medium to communicate between client and server during Automation.

What is Appium Inspector – its role?

Appium Inspector is an essential tool used for recording manual actions into scripts and playback app’s behavior. Appium inspector helps to solve queries and look for the desired capabilities to carry out the app’s Automation. 

What are the prerequisites required to use Appium?

Prerequisites mean " the required prior conditions."

List of prerequisites that are used in Appium.

Eclipse IDE

Android SDK

TestNG

Web Driver language binding library.

JS

JDK

APK App info on Google play

Selenium server jar

Appium for Windows

HOW APPIUM WORKS?

Appium Tutorial

Appium is an ‘HTTP server. So Node.js must be pre-installed on the system as it is written in the Node.js platform.  Appium server set a connection with the client libraries using Webdriver JSON wire protocol. Appium can be downloaded free of cost from the appium website and installed on the system, and when the appium server setup on the system, it exposes a REST API. It receives the client's connection and command request and executes a command on the device(Android/iOS). It responds back to the HTTP request. The mobile automation framework then executes this request. Appium works on different frameworks.

Apple for iOS

Android API level 16 and higher uses Google UIAutomator.

Android API level 15 or less uses Selendroid.

HOW APPIUM WORKS ON ANDROID AND iOS?

                                     APPIUM ON iOS

Appium Tutorial

Requirement and support for iOS

Additional requirements with the Appium’s General requirements.

  • Xcode 7 or higher.
  • Apple’s XCUITest libraries.
  • The XCUITest driver was available in Appium.
  • A Mac computer with macOS is required.

Appium client (client libraries having different languages) connects with Appium Server with the help of medium JSON wire protocol.

Appium server responds to the client's request, checks the client's desired capabilities, and connects with the provided framework like XCUI Test. Apple, the iOS system has an application called "instrument." The instrument has an automation component. Appium server sends a command to the instruments command server, and then the instrument command client (written in Node.js) picks up the command and execute it in bootstrap.js within the iOS instrument's environment. Bootstrap.js acts on the application on the device that is being tested. After the command's execution, the command client sends back the message to the Appium Server with the executed command's log details. This process repeats all the time until all the commands get executed.

                            APPIUM ON ANDROID

Appium Tutorial

Requirements and support for Android

Additional requirements with  General requirements.

  • Java 7 is installed and configured accurately for your platform.
  • Mac, Windows or Linux OS with the capability to run the Android SDK.

Appium does automation testing on Android using the UIAutomator framework build by Andriod for Automation.

Process:-

Appium client (client libraries having different languages) connects with Appium Server and communicates with JSON wire protocol. Appium server responds to the client's request, checks the client's desired capabilities, and connects with the provided framework like UIAutomator. UIAutomator connects with the bootstrap.jar. Bootstap.jar acts as a TCP server that runs in a simulator/emulator/real device to test the command in performing client operations.

HOW TO INSTALL APPIUM?

As we know, Appium is one of the best automation testing tools. Appium is used for automation testing of the test cases for native, hybrid and web application. Appium works differently on Android and iOS systems. To execute the working of the Appium, we must know about installing the Appium. Before installing Appium, we must keep the configurations, requirements and conditions in mind, which help the appium to work on different devices.

Prerequisites to use Appium are:-

  • Java Development  Kit(JDK)
  • Android SDK
  • Appium
  • Node.js
  • Microsoft webdriver
  • PDA Net
  • Java Client Drivers
  • Appium Client Libraries
  • Homebrews
  • Appium Jars for the eclipse.
  • Eclipse IDE for Java.

For automation testing, we require these tools on different devices like Windows, iOS and Android.

Now we are going to study different ways of installing Appium on different devices.

HOW TO INSTALL APPIUM ON WINDOWS?

In this section, we are going to learn about the following things:

  1. Installation of Appium with Node.Js.
  2. Installation of  Appium with Appium Desktop Client.
  3. Check the Appium Installation and Dependencies(appium-doctor).
  4. Uninstallation of  Appium.
  1.  Installation of  Appium with Node.js?

Step1: Check if Node.js is present or not in the windows operating system. Go to Command prompt and write

               node –version

               node -v

Appium Tutorial
Appium Tutorial

Step 2: Download node.js installer.

Node.js is an open-source, cross-platform for appium. Node.js is the backend of the appium.            

Go to the Browser> Download/Node.js.

https://nodejs.org/en/download/

Appium Tutorial

Now here is the installer; install according to your system requirement (64 bit or 32 bit ).

Appium Tutorial
Appium Tutorial

Here node.js exe file is downloaded.

Step 3: Run the downloaded node.js file and npm. Node.js is the package manager of the node comes with npm Here is the exe. file of the node.js, install and run the file.

Appium Tutorial

Now, after clicking on the .exe file, the installing process gets started.

Appium Tutorial

 Click and accept the terms in the license agreement and click on the NEXT button for installation.

Appium Tutorial
Appium Tutorial
Appium Tutorial

To check the downloaded version, Go to the Command Prompt and write.

       Node -version

       Node –v

       Npm –v

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

Check whether node.js and npm are installed on the system or not and present in the system. Open a command line and write these to check:- 

                                                  node –version

                                                   Npm –version

                                                    Where node

                                                    Where npm

Appium Tutorial

Step 5: Install appium with node.js by using the command given below:

 npm install-g appium

  where, -g is for installing function globally.

Appium Tutorial

Step 6: Check if Appium is installed.

Command Prompt > appium-v (used to check whether appium is installed or not)

 Commamd Prompt > appium –version

Appium - v

Command Prompt > where appium (at what place in window system appium is installed)

Appium Tutorial

Step 7: The command Appium shows that the server has been started as shown in the below screenshot:

Appium Tutorial
  • INSTALLING APPIUM WITH APPIUM DESKTOP CLIENT

Here we are going to learn how we can install an appium with an appium desktop client.

Appium desktop client is the graphical user interface, which is the face of an appium through which a user can communicate.

 Step 1: Download appium desktop client.

              Go to Browser>appium.io

Appium Tutorial
Appium Tutorial
Appium Tutorial

Download Appium-windows-1.18.2.exe.

Appium Tutorial

Run the exe file and install it on the system.

Step 2: Install the downloaded appium desktop client.

Appium Desktop Client is a UI through which you can control the Appium. It is a graphical user interface which means it is the front-end for the utilization of the Appium by the user.

Appium Tutorial

In the above screenshot, you can see two options. Click on the one according to your preference. After selecting the option, the installation process gets started as shown in the below screenshot:

Appium Tutorial
Appium Tutorial
Appium Tutorial
Appium Tutorial

Here Is the appium server containing Host and Port. Click the On Start Server button to start the server.

Step 3: Start appium through appium desktop client.

Appium Tutorial
Appium Tutorial
  •  Check the Appium installation and its dependencies.

Appium Doctor is used to check appium installation and all the dependencies.

Step 1: Install appium –doctor

            Go to Browser> appium- doctor https://github.com/appium/appium-doctor

              copy this command npm install appium-doctor –g. 

Appium Tutorial

Step 2: Check whether the appium doctor is working or not by using the below command in a command prompt:

appium-doctor –h

Appium Tutorial

Appium-doctor –version:  This command is used to find the version of the Appium.

Appium Tutorial
  • Uninstallation of Appium?

Go to the control panel> Program Uninstall> Appium Uninstall.

Appium Tutorial