Testing Mobile Apps with Appium & Selenium
Today’s competitive market conditions have forced companies to focus on quality much higher than any time before. Day by day, standards for quality goes higher and higher and time-to-market pressure increases drastically. Under these harsh conditions, preserving previously market-released product’s quality, becomes a real challenge while introducing new ones.
At this very point, our hyper connected world makes everything one step harder. Mobile platforms launched a new era in this absolutely flattened world. The incredible diversity of mobile devices, differentiated mobile platforms and also completely renewed user behavior that became a real challenge for today’s new economy companies. This paper focuses on the test automation of mobile e-commerce applications in helping companies prepare for multichannel_availability.
Maintaining the quality with manual test execution might lead to undesired oversights in the product, because multiple executions of test cases for each platform cause continuously extended test efforts and dedicated personnel. Consequently, automation seems to be the optimal way to relentlessly execute mission critical test cases through open-source tools.
In our solution, we have realized a mobile test automation project with Appium/Selenium for one of our leading e-commerce services customers (According to our NDA with customer, we are not allowed to share company name with third parties). In the project, Appium has been used to perform automated regression tests for diverse mobile channels. Indisputably, test automation would be a
perfect solution according to their needs. They make releases on weekly basis and for each release, the regression test set should be manually executed consisting of about 200 cases for both iOS and Android platform.
While creating test suite, Java has been chosen as primary development language appropriate to our previous coding habits. IntelliJ has been used as integrated development environment. JUnit and Maven were also supportive development tools.
Appium is an open source test automation framework for both native and hybrid mobile apps. It drives iOS and Android apps using the WebDriver JSON wire protocol, it also supports FirefoxOS platform. All implementations of WebDriver that communicate with the browser, or a Remote WebDriver server, shall use a common wire protocol. This wire protocol defines a RESTful web service using JSON over HTTP.
Appium uses of standard automation APIs on all platforms and it supports nine WebDriver-compatible languages one of which is Java. Appium provides Selenium WebDriver API and language-specific client libraries.
While the Selenium WebDriver spec has support for certain kinds of mobile interaction, its parameters are not always easily mappable to the functionality that the underlying device automation (like UIAutomation in the case of iOS) provides. To that end, Appium augments the WebDriver spec with extra commands and parameters for mobile gestures:
tap (on screen or on element) with options:
- how many fingers
- how long to tap
- how many taps
- where precisely to tap on the screen or element
flick (on screen or on element) with options:
- how many fingers
- where to start the flick on screen or element
- where to end the flick on screen or element
swipe/drag (on screen or on element) with options:
- how many fingers
- how long the swipe/drag takes in seconds
- where to start the swipe on screen or element
- where to end the swipe on screen or element
scroll to (element)
set the orientation with option:
- new orientation (landscape or portrait)
Authors: Berk Dülger (Consultant), Alper Yılmaz (Software Test Engineer)