Mobile Automation Testing (8 Blogs) Become a Certified Professional
AWS Global Infrastructure

Mobile Development

Topics Covered
  • Android Development (34 Blogs)
  • IOS Development (4 Blogs)
SEE MORE

Appium Tutorial: Know How to Set up Appium

Last updated on Jul 13,2020 17.3K Views

Paul
Research Analyst at edureka with a proficiency in Ethereum, Cybersecurity and Cryptography! Research Analyst at edureka with a proficiency in Ethereum, Cybersecurity and Cryptography!
4 / 8 Blog from Mobile Testing (Appium)

Automation is the new jazz. An array of things get automated including emails, google forms, web-scraping and even software testing. In this Appium tutorial, I am going to write up about Appium, a tool that has been a favourite in the mobile app testing automation testing industry for a host of reasons. Below are the topics discussed in this Appium Tutorial :

 Let us start off our Appium tutorial with a quick introduction to the tool itself.

What is Appium?

Appium is an open source, cross-platform automation testing tool. It is used for automating test cases for native, hybrid and web applications. The tool has a major focus on both Android and iOS apps and was only restricted to the mobile application testing domain. Recently, a few updates back, Appium also announced that they will support the testing of desktop applications for windows.

Appium Introduction - Appium Tutorial - Eudureka

Appium is developed and maintained by sauce labs. Currently, Appium version 1.10 is being distributed. Appium first started off as a command line based testing service that can be installed using node.js. In their latest release, named ‘Appium desktop’ they have released a robust and refined tool with an intuitive graphical user interface. Appium desktop comes with an application element inspector which we will get to later in this Appium tutorial.

Philosophy of Appium

Appium is a rising star in the mobile test automation landscape. When it comes to mobile test automation, in many ways the industry is still figuring out what the best approaches. With Appium, they have had the benefit of lessons learned from early automation solutions that didn’t quite work as well as they had hoped. Some of these lessons are nicely summarized in Appium’s four-point philosophy:

  1. You shouldn’t have to recompile your app or modify it in any way in order to automate it.
  2. You shouldn’t be locked into a specific language or framework to write and run your tests.
  3. A mobile automation framework shouldn’t reinvent the wheel when it comes to automation APIs.
  4. A mobile automation framework should be open source, in spirit and practice as well as in name!

Types of Mobile Applications

As discussed in the first paragraph, you must have realised that Appium has the ability to deal with all sorts of applications. Let’s understand the different types of applications.

Native Applications

Applications that are developed, keeping a certain platform in mind are called native applications. Native applications are developed using specific software development kits and tend to be performance focused. Native apps are generally the way to go if the development budget is not an issue. Some advantages of native applications are as follows –

  • Excellent performance
  • They generally tend to look refined and polished
  • Native applications seamlessly integrate with device hardware
  • Most native applications have an intuitive UI/UX

Some examples of native applications include Spotify, Snapchat, Pinterest, Skype.

Web Applications

These kinds of applications used to be really famous until the concept of native applications came along. Web applications as the name suggests, run on a browser. Since they run on a browser, they generally don’t require any sort of complicated installation and the development process is cheap from a budget perspective too. Since the application is not developed for a particular platform, web-based development languages like HTML/CSS/JavaScript are used for their development.

Below is a list of advantages of web applications –

  • Lower development cost
  • Easier to maintain
  • Web-apps don’t need to be approved by application marketplaces
  • No installation or user updates

Examples of successful web applications include Ali Express, Flipkart Lite and Washington Post.

Hybrid Applications

Hybrid applications merge the best of native and web applications. While these applications can be downloaded from the play store and can also access all the features of the device; they are in actuality a web application on the inside. They are developed using simplistic web-development languages like HTML and CSS. This allows them to run on any platform.

Below is a list of advantages of hybrid applications –

  • They only have one codebase to manage
  • App development doesn’t take too long
  • Easy to scale to another platform
  • Access to complete device features just like a native app

Some example of hybrid apps are OLA, Basecamp, Instagram, Yelp etc

Appium vs Selendroid vs Robotium

AppiumSelendroidRobotium
Free and Open SourceFree and Open SourceFree and Open Source
Supports both iOS and AndroidSupports only AndroidSupports only Android
No need for app source code or libraryNeed app source codeNeed app source code/library
Doesn’t reinstall the applicationApplication reinstalledSmall changes in Robotium code leads to a complete rebuild
Supports multiple frameworks and programming languagesCompatible with Selenium and JenkinSupports java only. Not compatible with selenium at all
Strong & Active communityCommunity not as strong as AppiumNot such a proactive community

Now, let us discuss the architecture and design of Appium in this Appium tutorial.

Appium Architecture

Appium is an HTTP server written in node.js which creates and handles multiple WebDriver sessions for different platforms like iOS and Android. Appium starts a “test case” on the device that spawns a server and listens for proxied commands from the main Appium server. The tester writes his test scripts which are executed on the device or emulator by sending them as requests to the Appium server. Each vendor like iOS and Android have a different way and mechanism to run a test case on the device. So Appium kind of hacks into it and run this test case after listening commands from Appium server.

How Appium works in iOS:

On iOS, Appium proxies command to a UIAutomation script running in Mac Instruments environment. Apple provides this application called ‘instruments’ which is used to do lot activities like profiling, controlling and building iOS apps but it also has an automation component where we can write some commands in JavaScript which uses UIAutomation APIs to interact with the App UI. Appium utilizes these same libraries to automate iOS Apps.

In the above figure, we can see the architecture of the Appium in context to iOS automation. If we talk about a command life-cycle, it goes like, Selenium web driver picks a command from the code and sends it in form of JSON via an HTTP request to the Appium server.  Appium server knows the automation context like the iOS and Android and sends this command to the Instruments command server which will wait for the Instruments command client (written in node.js) to pick it up and execute it in bootstrap.js within the iOS instruments environment. Once the command is executed the command client sends back the message to the Appium server which logs everything related to the command in its console. This cycle keeps going till the time all the commands get executed.

How Appium works in Android:

The situation is almost similar in case of Android where Appium proxies command to a UIAutomator test case running on the device. UIAutomator is Android’s native UI automation framework which supports running JUnit test cases directly into the device from the command line. It uses Java as a programming language but Appium will make it run from any of the WebDriver supported languages.

Android Architecture - Appium Tutorial - EdurekaIn the above diagram we can see, here we have bootstrap.jar in place of bootstrap.js which represents our test case when compiled in Java. As soon as it gets launched it spawns a TCP server. Here the TCP server resides inside the device and client is in the Appium process which is just opposite to the way it is in iOS.

Appium Installation with Android Studio

No Appium tutorial is complete without an installation guide. So here’s how you can install Appium using android studio.

  1. Download the following-
  2. Install Java on your system. Don’t forget to set the environment variables!
  3. Install Android Studio on your system by running the installer and then create a new project.Android Studio Install - Appium Tutorial - Edureka
  4. Extract the client library. Keep them separately in a file along with the Appium jar files.
  5. Switch to the project view in Android studio.Project View - Appium Tutorial - Edureka
  6. Now select the files you had extracted in step 4 and put in the lib folder under the app directory. Then select them all and add them as a library. 
  7. Once you have added the files as a library, you should see a build.gradle file in the app folder. Double click that and then go and rebuild your project. Once the project is rebuilt successfully it means you have installed Appium on your system with Android studio.gradle - Appium Tutorial - Edureka

This brings us to the end of this Appium Tutorial. If you want to learn more about the world of mobile application testing you could read up my other blog. If you are interested in reading some other blogs on various trending technologies, you could check out our blog catalogue.

If you wish to learn Software Testing and build a colourful career, then check out our Selenium Certification Course which comes with instructor-led live training and real-life project experience. This training will help you understand software testing and selenium in depth and help you achieve mastery over the subject.

Got a question for us? Please mention it in the comments section of “Appium Tutorial” and we will get back to you as soon as possible.
Comments
0 Comments

Join the discussion

Browse Categories

webinar REGISTER FOR FREE WEBINAR
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP

Subscribe to our Newsletter, and get personalized recommendations.

image not found!
image not found!

Appium Tutorial: Know How to Set up Appium

edureka.co