Mobile Application testing with Appium

Introduction to Mobile Application Testing

 In the fast growing world, the mobile phone is not only a device to make and receive telephone calls but also a multipurpose personal gadget. There are more technological improvement and the propagation on mobile devices with different Operating Systems like Apple iOS, Android, Windows Phone, Blackberry, and Symbian etc. In the fast growing world, there are new challenges for hardware manufactures to stay in the competition.

Mobile application testing is a process by which application software developed for hand held mobile devices is tested for its functionality, usability and consistency.

 Mobile application testing can be automated or manual type of testing.

 Mobile applications either come pre-installed or can be installed from mobile software distribution platforms. Mobile devices have witnessed a phenomenal growth in the past few years.

Key Challenges in Mobile Application Testing

  1. Variety of Mobile Devices
  2. Diversity in Mobile Platforms/OSes
  3. Device Availability:.
  4. Mobile network operators
  5. Scripting
  6. Choosing how to test

Types of Mobile Application Testing

  1. Functional Testing
  2. Performance Testing
  3. Memory Leakage Testing
  4. Interrupt Testing
  5. Usability testing
  6. Installation testing
  7. Certification Testing
  8. Security Testing

Ten Open Source Mobile Test Automation Tools.

Mobile Test Tools – A collection of the best open source mobile test automation tools than you can use to test mobile apps and websites on mobile devices.

  • Appium (Android and iOS)
  • Calabash (Android and iOS)
  • Frank (iOS)
  • Monkey Talk (Android and iOS)
  • iOS UI Automation (iOS)
  • Robotium (Android)
  • iOS-driver (iOS)
  • UI Automator (Android)
  • KeepItFunctional (iOS)
  • Selendroid (Android)

What is Selenium?

Selenium is an open source test automation framework that supports cross browser test automation. Selenium supports perl, php, python, objective-c, java, Microsoft.net, ruby, and more. It is not a tool with a user interface. You have to code your tests. You also need a programming language to use it specifically.

 What is Appium?

  Appium is mobile web, native and hybrid software application test automation tool. 

  • It is open-source software automation tool, which is useful to automate android and IOS platform apps.
  • Most important thing is : Appium is “cross-platform” automation tool so you can write software automation tests against iOS and  Android (multiple platforms) using same API.
  • “cross-platform” enables you large amount of code reuse between iOS and Android test suites.
  • Appium support software test automation on emulator or simulator and physical mobile devices too.
  • Appium is developed on few key philosophy points : 1. Should not have to recompile your app to automate it. 2. Should not be locked into a specific language or framework. 3.  Should be open source and 4. Should not reinvent the wheel when it comes to automation APIs.

 Multiple Platforms Support

  • Android
  • IOS
  • FirefoxOS

 

Multiple Languages Support

Appium supports bellow given languages with the Selenium WebDriver API and language-specific client libraries.

  • Java
  • Objective-C
  • JavaScript with Node.js
  • PHP
  • Python
  • Ruby
  • C#
  • Clojure
  • Perl

Also there are other advantages like no source code is needed to test app as you can test it directly, also you can engage built in apps like camera, calendar etc in your test script if required.


Limitations of Appium

There are few limitations in appium right now.

  • For Android, No Support for Android API level < 17.
  • Script execution is very slow on IOS platform.
  • Gestures support is limited.
  • No support for Toast messages.

 Appium’s 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. It is almost same as Selenium server, which perceives http requests from selenium client libraries, and it handles those requests in different ways depending upon the platforms. 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 in to it and run this test case after listening commands from appium server.

   How Appium works in iOS?

   In iOS, Appium works in these below given steps as shown in the above picture

  1. Appium client (Java or Python) connects with Appium Server and communicate via JSON Wire Protocol (*ignore in C# in picture)
  2. Appium Server then creates a automation session for the client and also checks the desired capabilities of client and connects with respective vendor-provided framework UIAutomation
  3. UIAutomation will then communicate with bootstrap.js which is running in Simulator/Real device for performing client operations
  4. Bootstrap.js will perform action on our AUT (Application Under Test)

 How Appium works in Android?

  In Android, Appium works in these below given steps as shown in the above picture

  1. Appium client (C# or Java) connects with Appium Server and communicate vison Wire Protocol
  2. Appium Server then creates a automation session for the client and also checks the desired capabilities of client and connects with respective vendor-provided frameworks like Splendored/UIAutomator (based on android versions)
  3. Vendor-provided frameworks will then communicate with bootstrap.jar which is running in Emulator/Real device for performing client operations
  4. jar act as a TCP server to perform action on our AUT (Application Under Test)

  Configuration of Appium:

 Please refer attached document for software installations required and steps to install appium.

 Connect Android Device with PC In USB Debugging Mode To Run Appium Test 

You need to connect real android device with PC in USB debugging mode in order to run android app automation tests in real android device using appium

Enable Developer Option In Android Device

Previously if you have not enabled "developer options" in your android device then once you need to enable it in order to switch device in USB debugging mode. Otherwise, you can not access USB debugging mode in your device.

Verify Developer Option Is Enabled?

To check Developer Option is enabled or not,

  • Go to Settings.
  • Check if there is any option like "Developer Option"?

If Developer Option is enabled then it will display there. Otherwise follow the steps given bellow to enable it.

Enable Developer Option

To enable Developer Option in android device,

  • Go to Settings.
  • Scroll down to bottom and tap on About Phone.
  • Scroll down bottom again on About Phone screen. You will see option Build number.
  • Tap seven times on Build numberoption one by one. After 3 tap, It will start showing you message like.. "You are now 2 steps away from being a developer" as shown in bellow image.
  • After 7 times Build numberoption tap, It will show you message "You are now a developer!" as shown in bellow image.
  • Now go back to Settingsand scroll down bottom.
  • You will see option Developer Optionsabove About Phone as shown in bellow image.

Connect Device with PC and Start USB Debugging Mode

Note: Let me warn you before enabling USB debugging mode in your android device. Enable USB debugging only when you need it. Leaving it enabled all the time is kind of a security risk as it allows high-level access to your android device. So disable it immediately when you have not any usage of it.

To start USB Debugging mode,

  • Connect your device with PC using USB cable.
  • Go to Settings -> Developer options.
  • There will be option USB debuggingwith check box. Check it.
  • It will ask you to "Allow USB debugging?". Tap on OK.

 It will enable USB debugging mode for your android device.

Verify Device Connected Properly With PC

To verify device is connected properly with PC with USB debugging mode,

  • Open command prompt in your PC.
  • Run command ADB devices.

It will show you list of connected devices with your PC. If not display, any device in list that means there is some issue with device connection or USB debugging mode is not enabled properly.

How to Locate Element using UIAutomatorViewer

“UIautomatorviewer" is a GUI tool to scan and analyze the UI components of an android application. With "UIautomatorviewer", you can inspect the UI of an android application in order to find out the hierarchy and view different properties (id, text…) of the element.

"Uiautomatorviewer" is a part of the Android SDK manager and will be accessible once you install the sdk manager. Download and install Android SDK manger from

 Once Android SDK installed, navigate to link c:\users\\AppData\Local\Android\sdk\tools you'll notice a batch file with name 'uiautomatorviewer.bat'. Double click on it to launch "Uiautomatorviewer" GUI

 
1 favorite thumb_down thumb_up 0 comments visibility_off  Remove from Watchlist visibility  Add to Watchlist
 

Outline/structure of the Session

 

 

*Introduction to mobile testing in general (iOS and Android tools available today)

* Introduction to Appium and Selenium on mobile

* Demonstration of familiar functionality from web driver, on mobile

* Discussion of the ways in which the mobile testing challenges

* Discussion of Selenium moving forward to accomodate this new use

Learning Outcome

At the end of this session the audience will understand how Appium allows them to use the power of Selenium to drive mobile devices easily and robustly. They will have learned the ways in which mobile testing can move past the manual phase it generally is in, and into a phase of automated testing as one would expect in web testing.

They will also learn about the ways in which the Selenium protocol was used, and eventually extended, in order to account for testing on mobile devices. This is of interest first for a full understand of the tools at hand, and also for those interested in adding functionality for other domains of use.

Target Audience

Test engineers

schedule Submitted 1 year ago

Comments Subscribe to Comments

comment Comment on this Proposal