Introduction to Appium and it’s Drivers

Reading Time: 5 minutes
appium logo

In this blog we will see what is Appium and what are all the requirements for installing and running Appium on your system.

  • Appium is an open source tool used for testing android, web, iOS and windows application as well. Appium is supporting native and hybrid applications as well where application is developed for on native platform such as for android or iOS. It also supports mobile web application testing where the mobile version of the websites are can be testing on mobile web browsers such as chrome and Firefox.

Advantages of Appium

  • The main benefit of using Appium is that it is cross platform and one test suite can be used for testing application on multiple platforms. Appium supports multiple languages and you can write the test suite in any one of them and these test suites can be ran and executed on multiple platforms such as android or iOS. As Appium is an open source so no licence is required for using it and hence it is a very popular testing tool. It’s capability to work on multiple platforms is one of its most powerful asset.

Disadvantages of Appium

  • The only drawback is that for testing iOS devices a Mac OS system and device should be available. We can also use device farm for performing devices on multiple devices on the same time but it is free for a limited amount of time and after that it is chargeable.
lost of web browsers supported

Session in Appium

  • A session is a medium to communicate and send the commands to the testing application. We perform commands with respect to the sessions file. You can define the commands in the sessions file.For starting a new session we require a desired capabilities file in which we will have to define some mandatory information.The fields are :
  • platformName : Which defines on which platform we are performing testing.
  • platformVersion : We can define the operating system version in this field.
  • deviceName : Name of the device which you are using to run your tests on.
  • automationName : Defines the driver which we are using for automation. i.e – XCUITest,UI Automator2 etc.
  • app : Defines the path to the installation file i.e. APK or .IPA file from where the driver can get and install the application to the device.

Appium supported drivers

Apple’s XCUITest

  • We use XCUITest for testing iOS applications for version 9.3 and above. We use it to create and run unit test cases, performance tests, and UI tests for your Xcode. For writingthe code or script we require Xcode. We can also use XCUITest driver for automating applications on iPad and tvOS as well.

Requirements for XCUITest

  • XCUITest library is only available for iOS devices only.
  • We need a Mac system with macOS 10.11 or 10.12.
  • We require Xcode version 7 or higher.
  • Support for XCUITest driver started with Appium 1.6.
Apple iPhone
  • For starting a new session you need to define the capabilities and include XCUITest in automation name.
{
    "platformName": "iOS", 
    "platformVersion": "12.1",
    "deviceName": "iPhone X",
    "automationName": "XCUITest",
    "app": "/path/to/my.app"
}
  • These are bare minimum for starting a session. Apart from that XCUITest supports many Appium commands and also performs a little differently as compared to the android counterpart. If you are running your application on a simulator than path should be set to the .IPA file which you want to test and you can start automating it. But if you want to run your application on a real device than you will need to make add xcodeOrgId and xcodeSigningId in your desired capabilities file.
  • It’s a bit tricky to test iOS application on real device as for doing this we require an apple developers account which is a paid service. We need to define xcodeOrgId and xcodeSigningId in the desired capabilities document.
    {
      "xcodeOrgId": "<Team ID>",
      "xcodeSigningId": "iPhone Developer"
    }

Apple’s UI Automation

  • We use UI Automation for testing iOS applications for version 9.3 and lower. If the iOS device is lower than 9.3 then UI automation can be used with Appium. JavaScript library to write test scripts which uses app’s interface to execute the tests. While the app in running in the iOS device.We need to you java script for writing the test cases. We can display and see the logs automatically on the system. We require a Mac OS installed system and an iOS device for writing code in Appium.

UI Automator/UI Automator2

  • UI Automator is a UI testing framework suitable for cross-app functional UI testing across system and installed apps. It provides a framework for testing APIs to testing UI of the applications. We can execute and automate all aspects of an android app using Appium. The code written is not depend upon the internal implementation of the application but totally depends upon the UI of the applications.UI Automator is the older version of the driver and Appium will not be supporting it in near future.So, we will be focusing on UI Automator2 as their is no major difference between the two.

Requirements for UI Automator2

  • User should install and configure java 7 on the system.
  • Mac, Windows, or Linux OS with Android SDK and platform tools installed in it.
Google pixel 4
  • For starting a new session you need to define the capabilities and include UI Automator2 in automation name.
{
    "platformName": "Android", 
    "platformVersion": "9",
    "deviceName": "Note 9",
    "automationName": "UI Automator2",
    "app": "/path/to/my.app",
    "appPackage": "io.appium.android.apis",
    "appActivity": ".view.TextFields"
}
  • Appium recommends defining the optional fields appPackage and appActivity. Appium can identify which package and activity are to be ran and executed once it is launched else it will have to look on the app manifest file.

So this was a small introduction Appium and its drivers. In the next blog we will be continuing with how to setup an android emulator and how to install Appium GUI in Ubuntu. Please find the part-2 of this blog here: https://blog.knoldus.com/introduction-to-appium-and-its-drivers-2/

Knoldus marketing image

Written by 

Ankur is a Sr. QA Consultant having experience of more than 3 years. He is familiar with the core concepts of manual and automation, postman and Newman are his expertise. He is always eager to learn new and advanced concepts in order to expand his horizon and apply them in project development with his existing knowledge. His hobbies include watching web series and getting to know about all the latest gadgets that come in the market.

Discover more from Knoldus Blogs

Subscribe now to keep reading and get access to the full archive.

Continue reading