Sauce Labs Mobile App Testing Ebook
Sauce Labs Mobile App Testing Ebook
E-BOOK
1
TA B L E O F C O N T E N T S
Many organizations are still struggling to implement effective testing approaches that
fit with current software development processes. Most of today’s available testing
methodologies are based on traditional waterfall development methods. While more than
30% of organizations have already implemented the agile development methodology to
some degree, just 9% of organizations are fully agile [26].
Although agile projects show an overall higher percentage of success rates, an essential
success factor for agile projects is to have the right skill set within the application delivery
team. Lacking the right test automation tools means that teams of developers and testers
spend excessive time in testing manually and having to cover multiple devices, operating
systems, and various configurations.
Cloud infrastructure presents an optimal solution for businesses who are looking for
convenient and accessible tools
that fit into their development
processes without setting up their
own infrastructure. Enabling testing
on hundreds of real devices, cloud-
based automated testing services
can provide an almost instant
reduction of downtime, which lowers costs, and helps deliver applications to the market faster.
This paper will discuss different challenges in mobile application testing and will introduce
advantages and disadvantages of manual testing as well as test automation. In addition,
this paper will give an overview of different open source frameworks and suitable test
infrastructures. Finally, this report will suggest ways to optimize mobile application testing
and show how Sauce Labs can overcome challenges and inefficiencies.
3
2 . W H AT I S M O B I L E A P P L I C AT I O N T E S T I N G
A N D W H Y I S I T I M P O R TA N T ?
But even though release cycles become shorter, mobile devices and
platforms are extensively moving towards fragmentation and usability
requirements have become more complex. Mobile users are not forgiving
and no company can afford a bad rating in the app stores. To prevent revenue
loss, lost productivity and damage to brand reputation, organizations need
to ensure that every application runs flawlessly and meets the highest quality
standards. This is where mobile app testing comes in.
Apart from functional testing, which – most importantly – ensures that the
application is working per the requirements, performance testing (behavior &
performance under certain conditions; bad connections or low battery), security
or compliance testing are also very important [3]. Usability is one of the keys to
commercial success and therefore testing is crucial to verify if the application is
achieving its goals and if it is getting a favorable response from users.
For the best possible solution to get applications to market on time and within
budget, a comprehensive testing strategy is required. This mobile testing strategy
should include a device and a network infrastructure, an optimized selection of
target devices, and an effective combination of manual and automated testing
tools to cover both functional and non-functional testing [4].
3 . W H AT A R E T H E M A I N C H A L L E N G E S O F
MOBILE APP TESTING?
4
First of all, the increasing fragmentation of mobile devices marks
a major problem for mobile application developers and testers. The
Android Fragmentation Report 2015 [6] states that there had been
24,093 distinct Android devices until August 2015 (compared to 11,868
devices in 2013). All of those Android devices differ in their shapes and
sizes, with vastly different performance levels, screen sizes and input
methods with different hardware capabilities.
Figure 1: Device Fragmentation: 24,093 distinct Android devices had been seen until August 2015 [6].
5
Another challenge in testing mobile application is represented by the
huge number of Mobile Network Operators. At the moment there are
more than 670 Mobile Network Operators in the world, using different
network standards and different kinds of network infrastructure.
Furthermore, the mobility of users and the fact that they are moving
around while using apps can also be seen as a problem for app
developers and testers, since they require an internet connection to
fetch data and serve the user with updates and information. Daniel
Knott illustrates this challenge by a striking example of an application
that tracks the speed of snowboarders. Even if there is a good network
connection with high speed at the top of the mountain, he writes, this
does not mean that the connection will be good down in the valley.
Whether the app crashes or still works must also be considered in test
scenarios [9].
Last but not least, data security becomes a serious concern. Users
share a great amount of private and personal information with apps,
so they want to make sure that information cannot be accessed by
unauthorized third parties. All this information and data needs to be
secured and kept safe from hacking attempts.
4. M A N U A L T E S T I N G
Manual testing can be described as the part of [mobile] testing that requires
human input, analysis, or evaluation [11]. Consequently, manual testing is
a user-centric approach, mainly focusing on explorative ways of monitoring
whether a mobile application meets user requirements and expectations.
6
Especially when it comes to the testing of the application’s look and feel,
the usability or the reproduction of bugs, manual testing on real devices is
absolutely vital.
In the following chapter, we will introduce the key challenges of manual testing.
7
Moreover, manual testing is often conducted after the actual
development. This means that bugs are likely to be found at a very
late stage of the development process, which leads to high costs of
change (especially compared to an early detection of an error through
continuous integration and regression testing).
Cost of Change
Analysis Testing in
Requirements Coding Production
& Design the Large
TIME
Testers taking mobile devices and removing them from the company’s
environment always carries a potential security risk. In doing so,
viruses can be caught on infected pages or a new version of an OS can
be downloaded accidentally. In addition, the risk that mobile devices
are getting lost or stolen is much higher.
8
• Potential delays, which are caused by the shipping of devices
5 . A U T O M AT E D T E S T I N G
User Interface testing and continuous integration are two integral parts of test
automation, which shall be introduced in the following. The second part of the
chapter focuses on the advantages and disadvantages of automated testing.
As a black box and functional practice, GUI testing does not require testers
to know the internal implementation details of the tested app. It only ensures
that the user interface meets its written specifications and expected output
when a user performs a specific action or enters a specific input.
9
CONTINUOUS INTEGRATION /CONTINUOUS DELIVERY
A prominent practice that brings out the best in automated testing is
continuous integration (CI) and continuous delivery (CD), a workflow that
enables constant testing of each new build or change made in the source
code [15]. CI/CD offer development and testing teams an agile development
process with the ease of automated testing that is executed continuously
each time a new update is presented to the software.
With the right CI/CD toolsets, testers and developers are able to automate
and speed up the workflow by eliminating problems, which are often
caused by long integration cycles. CI provides developers with a stress-free
development environment as their software is being continuously tested
every time new code is deployed. Testers can notify developers of any failed
tests immediately, enabling quick updates, fixes, and iterations, resulting in
continuous delivery.
Benefits:
• Developers concentrate on coding
10
BENEFITS AND DRAWBACKS OF AUTOMATED TESTING
Benefits:
In summary, test automation helps to save time and to reduce costs. The testing
process and software quality can be increased through the reliability, repeatability
and extent of the test suite. Finally, automation helps to increase the test coverage
and to re-use these tests for different software versions and interfaces.
11
Drawbacks:
• The initial effort of automated mobile testing seems often rather high
due to initial direct costs. But already after a few test executions the
return on investment (ROI) increases rapidly and test automation pays off.
This correlation is clearly illustrated in Stefan Münch’s paper The Return
on Investment (ROI) of Test Automation, where the following figure is
taken from [16].
• Not every test can be automated and not every project is suitable for
automated testing, for example location data, and other environmental
sensor data is really hard to test in a lab situation [9].
0 1 2 3 4 5 6 7
Figure 3: The typical ROI from the use of test automation tools [16].
12
G
IN
T
ES
T
L
A
U
N
A
M
Cumulated Costs ($)
A U T O M AT E D T E S T I N G
Time
6 . M O B I L E A U T O M AT I O N T E S T I N G
FRAMEWORKS
In the following section we will introduce and compare four different mobile
testing frameworks. Learn more at saucelabs.com
13
6.1 APPIUM
Developed by Dan Cuellar, Appium is an open source test automation tool for
native and hybrid mobile apps. Using JSON wire protocol and the Selenium
WebDriver, it is compatible with both Android and iOS native apps, as well as
hybrid and web apps.
The fact that Appium is open source – with improvements and changes freely
shared within the community – as well as the fact that it seamlessly runs on
a variety of devices and simulators/emulators, makes it one of the best
choices for mobile test automation [19].
Benefits:
• All complexities are under the hood of the Appium server – there are no
restrictions towards programming language or the platform that
is automated
6.2 CALABASH
Calabash is a cross-platform mobile test automation framework for native
and hybrid Android and iOS apps, maintained by Xamarin. The framework
enables automated UI Acceptance Tests written in Cucumber.
14
With the help of Cucumber, it is possible to express the behavior of the
tested app using a natural language [9]. This approach is called Behavior
Driven Development (BDD) and can be very helpful when business experts
or non-technical colleagues are involved in the acceptance criteria process.
Cucumber uses Gherkin as the Domain Specific language (DSL) to annotate
the behavior of the application [9].
Benefits:
• Through the Behavior Driven Development (BDD) philosophy with
Calabash, application behaviors are specified, instead of creating tests that
describe the shape of APIs
• Cross-platform approach
6.2 XCUITEST
This tool comes directly from Apple, created for developers. You can use
this tool to test iOS native and hybrid apps from Xcode 7 IDE. XCUITest is
a recorder that enables creating automated tests easily inside Xcode 7. With
the latest update, you can take advantage of Appium Webdriver architecture
to run XCUITest tests.
Benefits:
• Supported by Apple
15
• Hybrid and native apps
6.3 ROBOTIUM
Another open source mobile testing framework is Robotium, which has
full support for native and hybrid Android applications. Developed in 2010
by Renas Reda, this framework makes it easy to write powerful and robust
automatic black box UI tests for applications. With the support of Robotium,
test case developers can write function, system and user acceptance test
scenarios, spanning multiple Android activities [21].
Benefits:
• Requires minimal knowledge of the application under test and minimal
time to write solid test cases
• Test cases are more robust due to the run-time binding to UI components
6.4 ESPRESSO
Open sourced by Google, Espresso is the latest Android test automation
framework that enables developers and testers to run tests on x86 machines
in the cloud and to apply their UI tests [22].
Espresso’s core API is small, predictable, and easy to learn and yet remains
open for customization. Without the distraction of boilerplate content,
custom infrastructure, or messy implementation details, Espresso tests state
16
expectations, interactions, and assertions clearly [23]. Being supported up to
API level 25, Espresso allows its users to quickly write concise and reliable
Android UI tests [23].
Benefits:
• Small, well-defined and predictable API, which is open to customization
7. T E S T I N G I N F R A S T R U C T U R E
17
Furthermore, neither parallelization of test automation nor continuous
integration can be applied. Consequently, automation cannot be integrated
in the agile development process.
CLOUD SOLUTIONS
A mobile test cloud gives testers the opportunity of accessing hundreds of
simulators, emulators and real devices to run their automated and manual
tests on. Test can also run in parallel with test automation to save testing time,
while results can be recorded and illustrated through screenshots and videos.
In addition, cloud services support tests through the most popular automation
platforms like Appium, Robotium and Espresso. The upfront investment can
vary depending on your needs, but it will save you a lot of money in the long
run, because licensing and renewal costs are minimized, which reduces total
cost of ownership. These are the main reasons that make the concept of
a mobile testing cloud an attractive proposition for developers and testers [25].
Sauce Labs offers public and private cloud solutions to test on real devices, as
well as a cloud to test on emulators and simulators. Any native, hybrid or web
app can be uploaded and tested easily directly from your browser.
Public Cloud
Public cloud is a secure solution that enables manual and automated testing
on over 200 iOS and Android devices. High concurrency is also one of the
benefits of the private cloud, even though not all the devices that you want
to test on might be available when you need them. Devices are thoroughly
cleaned after each use, so no user’s data will be left on the testing devices.
Private Cloud
Private cloud is designed for customers that need the highest security, as well
as for those customers who test frequently and at higher concurrencies as part
of a CI/CD delivery pipeline. Having devices at exclusive use 24/7 enables faster
18
development and deployment. Being the sole users of dedicated devices will add
an extra layer of security on top of a secure IP SEC VPN connection.
This solution will give you the option to use CI/CD at full capacity, deploying
hourly or daily. A private cloud can be an addition to public cloud if the
needed devices are not available in the public cloud.
NONPROFESSIONAL PROFESSIONAL
INFRASTRUCTURE INFRASTRUCTURE
CONCLUSION
Used in the right manner, testing can be a powerful tool in fighting against the
fragmented mobile device landscape. The crucial component of an effective
testing strategy is to define custom tailored test cases for the application at
hand and define a workflow or process that streamlines testing.
As stated above, testing mobile apps is a major challenge, but it can be solved
efficiently with a structured approach, the right set of tools, and expertise.
19
REFERENCES
1.) Statista, (2015). Number of apps available in leading app stores 2015 | Statistic. [online] Available
at: http://www.statista.com/statistics/276623/number-of-apps-available-in-leading-app-stores/
[Accessed 5 Jul. 2015].
3.) Veracode.com, (2015). Mobile Application Security | Veracode. [online] Available at:
http://www.veracode.com/products/mobile-application-security [Accessed 5 Jul. 2015].
5.) Mona Erfani Joorabchi. Ali Mesbah. Philippe Kruchten, (2013). Real Challenges in Mobile App
Development. University of British Columbia. Vancouver, BC, Canada.
6.) Opensignal.com, (2015). Android Fragmentation Report August 2015. [online] Available at:
https://opensignal.com/reports/2015/08/android-fragmentation/ [Accessed Feb. 3rd 2017].
7.) Rouse, M. (2012). What is mobile device fragmentation? - Definition from WhatIs.com. [online]
Available at: http://searchconsumerization.techtarget.com/definition/mobile-device-fragmentation
[Accessed 30 Jun. 2015].
8.) Rouse, M. (II) (2015). What is regression testing? - Definition from WhatIs.com. [online]
SearchSoftwareQuality. Available at: http://searchsoftwarequality.techtarget.com/definition/
regression-testing [Accessed 19 Jul. 2015].
10.) Testlio, (2014). 6 key challenges of mobile app testing - Testlio. [online] Available at:
https://testlio.com/blog/post/6-key-challenges-of-mobile-app-testing [Accessed 30 Jun. 2015].
11.) Softwaretestingclass.com, (2015). What is Manual Testing | Goal of Manual Testing | Manual Testing
types | Software Testing Class. [online]
Available at: http://www.softwaretestingclass.com/what-is-manual-testing/ [Accessed 19 Jul. 2015].
12.) Mobilelabsinc.com, (2015). Manual Mobile App Testing - Mobile Labs. [online]
Available at: http://mobilelabsinc.com/solutions/mobile-app-testing/manual-mobile-app-testing/
[Accessed 30 Jun. 2015].
13.) Agilemodeling.com, (2015). Examining the Agile Cost of Change Curve. [online] Available at:
http://www.agilemodeling.com/essays/costOfChange.htm [Accessed 19 Jul. 2015].
14.) Red-badger.com, (2015). Benefits of Automated Testing - Red Badger - Red Badger. [online]
Available at: http://red-badger.com/blog/2013/02/01/benefits-of-automated-testing/
[Accessed 4 Jul. 2015].
15.) Rouse, M. (2015). What is continuous integration (CI)? - Definition from WhatIs.com. [online]
SearchSoftwareQuality.
Available at: http://searchsoftwarequality.techtarget.com/definition/continuous-integration
[Accessed 5 Jul. 2015].
20
16.) Stefan Münch et al. (2012). The Return on Investment (ROI) of Test Automation. In: Pharmaceutical
Engineering, July/August 2012, Volume 32, Number 4.
17.) Methodsandtools.com, (2009). Metrics for Implementing Automated Software Testing. [online]
Available at: http://www.methodsandtools.com/archive/archive.php?id=94 [Accessed 4 Jul. 2015].
18.) Saucelabs.com, (2015). Mobile Testing Tools - 11 Open Source Frameworks Compared. [online]
Available at: https://saucelabs.com/resources/mobile-testing-tools [Accessed 4 Jul. 2015].
19.) 3Pillar Global, (2013). Appium: A Cross-browser Mobile Automation Tool. [online]
Available at: http://www.3pillarglobal.com/insights/appium-a-cross-browser-mobile-automation-
tool [Accessed 4 Jul. 2015].
21.) Code.google.com, (2015). robotium - The world’s leading Android™ test automation framework -
Google Project Hosting. [online]
Available at: https://code.google.com/p/robotium/ [Accessed 5 Jul. 2015].
22.) Avram, A. (2015). Google Espresso: Fast Automated Android UI Testing in the Cloud. [online] InfoQ.
Available at: http://www.infoq.com/news/2013/10/google-espresso-testing [Accessed 5 Jul. 2015].
23.) Code.google.com, (2013). Espresso - android-test-kit - a fun little Android UI test API - Google’s
Testing Tools For Android - Google Project Hosting. [online]
Available at: https://code.google.com/p/android-test-kit/wiki/Espresso [Accessed 5 Jul. 2015].
21
ABOUT SAUCE LABS
Sauce Labs provides the world’s largest cloud-based platform for the
automated testing of web and mobile applications. Its award-winning
service eliminates the time and expense of maintaining an in-house testing
infrastructure, freeing development teams of any size to innovate and
release better software, faster.
SAUCE LABS INC. 539 BRYANT STREET #303 SAN FRANCISCO, CA 94107 USA