Testing the UI of Mobile Applications

Marco Torchiano
Marco TorchianoAssociate Professor
Testing the UI of Mobile Apps
Marco Torchiano
marco.torchiano_@_polito.it
https://softeng.polito.it/torchiano
@mtorchiano
3rd International Genoa Software Engineering PhD School on
Automated Functional and Security Testing of
Web and Mobile Applications
May 13-16, Genova, Italy
v.1.2.0
© Marco Torchiano, 2019
Outline
• Testing mobile apps is hard!
• E2E testing of mobile apps
• How much testing is performed?
• Mobile test fragility
• Causes of fragility
• Visual vs. Layout
• Combined approach
Testing mobile Apps
Mobile market
is hard!
Developers perspective
• Series of interviews with actual developers from 7 companies
• Are mobile applications tested? How? To what extent?
• What are the most peculiar properties to test in mobile applications?
• What aspects of mobile applications discourage developers from testing
them?
• What are the main challenges of mobile application testing?
Developers perspective - Companies
A. Distributor of testing tools for various typologies of applicatives.
B. Test factory for third party applications and test consulting.
C. Insurance company: web and mobile apps for insurers and
customers.
D. Insurance company: platform for insurance management.
E. Test factory for third party applications and test consulting.
F. Full-stack development of mobile applications for multiple
platforms.
G. Test factory for consulting of test and test management for banking
applications.
How mobile testing is performed
Manual testing ● ● ● ● ● ● ○
Random-monkey testing ● ○ ○ ○ ○ ○ ○
Capture & Replay ● ● ● ● ● ○ ○
Scripted testing ● ● ● ● ● ○ ○
Model-based testing ● ○ ○ ○ ○ ○ ○
Tool adoption
Tool Category n
MicroFocus UFT / QTP Regression and functional testing 4
Selenium Scripted web-based app testing 4
Appium Multi-platform mobile app automated testing 3
PerfectoMobile Scripted cloud-based app testing 3
JMeter Load and performance testing 3
Silk Mobile Capture and Replay testing 2
JUnit Java unit testing 2
AppliTools AI-based Visual Testing 1
Monkey Random testing 1
Qualitia Scripted testing and GUI modeling 1
TestComplete Capture and Replay testing 1
Peculiarities of Mobile Testing
• Procedures and instruments vary significantly for:
• Native
• Web-based
• Hybrid
• Huge device and os diversity
Device diversity and form factor are the fundamental variables to take
into account, much more than for web application testing, for which it
is sufficient to test the main browsers
Limitations to Mobile Test Adoption
• Clients want published asap in any case
• Quality and features are reduced
• User feedback partly replaces testing
• Business-oriented departments are in charge of testing
• Focus is often on back-end as (valuable) service provider
Only companies creating apps that manage sensitive and
economically critical data tend to adopt automated testing
• Company B
Challenges
• Test fragility leading to high maintenance cost
• Company A had to re-record all tests with new version
• Company B and C estimate ~30% of test effort is due to test script
maintenance due to lack of flexibility
[..] problem that is perceived and that has to be fought on
a daily basis: test suites must be maintained daily
• Company D
End-to-End (E2E) Testing
E2E testing is used to test whether the flow
of an application right from start to finish
is behaving as expected
Testing
Pyramid
E2E
Integration
Unit
€€€
€cent
Adapted from M. Fowler
E2E Critical factors
• Cost: E2E tests are expensive (hard) to write
• E.g. through Capture & Replay
• Time: E2E tests are slow
• UI interactions take time
• Integration: E2E tests are difficult to integrate in CI
• Hard to run in headless mode
• Fragility: E2E tests are fragile
• Even minor UI changes can break tests
E2E Critical factors worsen in mobile
• Cost: E2E tests are expensive (hard) to write
• E.g. through Capture & Replay
• Time: E2E tests are slow
• UI interactions take time
• Integration: E2E tests are difficult to integrate in CI
• Hard to run in headless mode
• Fragility: E2E tests are fragile
• Even minor UI changes can break tests
Rich user
interactions
Wide variety of devices
+ Quick release cycles
Device test factories
or emulators
Different devices may behave
slightly differently
Critical Factors – Mobile specific
• Wide variety of devices
• Versions of OS
• Screen aspect ratio
• Display Hw vs. Sw buttons
• Rich user interactions
• Gestures, e.g., swipe, pinch, etc.
• Sw and HW buttons
• Quick release cycle:
• apps typically follow a weekly/bi-weekly release plan
Diversity
OS Versions
0% 5% 10% 15% 20% 25% 30%
Gingerbread
Ice Cream Sandwich
Jelly Bean
KitKat
Lollipop
Marshmallow
Nougat
Oreo
Pie
Data refer to May 2019
Relative screen sizes of Android devices
20 Background
(source: https: //www.xda-developers.com)
Screen Size and Density
ldpi mdpi tvdpi hdpi xhdpi xxhdpi Total
Small 0.4% 0.1% 0.1% 0.6%
Normal 0.9% 0.3% 24.0% 37.7% 23.6% 86.5%
Large 2.4% 1.9% 0.6% 1.6% 1.7% 8.2%
Xlarge 3.1% 1.3% 0.6% 5.0%
Total 0.4% 6.4% 2.2% 25.9% 40.0% 25.4%
How to handle diversity
• Device portfolio representative of your target users
• Include both OS version and Device
• Prioritized portfolio, e.g.,
• Gold:
• Main supported devices + OS
• All test suite executed
• Silver:
• Additional devices + OS
• Only a subset of test case executed
A real-world case
• Company performing test for third parties
• Case study test process:
• Conducted in 2017
• Outsourcing
• On mobile banking app
• 14 test areas
Test suite
0 20 40 60 80 100 120 140 160 180
MIGRAZIONE TOKEN
ASSICURAZIONE
ASSISTENZA
RATING
MESSAGGI
TOUCH ID
FINANAZIAMENTI
IMPOSTAZIONI
POSTLOGIN
NAVIGAZIONE
PROFILO
CONTO
INVESTIMENTI
PRELOGIN
STRONG AUTHENTICATION
RISPARMIO
FLUSSI DISPOSITIVI
CARTE
1349 Test cases
Testing the UI of Mobile Applications
Device Portfolio
Gold
IOS 9.3.2 APPLE 6s/6 Plus
ANDROID 6.0.1 SAMSUNG S6 /S7
Silver
IOS 9.3.2 APPLE 5s
IOS 9.3.2 APPLE 4s
ANDROID 6.0.1 SAMSUNG S5
ANDROID 5.0.1 SAMSUNG S4
ANDROID 4.4.4 SAMSUNG S3
IOS 9.3.2 APPLE 6
ANDROID 6.0.1 HUAWEI P9
IOS 9.3.2 APPLE 5c
ANDROID 4.4.4 SAMSUNG Note 3
ANDROID 6.0.1 LG NEXUS 5
ANDROID 4.1.2 SAMSUNG A3
ANDROID 5.0.0 ASUS Zenfone 2
ANDROID 4.2.2 SAMSUNG S2
ANDROID 5.1.1 LG G4
ANDROID 4.4.4 Xiaomi Mi Note
ANDROID 4.4.2 ACER E3
ANDROID 4.4.2 HTC SENSE 5
ANDROID 4.4.4 HUAWEI Ascend G700
Test executions
• Run just 15% of tests w.r.t. full coverage of all portfolio
• 3904 test runs vs. 26980
Test cases Devices Test runs
Test suite 1349 2 2698
Subset 67 18 1206
3904
End-2-End Testing Techniques
• Manual
• Scripted
End-2-End Testing Techniques
• Manual
• Coordinate-based
• Layout-based
• Visual / Image Recognition
Scripted
End-2-End Testing Techniques
• Manual
• Coordinate-based : 1st generation
• Layout-based : 2nd generation
• Visual / Image Recognition : 3rd generation
Layout-based testing
Test scripts leverage the UI structure to
• Identify and detect UI components
• Interact with them
Layout-based testing
Elements are identified through layout properties
(e.g., IDs, text, content description, widget type)
Layout-based mobile testing tools
Espresso
Espresso
Espresso – Test Script
@Test
public void testCreateNote() {
onView(withId(R.id.fab_expand_menu_button)).
perform(click());
onView(withId(R.id.fab_note)).perform(click());
onView(withId(R.id.detail_title)).
perform(typeTextIntoFocusedView("Ciao"));
onView(withContentDescription("drawer open")).
perform(click());
onView(withText("Ciao")).
check(matches(isDisplayed()));
}
Espresso + Recorder
Espresso + Recorder
Espresso + Recorder
Espresso + Recorder
Espresso + Recorder – Test Script
@Test
public void recordedTest() {
ViewInteraction viewInteraction = onView(
allOf(withId(R.id.fab_expand_menu_button),
childAtPosition(allOf(withId(R.id.fab),
childAtPosition(
withClassName(is("android.widget.FrameLayout")),
2)), 3), isDisplayed()));
viewInteraction.perform(click());
This is just for the first click!
Espresso + Recorder – Test Script
// Added a sleep statement to match the app's execution delay.
// The recommended way to handle such scenarios is to use Espresso
idling resources:
// https://google.github.io/android-testing-support-
library/docs/espresso/idling-resource/index.html
try {
Thread.sleep(150);
} catch (InterruptedException e) {
e.printStackTrace();
}
A number of sleeps added
even if not required
Espresso + Recorder – Test Script
ViewInteraction viewInteraction = onView(
allOf(withId(R.id.fab_expand_menu_button),
childAtPosition(allOf(withId(R.id.fab),
childAtPosition(
withClassName(is("android.widget.FrameLayout")),
2)), 3), isDisplayed()));
viewInteraction.perform(click());
onView(withId(R.id.fab_expand_menu_button)).
perform(click());
Visual testing
• Image recognition techniques are used to identify elements of the
user interface to interact with.
• Ease of definition of test cases with no tech knowledge required
• only screen captures are needed
• Can be applied seamlessly to any kind of software provided with an
(emulated) user interface
• Very high fragility to even minor changes in the GUI
• Difficult in-depth testing of application functionalities.
Visual testingImage recognition of screen captures on an emulated
Android Virtual Device
Visual GUI Testing of Android Apps
Visual testing tools
Eye Automate
Eye Automate
Script EyeAutomate
Click "{ImageFolder}/1557782216425.png"
Click "{ImageFolder}/1557782221958.png"
Click "{ImageFolder}/1557782228188.png"
Type "Ciao"
Click "{ImageFolder}/1557782244581.png"
Check "{ImageFolder}/1557782252007.png"
Sikuli
Script
click("1548927253493_cropped.png")
sleep(1)
click("1548927255427_cropped.png")
sleep(1)
click("1548927257822_cropped.png")
type("Test1")
sleep(1)
click("1548927259893_cropped.png")
sleep(1)
find("1548927262321_cropped.png")
sleep(1)
find("1548927264020_cropped.png")
sleep(1)
How much is E2E testing used?
And which tools are used, how much?
Project Selection:
Testing the UI of Mobile Applications
Testing the UI of Mobile Applications
Tool Diffusion
0% 1% 2% 3% 4% 5%
Selendroid
Appium
UI Automator
Robotium
Espresso
Robolectric
Tool Diffusion
0.01%
0.08%
0.33%
0.84%
2.43%
4.12%
20.00%
0% 5% 10% 15% 20%
Selendroid
Appium
UI Automator
Robotium
Espresso
Robolectric
Junit
Tools diffusion
Results from Cruz et al., 2019
How much test code?
2.8%
7.4%
6.2%
7.6%
13.5%
0% 2% 4% 6% 8% 10% 12% 14%
Appium
UI Automator
Robotium
Espresso
Robolectric
TLR = Test LOC / Project LOC
Test Fragility
And its causes
Fragility
A test case is fragile if it requires interventions
when the application evolves due to
any modification applied to the Application Under Test.
Fragility related drawbacks
• When a fragility manifests, a test fails
• Then extra effort is required to:
• Verify that no regression has occurred
• Modify the failing test to adapt it to the changed UI
• Re-run the test
Visual fragility
Graphic changes: invalidation of Visual test scripts.Graphic changes: invalidation of Visual test scripts.
App: K9 Mail
Layout-based fragility
Properties change: invalidation of Layout-based test scripts.
How much fragility?
• Test Suite Volatility (TSV)
• Proportion of releases that required any test code modification
• Modified Test Classes Ratio (MCR)
• Average proportion of test classes modified on each release
• Modified Classes With Modified Methods ratio
• Discards new methods and other cosmetic changes
How much fragility?
Espresso
UI Automator
Robotium
Robolectric
0% 5% 10% 15% 20% 25% 30%
Test Suite Volatility
How much fragility?
Espresso
UI Automator
Robotium
Robolectric
0% 2% 4% 6% 8% 10% 12% 14% 16% 18% 20%
Modified Class Ratio
How much fragility?
Espresso
UI Automator
Robotium
Robolectric
0% 10% 20% 30% 40% 50% 60% 70%
Modified Classes With Modified Methods
Why tests change?
Taxonomy of change causes (top-level)
Taxonomy of change causes
Taxonomy of change causes
Modifications of test code without connection to production code.
(e.g., changes in checked assertions, refactoring of test code, addition or
removal of log instructions or screen captures, syntax corrections)
- assertThat(activity, notNullValue());
- assertThat(activity.toolbar, notNullValue());
- assertThat(activity.presenter, notNullValue());
+ assertThat(activity.drawerToggle, notNullValue());
Taxonomy of change causes
Modifications in test code due to changes in production code that are unrelated to
the graphic appearance of the app (e.g., changes in Activity methods and startup,
changes in the application data structures, application code refactoring)
+ Intent intent = new Intent();
+ intent.putExtra(Judo.JUDO_OPTIONS, getJudo().build());
- activityTestRule.launchActivity(getIntent());
+ activityTestRule.launchActivity(intent);
Taxonomy of change causes
Changes in the time needed by the app to perform operations (e.g.,
changes in View transition duration, or long-running activity tasks)
- Thread.sleep(500);
+ Thread.sleep(1000);
Taxonomy of change causes
Adaptations of test classes to guarantee compatibility with different
versions of the Android OS (e.g., changed classes for the same Widget
or OS version check)
- rotateToPortrait( this );
+ if (VERSION.SDK_INT >=
+ VERSION_CODES.JELLY_BEAN_MR2) {
+ ritateToPortrait( this );
Taxonomy of change causes
Modifications in the operations that can be performed over existing widgets of the
user interfac (e.g., changed in the navigation, in keyboard opening methods, in
checked properties of widgets)
- onView(withId(R.id.fitnessProgramButton)).
perform(ViewActions(scrollTo());
+ onView(withId(R.id.fitnessProgramButton)).
perform(ViewActions.scrollTo()), click());
Taxonomy of change causes
Modifications in the number and type of elements in the visual hierarchy of the
tested activities (e.g., addition, removal or substitution of widgets)
expectVisible(viewThat(
- hasAncestorThat(withId(
- R.id.attribute_symptoms_onset_days)),
+ hasAncestorThat(withId(R.id.attribute_weight)),
hasText(" ");
Taxonomy of change causes
Changes in the way the widgets are identified in test code (e.g., changes in unique
IDs or text content of views)
- onView(withId(R.id.morse_input_text_card))
+ onView(withId(R.id.morse_input_text_container))
.perform(click());
Taxonomy of change causes
Changed ways to access resources that are used as oracles by the test code (e.g.,
changes in retrieving of text or graphical resources)
- onView(withText("Coupon")).perform(click())
+ onView(withText(R.string.category_coupon))
.perform(click());
Taxonomy of change causes
Modification in the actual appearance of widgets (e.g., changes in
animations, transparencies, themes, absolute coordinates, sizes)
Taxonomy of change causes (full)
Fragility changes
Espresso
UI Automator
Robotium
Robolectric
0% 10% 20% 30% 40% 50% 60% 70% 80% 90%
Changed test files with modification linked to AUT…Changed test files with modifications linked to AUT changes
Non-Fragility changes
Espresso
UI Automator
Robotium
Robolectric
0% 10% 20% 30% 40% 50% 60% 70% 80% 90%
Changed test files with modifications not linked to AUT…Changed test files with modifications NOT linked to AUT changes
GUI related changes
Espresso
UI Automator
Robotium
Robolectric
0% 10% 20% 30% 40% 50% 60% 70% 80% 90%
AUT related changes linked to GUI changes
Visual vs. Layout-Based
Cost of test development
Experiment Goal
• Analyze the E2E testing process
• to understand what technique
• Layout-based
• Visual
• yields
• higher productivity
• high quality of tests
Experiment Goal
• Analyze the E2E testing process
• to understand what technique
• Layout-based
• Visual
• yields
• higher productivity
• high quality of tests
Omni-Notes
Context
Android native app:
MSc Students in
Software Engineering course
Research Questions
RQ1 Productivity: What is the productivity in test script production of
graduate students with Visual and Layout-based testing tools for
Android App testing?
RQ2 Quality: What is the quality of the test suites produced by
graduate students using Visual and Layout-based testing tools for
Android App testing?
RQ3 Obstacles: What are the perceived difficulties in applying Visual
and Layout-based testing tools for Android App testing?
Experiment Design
Session 1 Session 2
Scenarios
Eye Automate
Test
scripts
Test
scripts
Feedback
Test
results
Test
results
Feedback
RQ3
RQ1
RQ2
Scenarios
Open Info Screen
Open AboutActivity and verify that App icon and copyright notice
are shown;
Add a note
Insert a note with custom title and content, and verify that it is
shown in the note list;
Search a note Input a note’s text in search bar, and verify that such note is shown;
Check available
languages
Open Language option in SettingsActivity and verify that English,
Italian and French language are available;
Delete a note
Delete and then restore a note from the TrashAc- tivity, then check
that it is shown again in the MainActivity;
Restore a note
Add and then delete a note, and check that it is no longer shown in
the MainActivity;
Add note category
Add a note category with custom name and color, and check that it
is shown among available ones in the DrawerMenu.
Feedback Questionnaire
• Implementing the test suite with EyeAutomate / Espresso was easy
and intuitive
• The EyeStudio / Android Studio IDE was helpful in the creation of test
scripts
• It was easy to identify elements with the EyeAutomate / Espresso
technique
• What were the main issues in identifying elements of the screen
using the EyeAutomate / Espresso testing approach? (Open)
• Which tool would you choose if you had to perform E2E testing in the
future? And why? (Open)
?(Open)
Espresso frame-
plementation of
using the layout-
elements of the
rform UI testing
omment)
average number
was 0.6.
21.5%) reported
Layout−based Visual
−0.25 0.00 0.25 −0.25 0.00 0.25
0
2
4
6
Productivity[testcases]
Results: productivity
⚖️
No significant difference
( p = 0.625 )
?(Open)
Espresso frame-
plementation of
using the layout-
elements of the
rform UI testing
omment)
average number
was 0.6.
21.5%) reported
Layout−based Visual
−0.25 0.00 0.25 −0.25 0.00 0.25
0
2
4
6
Productivity[testcases]
Layout−based
No Yes
0
2
4
6
Productivity[testcases]
Results: productivity
Within Espresso student
using Test Recorder
(average 6.7) and those
who didn’t (average 4.13)
show a significant
difference (p<0.001)
Layout Visual
−0.25 0.00 0.25 −0.25 0.00 0.25
0.00
0.25
0.50
0.75
1.00
TestCaseQuality
Results: quality
👍
Significant difference
( p = 0.025
Cliff’s δ = 0.18 )
Layout Visual
−0.25 0.00 0.25 −0.25 0.00 0.25
0.00
0.25
0.50
0.75
1.00
TestCaseQuality
Results: quality
👍
Layout−based
No Yes
0.00
0.25
0.50
0.75
1.00
TestCaseQuality
Within Espresso, student
using Test Recorder
(average 0.57) and those
who didn’t (average 0.71)
show a significant
difference (p=0.021)
Results: perception
by
ed
g
e
st
ge
st
ar,
he
g
ns
s,
h
g
n
h
ad
ot
es
be
ft
Hs30
participants’ perceived easiness in
nding properties to discriminate GUI
components, using theVisual or the
Layout-based approach
0.0181 Reject
Layout−based
Visual
1 2 3 4 5
(a) 2.2 - 2.6: Implementing the test suite was easy and in-
tuitive
Layout−based
Visual
1 2 3 4 5
(b) 2.3 - 2.7: The IDE was helpful in the creation of test
scripts
Visual
g
re
st
ge
st
ar,
he
ng
ns
s,
h
ng
n
h
ad
ot
es
be
ft
as
components, using theVisual or the
Layout-based approach
Layout−based
Visual
1 2 3 4 5
(a) 2.2 - 2.6: Implementing the test suite was easy and in-
tuitive
Layout−based
Visual
1 2 3 4 5
(b) 2.3 - 2.7: The IDE was helpful in the creation of test
scripts
Layout−based
Visual
ere
est
ge
est
Bar,
he
ng
ns
ns,
th
ng
in
th
ad
pot
es
be
eft
as
ms
der
Layout−based
Visual
1 2 3 4 5
(a) 2.2 - 2.6: Implementing the test suite was easy and in-
tuitive
Layout−based
Visual
1 2 3 4 5
(b) 2.3 - 2.7: The IDE was helpful in the creation of test
scripts
Layout−based
Visual
1 2 3 4 5
Ease of use
IDE support
Element identification
👍
🏻
👍
🏻
👍
🏻
Results: visual obstacles
• Issues with image recognition
• Capture size
• Click position
• Other issues (e.g. small images)
• Resolution / Portability
Results: layout-based obstacles
• Identifying widgets
• Missing / ambiguous properties
• Layout hierarchy
• Recording tool
Results
• RQ1: the learnability of the two tools is similar, for non-professional
developers approaching them.
• RQ2: the test suites developed with EyeAutomate possess a higher
quality than those developed with Espresso.
• Better quality has been achieved by the participants when manually writing
test scripts, as opposed to leveraging the Capture & Replay approach
implemented by Espresso Test Recorder.
Results
• RQ3: developing a test suite with EyeAutomate (w/EyeStudio IDE) is
slightly easier than with Espresso (w/Android Studio IDE)
• The main obstacles are:
• imprecision of the image recognition library
(especially with small elements and very simple patterns)
• difficulty of finding unambiguous layout properties
• Preference towards the visual approach
• higher intuitiveness and ease of use in building test scripts through screen
captures.
Visual vs. Layout-Based Summary
• Visual testing tools enable testers to deliver similar productivity but a
higher quality when compared to layout-based tools
• Visual testing tools exhibit problems in image capture and recognition
• Especially with small items
• Layout-based test scripts is difficult due to the incomplete or
ambiguous definition of GUI components or layouts
Take away
• If you are an app developer, then
• consider adopting “testability” guidelines
• If you are a tester, then
• think about visual tools
• If you are a visual tool developer, then
• improve image recognition
• If you are a layout-based tool developer, then
• improve script capturing
Combining Visual and Layout
Combined Layout-Visual Approach
• Translation from Layout-based test cases to Visual test cases,
and viceversa;
• From 2° generation properties to 3° generation screen captures;
• From 3° generation screen captures to 2° generation properties.
Combined Layout-Visual Approach: 2nd  3rd
Static analysis and enhancement of original layout files;
Addition of unique IDs to widgets of the Activities;
Addition of instructions for screen capturing to test code.
Combined Layout-Visual Approach: 2nd  3rd
Execution of the test script on an Android Virtual Device;
Runtime extraction of (Element, Interaction) pairs
through the use of screen capturing libraries on the AVD.
Combined Layout-Visual Approach: 2nd  3rd
Generation of the Visual test script for the selected Visual
testing tool.
Combined Layout-Visual Approach: 3rd  2nd
Adds callbacks for operations on any on-screen widgets,
allowing logging of the operations that are performed.
Combined Layout-Visual Approach: 3rd  2nd
Execution of the 3° generation script on the instrumented
Android app.
Combined Layout-Visual Approach: 3rd  2nd
Extracts layout properties from the log generated during
the execution, obtaining (property, interaction) pairs
Combined Layout-Visual Approach: 3rd  2nd
Translates the sequence of steps in the desired layout-
based scripting syntax.
Combined Approach: advantages
• Automated generation of layout-based (visual) test cases reusing
existing visual (layout-based) test cases;
• Automated porting of existing visual scripts to other devices / screen
sizes / resolutions;
• Reduced maintenance of test cases;
• Reduced impact of fragilities on test cases.
In Summary
In summary
In summary
0,01%
0,08%
0,33%
0,84%
2,43%
4,12%
20,00%
0%
5%
10%
15%
20%
Selendroid
Appium
UIAutomator
Robotium
Espresso
RobolectricJunit
E2E
Integration
Unit
€€€
In summary
Espresso
UI Automator
Robotium
Robolectric
0%
10%
20%
30%
40%
50%
60%
70%
80%
90%
Changed test files with modification linked to…
Fragility
In summary
References
• Android Distribution Dashboard:
https://developer.android.com/about/dashboards/
• L. Cruz, R. Abreu, D. Lo. «To the Attention of Mobile Software
Developers: Guess What, Test your App!» Empirical Software
Engineering, 2019
https://luiscruz.github.io/papers/cruz2019attention.pdf
• R. Coppola, M. Morisio, M. Torchiano, L. Ardito. «Scripted GUI Testing
of Android Open-Source Apps: Evolution of Test Code and Fragility
Causes» Empirical Software Engineering, 2019
References
• M. Fowler. “TestPyramid”, 2012
https://martinfowler.com/bliki/TestPyramid.html
• Nayebi, M., Adams, B., & Ruhe, G. (Dec 2015). “Mobile App Releases
– A Survey Research on Developers and Users Perception”, SANER
2015
1 of 118

Recommended

Mobile Testing Types and Basic Process by
Mobile Testing Types and Basic ProcessMobile Testing Types and Basic Process
Mobile Testing Types and Basic ProcessOlesia Hirnyk
949 views20 slides
Mobile App Testing Strategy by RapidValue Solutions by
Mobile App Testing Strategy by RapidValue SolutionsMobile App Testing Strategy by RapidValue Solutions
Mobile App Testing Strategy by RapidValue SolutionsRapidValue
3.4K views24 slides
Mobile application testing by
Mobile application testingMobile application testing
Mobile application testingvodQA
2.9K views15 slides
Mobile applications testing by
Mobile applications testingMobile applications testing
Mobile applications testingRahul Ranjan
7.2K views49 slides
Mobile test automation perfecto star east by
Mobile test automation perfecto star eastMobile test automation perfecto star east
Mobile test automation perfecto star eastPerfecto Mobile
2.3K views25 slides
Mobile Application Testing by
Mobile Application TestingMobile Application Testing
Mobile Application TestingRamakrishna Telapolu
8.1K views25 slides

More Related Content

What's hot

Software Testing of Mobile Applications: Challenges and Future Research Direc... by
Software Testing of Mobile Applications: Challenges and Future Research Direc...Software Testing of Mobile Applications: Challenges and Future Research Direc...
Software Testing of Mobile Applications: Challenges and Future Research Direc...Henry Muccini
4.2K views23 slides
Testing Mobile Apps by
Testing Mobile AppsTesting Mobile Apps
Testing Mobile AppsSuresh Kumar
358 views15 slides
1.0 introduction to mobile application testing by
1.0 introduction to mobile application testing1.0 introduction to mobile application testing
1.0 introduction to mobile application testingKailash khoiwal
104 views10 slides
Webinar learn how to test any mobile app style from within eclipse using real... by
Webinar learn how to test any mobile app style from within eclipse using real...Webinar learn how to test any mobile app style from within eclipse using real...
Webinar learn how to test any mobile app style from within eclipse using real...Perfecto Mobile
2K views25 slides
Mobile Application Testing by
Mobile Application Testing Mobile Application Testing
Mobile Application Testing Shivaraj R
245 views24 slides
Test Automation for Mobile Applications: A Practical Guide by
Test Automation for Mobile Applications: A Practical GuideTest Automation for Mobile Applications: A Practical Guide
Test Automation for Mobile Applications: A Practical GuideTechWell
1.1K views23 slides

What's hot(20)

Software Testing of Mobile Applications: Challenges and Future Research Direc... by Henry Muccini
Software Testing of Mobile Applications: Challenges and Future Research Direc...Software Testing of Mobile Applications: Challenges and Future Research Direc...
Software Testing of Mobile Applications: Challenges and Future Research Direc...
Henry Muccini4.2K views
1.0 introduction to mobile application testing by Kailash khoiwal
1.0 introduction to mobile application testing1.0 introduction to mobile application testing
1.0 introduction to mobile application testing
Kailash khoiwal104 views
Webinar learn how to test any mobile app style from within eclipse using real... by Perfecto Mobile
Webinar learn how to test any mobile app style from within eclipse using real...Webinar learn how to test any mobile app style from within eclipse using real...
Webinar learn how to test any mobile app style from within eclipse using real...
Perfecto Mobile2K views
Mobile Application Testing by Shivaraj R
Mobile Application Testing Mobile Application Testing
Mobile Application Testing
Shivaraj R245 views
Test Automation for Mobile Applications: A Practical Guide by TechWell
Test Automation for Mobile Applications: A Practical GuideTest Automation for Mobile Applications: A Practical Guide
Test Automation for Mobile Applications: A Practical Guide
TechWell1.1K views
Hp perfecto webinar - UFT Mobile by Perfecto Mobile
Hp perfecto webinar - UFT MobileHp perfecto webinar - UFT Mobile
Hp perfecto webinar - UFT Mobile
Perfecto Mobile1.6K views
Mobile applications and automation testing by IndicThreads
Mobile applications and automation testingMobile applications and automation testing
Mobile applications and automation testing
IndicThreads2.5K views
Mobile application testing by Softheme
Mobile application testingMobile application testing
Mobile application testing
Softheme10.9K views
Mobile App Testing by Duy Tan Geek
Mobile App TestingMobile App Testing
Mobile App Testing
Duy Tan Geek2.3K views
Cross Platform Mobile Test Automation using Selenium WebDriver by Perfecto Mo... by Perfecto Mobile
Cross Platform Mobile Test Automation using Selenium WebDriver by Perfecto Mo...Cross Platform Mobile Test Automation using Selenium WebDriver by Perfecto Mo...
Cross Platform Mobile Test Automation using Selenium WebDriver by Perfecto Mo...
Perfecto Mobile4.1K views
Mobile Test Coverage- Israel 4th meetup by Perfecto Mobile
Mobile Test Coverage- Israel 4th meetupMobile Test Coverage- Israel 4th meetup
Mobile Test Coverage- Israel 4th meetup
Perfecto Mobile830 views
Achieving 100% mobile test coverage perfecto mobile by Perfecto Mobile
Achieving 100% mobile test coverage perfecto mobileAchieving 100% mobile test coverage perfecto mobile
Achieving 100% mobile test coverage perfecto mobile
Perfecto Mobile2.5K views
Mobile Application Testing Training Presentation by MobiGnosis
Mobile Application Testing Training PresentationMobile Application Testing Training Presentation
Mobile Application Testing Training Presentation
MobiGnosis7.3K views
The ultimate guide to mobile app testing with appium by headspin2
The ultimate guide to mobile app testing with appiumThe ultimate guide to mobile app testing with appium
The ultimate guide to mobile app testing with appium
headspin281 views
Boston meetup blaze_meter_feb2017 by Perfecto Mobile
Boston meetup blaze_meter_feb2017Boston meetup blaze_meter_feb2017
Boston meetup blaze_meter_feb2017
Perfecto Mobile10.1K views

Similar to Testing the UI of Mobile Applications

Experitest-Infosys Co-Webinar on Mobile Continuous Integration by
Experitest-Infosys Co-Webinar on Mobile Continuous IntegrationExperitest-Infosys Co-Webinar on Mobile Continuous Integration
Experitest-Infosys Co-Webinar on Mobile Continuous IntegrationExperitest
1.5K views38 slides
GUI, Performance, Load and API testing with Test Studio by
GUI, Performance, Load and API testing with Test StudioGUI, Performance, Load and API testing with Test Studio
GUI, Performance, Load and API testing with Test StudioThessaloniki Software Testing and QA meetup
125 views19 slides
Mobile Application testing by
Mobile Application testingMobile Application testing
Mobile Application testingMukta Gupta
110 views12 slides
SynapseIndia mobile apps by
SynapseIndia mobile appsSynapseIndia mobile apps
SynapseIndia mobile appsSynapseindiappsdevelopment
295 views12 slides
Raji_new_July_2015 by
Raji_new_July_2015Raji_new_July_2015
Raji_new_July_2015Raja Kumari
352 views7 slides
Mobile Application Testing by
Mobile Application TestingMobile Application Testing
Mobile Application TestingSun Technlogies
1.1K views24 slides

Similar to Testing the UI of Mobile Applications(20)

Experitest-Infosys Co-Webinar on Mobile Continuous Integration by Experitest
Experitest-Infosys Co-Webinar on Mobile Continuous IntegrationExperitest-Infosys Co-Webinar on Mobile Continuous Integration
Experitest-Infosys Co-Webinar on Mobile Continuous Integration
Experitest1.5K views
Mobile Application testing by Mukta Gupta
Mobile Application testingMobile Application testing
Mobile Application testing
Mukta Gupta110 views
Raji_new_July_2015 by Raja Kumari
Raji_new_July_2015Raji_new_July_2015
Raji_new_July_2015
Raja Kumari352 views
Addressing Mobile App Testing Challenges by Lee Barnes
Addressing Mobile App Testing ChallengesAddressing Mobile App Testing Challenges
Addressing Mobile App Testing Challenges
Lee Barnes719 views
Appmotives - Software Testing As Service by Kalyan Paluri
Appmotives - Software Testing As ServiceAppmotives - Software Testing As Service
Appmotives - Software Testing As Service
Kalyan Paluri64 views
Mobile app testing by BugRaptors
Mobile app testingMobile app testing
Mobile app testing
BugRaptors237 views
HienVo_Mobile Testing_v.1.2 by Hien Vo
HienVo_Mobile Testing_v.1.2HienVo_Mobile Testing_v.1.2
HienVo_Mobile Testing_v.1.2
Hien Vo229 views
Mobile Test Automation by Lee Barnes
Mobile Test AutomationMobile Test Automation
Mobile Test Automation
Lee Barnes1.7K views
Launch Better Apps, Faster - Perfecto & Orasi Joint Webinar Sldies by Perfecto by Perforce
Launch Better Apps, Faster - Perfecto & Orasi Joint Webinar SldiesLaunch Better Apps, Faster - Perfecto & Orasi Joint Webinar Sldies
Launch Better Apps, Faster - Perfecto & Orasi Joint Webinar Sldies
How to Create a Risk Based Testing Strategy With Simulators, Emulators, and R... by Perfecto by Perforce
How to Create a Risk Based Testing Strategy With Simulators, Emulators, and R...How to Create a Risk Based Testing Strategy With Simulators, Emulators, and R...
How to Create a Risk Based Testing Strategy With Simulators, Emulators, and R...
Zen Test Labs Mobile Application Testing by Zen Test Labs
Zen Test Labs Mobile Application TestingZen Test Labs Mobile Application Testing
Zen Test Labs Mobile Application Testing
Zen Test Labs839 views
03 - Membangun Aplikasi Mobile Berkualitas (Herman Tolle) by Lab Mobile Filkom UB
03 - Membangun Aplikasi Mobile Berkualitas (Herman Tolle)03 - Membangun Aplikasi Mobile Berkualitas (Herman Tolle)
03 - Membangun Aplikasi Mobile Berkualitas (Herman Tolle)
Mobile testing practices by Rakesh Jha
Mobile testing practicesMobile testing practices
Mobile testing practices
Rakesh Jha1.8K views

More from Marco Torchiano

Software Engineering II Course at Politecnico di Torino by
Software Engineering II Course at Politecnico di TorinoSoftware Engineering II Course at Politecnico di Torino
Software Engineering II Course at Politecnico di TorinoMarco Torchiano
187 views14 slides
Espresso vs. EyeAutomate: comparing two generations of Android GUI testing tools by
Espresso vs. EyeAutomate: comparing two generations of Android GUI testing toolsEspresso vs. EyeAutomate: comparing two generations of Android GUI testing tools
Espresso vs. EyeAutomate: comparing two generations of Android GUI testing toolsMarco Torchiano
240 views30 slides
Research Activities: past, present, and future. by
Research Activities: past, present, and future.Research Activities: past, present, and future.
Research Activities: past, present, and future.Marco Torchiano
185 views21 slides
Data Quality - Standards e Applicazioni by
Data Quality - Standards e ApplicazioniData Quality - Standards e Applicazioni
Data Quality - Standards e ApplicazioniMarco Torchiano
626 views32 slides
Data Quality - Standards and Application to Open Data by
Data Quality - Standards and Application to Open DataData Quality - Standards and Application to Open Data
Data Quality - Standards and Application to Open DataMarco Torchiano
845 views62 slides
Data Visualization by
Data VisualizationData Visualization
Data VisualizationMarco Torchiano
908 views107 slides

More from Marco Torchiano(14)

Software Engineering II Course at Politecnico di Torino by Marco Torchiano
Software Engineering II Course at Politecnico di TorinoSoftware Engineering II Course at Politecnico di Torino
Software Engineering II Course at Politecnico di Torino
Marco Torchiano187 views
Espresso vs. EyeAutomate: comparing two generations of Android GUI testing tools by Marco Torchiano
Espresso vs. EyeAutomate: comparing two generations of Android GUI testing toolsEspresso vs. EyeAutomate: comparing two generations of Android GUI testing tools
Espresso vs. EyeAutomate: comparing two generations of Android GUI testing tools
Marco Torchiano240 views
Research Activities: past, present, and future. by Marco Torchiano
Research Activities: past, present, and future.Research Activities: past, present, and future.
Research Activities: past, present, and future.
Marco Torchiano185 views
Data Quality - Standards e Applicazioni by Marco Torchiano
Data Quality - Standards e ApplicazioniData Quality - Standards e Applicazioni
Data Quality - Standards e Applicazioni
Marco Torchiano626 views
Data Quality - Standards and Application to Open Data by Marco Torchiano
Data Quality - Standards and Application to Open DataData Quality - Standards and Application to Open Data
Data Quality - Standards and Application to Open Data
Marco Torchiano845 views
Riflessioni su Riforma Costituzionale "Renzi-Boschi" by Marco Torchiano
Riflessioni su Riforma Costituzionale "Renzi-Boschi"Riflessioni su Riforma Costituzionale "Renzi-Boschi"
Riflessioni su Riforma Costituzionale "Renzi-Boschi"
Marco Torchiano205 views
Relevance, Benefits, and Barriers of Software Modelling and Model Driven Tech... by Marco Torchiano
Relevance, Benefits, and Barriers of Software Modelling and Model Driven Tech...Relevance, Benefits, and Barriers of Software Modelling and Model Driven Tech...
Relevance, Benefits, and Barriers of Software Modelling and Model Driven Tech...
Marco Torchiano392 views
Energy Consumption Analysis
 of Image Encoding and Decoding Algorithms by Marco Torchiano
Energy Consumption Analysis
 of Image Encoding and Decoding AlgorithmsEnergy Consumption Analysis
 of Image Encoding and Decoding Algorithms
Energy Consumption Analysis
 of Image Encoding and Decoding Algorithms
Marco Torchiano475 views
Relevance, Benefits, and Problems of Software Modelling and Model-Driven Tech... by Marco Torchiano
Relevance, Benefits, and Problems of Software Modelling and Model-Driven Tech...Relevance, Benefits, and Problems of Software Modelling and Model-Driven Tech...
Relevance, Benefits, and Problems of Software Modelling and Model-Driven Tech...
Marco Torchiano611 views
A Model-Based Approach to Language Integration by Marco Torchiano
A Model-Based Approach to Language Integration A Model-Based Approach to Language Integration
A Model-Based Approach to Language Integration
Marco Torchiano532 views
On the computation of Truck Factor by Marco Torchiano
On the computation of Truck FactorOn the computation of Truck Factor
On the computation of Truck Factor
Marco Torchiano444 views
Language Interaction and Quality Issues: An Exploratory Study by Marco Torchiano
Language Interaction and Quality Issues: An Exploratory StudyLanguage Interaction and Quality Issues: An Exploratory Study
Language Interaction and Quality Issues: An Exploratory Study
Marco Torchiano928 views
The impact of process maturity on defect density by Marco Torchiano
The impact of process maturity on defect densityThe impact of process maturity on defect density
The impact of process maturity on defect density
Marco Torchiano1.3K views

Recently uploaded

Benefits in Software Development by
Benefits in Software DevelopmentBenefits in Software Development
Benefits in Software DevelopmentJohn Valentino
7 views15 slides
nintendo_64.pptx by
nintendo_64.pptxnintendo_64.pptx
nintendo_64.pptxpaiga02016
7 views7 slides
tecnologia18.docx by
tecnologia18.docxtecnologia18.docx
tecnologia18.docxnosi6702
6 views5 slides
Quality Assurance by
Quality Assurance Quality Assurance
Quality Assurance interworksoftware2
10 views6 slides
Mobile App Development Company by
Mobile App Development CompanyMobile App Development Company
Mobile App Development CompanyRichestsoft
6 views6 slides
Introduction to Maven by
Introduction to MavenIntroduction to Maven
Introduction to MavenJohn Valentino
7 views10 slides

Recently uploaded(20)

tecnologia18.docx by nosi6702
tecnologia18.docxtecnologia18.docx
tecnologia18.docx
nosi67026 views
Mobile App Development Company by Richestsoft
Mobile App Development CompanyMobile App Development Company
Mobile App Development Company
Richestsoft 6 views
Electronic AWB - Electronic Air Waybill by Freightoscope
Electronic AWB - Electronic Air Waybill Electronic AWB - Electronic Air Waybill
Electronic AWB - Electronic Air Waybill
Freightoscope 7 views
Streamlining Your Business Operations with Enterprise Application Integration... by Flexsin
Streamlining Your Business Operations with Enterprise Application Integration...Streamlining Your Business Operations with Enterprise Application Integration...
Streamlining Your Business Operations with Enterprise Application Integration...
Flexsin 5 views
Top-5-production-devconMunich-2023-v2.pptx by Tier1 app
Top-5-production-devconMunich-2023-v2.pptxTop-5-production-devconMunich-2023-v2.pptx
Top-5-production-devconMunich-2023-v2.pptx
Tier1 app9 views
Google Solutions Challenge 2024 Talk pdf by MohdAbdulAleem4
Google Solutions Challenge 2024 Talk pdfGoogle Solutions Challenge 2024 Talk pdf
Google Solutions Challenge 2024 Talk pdf
MohdAbdulAleem447 views
How To Make Your Plans Suck Less — Maarten Dalmijn at the 57th Hands-on Agile... by Stefan Wolpers
How To Make Your Plans Suck Less — Maarten Dalmijn at the 57th Hands-on Agile...How To Make Your Plans Suck Less — Maarten Dalmijn at the 57th Hands-on Agile...
How To Make Your Plans Suck Less — Maarten Dalmijn at the 57th Hands-on Agile...
Stefan Wolpers49 views

Testing the UI of Mobile Applications

  • 1. Testing the UI of Mobile Apps Marco Torchiano marco.torchiano_@_polito.it https://softeng.polito.it/torchiano @mtorchiano 3rd International Genoa Software Engineering PhD School on Automated Functional and Security Testing of Web and Mobile Applications May 13-16, Genova, Italy v.1.2.0 © Marco Torchiano, 2019
  • 2. Outline • Testing mobile apps is hard! • E2E testing of mobile apps • How much testing is performed? • Mobile test fragility • Causes of fragility • Visual vs. Layout • Combined approach
  • 6. Developers perspective • Series of interviews with actual developers from 7 companies • Are mobile applications tested? How? To what extent? • What are the most peculiar properties to test in mobile applications? • What aspects of mobile applications discourage developers from testing them? • What are the main challenges of mobile application testing?
  • 7. Developers perspective - Companies A. Distributor of testing tools for various typologies of applicatives. B. Test factory for third party applications and test consulting. C. Insurance company: web and mobile apps for insurers and customers. D. Insurance company: platform for insurance management. E. Test factory for third party applications and test consulting. F. Full-stack development of mobile applications for multiple platforms. G. Test factory for consulting of test and test management for banking applications.
  • 8. How mobile testing is performed Manual testing ● ● ● ● ● ● ○ Random-monkey testing ● ○ ○ ○ ○ ○ ○ Capture & Replay ● ● ● ● ● ○ ○ Scripted testing ● ● ● ● ● ○ ○ Model-based testing ● ○ ○ ○ ○ ○ ○
  • 9. Tool adoption Tool Category n MicroFocus UFT / QTP Regression and functional testing 4 Selenium Scripted web-based app testing 4 Appium Multi-platform mobile app automated testing 3 PerfectoMobile Scripted cloud-based app testing 3 JMeter Load and performance testing 3 Silk Mobile Capture and Replay testing 2 JUnit Java unit testing 2 AppliTools AI-based Visual Testing 1 Monkey Random testing 1 Qualitia Scripted testing and GUI modeling 1 TestComplete Capture and Replay testing 1
  • 10. Peculiarities of Mobile Testing • Procedures and instruments vary significantly for: • Native • Web-based • Hybrid • Huge device and os diversity Device diversity and form factor are the fundamental variables to take into account, much more than for web application testing, for which it is sufficient to test the main browsers
  • 11. Limitations to Mobile Test Adoption • Clients want published asap in any case • Quality and features are reduced • User feedback partly replaces testing • Business-oriented departments are in charge of testing • Focus is often on back-end as (valuable) service provider Only companies creating apps that manage sensitive and economically critical data tend to adopt automated testing • Company B
  • 12. Challenges • Test fragility leading to high maintenance cost • Company A had to re-record all tests with new version • Company B and C estimate ~30% of test effort is due to test script maintenance due to lack of flexibility [..] problem that is perceived and that has to be fought on a daily basis: test suites must be maintained daily • Company D
  • 13. End-to-End (E2E) Testing E2E testing is used to test whether the flow of an application right from start to finish is behaving as expected
  • 15. E2E Critical factors • Cost: E2E tests are expensive (hard) to write • E.g. through Capture & Replay • Time: E2E tests are slow • UI interactions take time • Integration: E2E tests are difficult to integrate in CI • Hard to run in headless mode • Fragility: E2E tests are fragile • Even minor UI changes can break tests
  • 16. E2E Critical factors worsen in mobile • Cost: E2E tests are expensive (hard) to write • E.g. through Capture & Replay • Time: E2E tests are slow • UI interactions take time • Integration: E2E tests are difficult to integrate in CI • Hard to run in headless mode • Fragility: E2E tests are fragile • Even minor UI changes can break tests Rich user interactions Wide variety of devices + Quick release cycles Device test factories or emulators Different devices may behave slightly differently
  • 17. Critical Factors – Mobile specific • Wide variety of devices • Versions of OS • Screen aspect ratio • Display Hw vs. Sw buttons • Rich user interactions • Gestures, e.g., swipe, pinch, etc. • Sw and HW buttons • Quick release cycle: • apps typically follow a weekly/bi-weekly release plan
  • 19. OS Versions 0% 5% 10% 15% 20% 25% 30% Gingerbread Ice Cream Sandwich Jelly Bean KitKat Lollipop Marshmallow Nougat Oreo Pie Data refer to May 2019
  • 20. Relative screen sizes of Android devices 20 Background (source: https: //www.xda-developers.com)
  • 21. Screen Size and Density ldpi mdpi tvdpi hdpi xhdpi xxhdpi Total Small 0.4% 0.1% 0.1% 0.6% Normal 0.9% 0.3% 24.0% 37.7% 23.6% 86.5% Large 2.4% 1.9% 0.6% 1.6% 1.7% 8.2% Xlarge 3.1% 1.3% 0.6% 5.0% Total 0.4% 6.4% 2.2% 25.9% 40.0% 25.4%
  • 22. How to handle diversity • Device portfolio representative of your target users • Include both OS version and Device • Prioritized portfolio, e.g., • Gold: • Main supported devices + OS • All test suite executed • Silver: • Additional devices + OS • Only a subset of test case executed
  • 23. A real-world case • Company performing test for third parties • Case study test process: • Conducted in 2017 • Outsourcing • On mobile banking app • 14 test areas
  • 24. Test suite 0 20 40 60 80 100 120 140 160 180 MIGRAZIONE TOKEN ASSICURAZIONE ASSISTENZA RATING MESSAGGI TOUCH ID FINANAZIAMENTI IMPOSTAZIONI POSTLOGIN NAVIGAZIONE PROFILO CONTO INVESTIMENTI PRELOGIN STRONG AUTHENTICATION RISPARMIO FLUSSI DISPOSITIVI CARTE 1349 Test cases
  • 26. Device Portfolio Gold IOS 9.3.2 APPLE 6s/6 Plus ANDROID 6.0.1 SAMSUNG S6 /S7 Silver IOS 9.3.2 APPLE 5s IOS 9.3.2 APPLE 4s ANDROID 6.0.1 SAMSUNG S5 ANDROID 5.0.1 SAMSUNG S4 ANDROID 4.4.4 SAMSUNG S3 IOS 9.3.2 APPLE 6 ANDROID 6.0.1 HUAWEI P9 IOS 9.3.2 APPLE 5c ANDROID 4.4.4 SAMSUNG Note 3 ANDROID 6.0.1 LG NEXUS 5 ANDROID 4.1.2 SAMSUNG A3 ANDROID 5.0.0 ASUS Zenfone 2 ANDROID 4.2.2 SAMSUNG S2 ANDROID 5.1.1 LG G4 ANDROID 4.4.4 Xiaomi Mi Note ANDROID 4.4.2 ACER E3 ANDROID 4.4.2 HTC SENSE 5 ANDROID 4.4.4 HUAWEI Ascend G700
  • 27. Test executions • Run just 15% of tests w.r.t. full coverage of all portfolio • 3904 test runs vs. 26980 Test cases Devices Test runs Test suite 1349 2 2698 Subset 67 18 1206 3904
  • 28. End-2-End Testing Techniques • Manual • Scripted
  • 29. End-2-End Testing Techniques • Manual • Coordinate-based • Layout-based • Visual / Image Recognition Scripted
  • 30. End-2-End Testing Techniques • Manual • Coordinate-based : 1st generation • Layout-based : 2nd generation • Visual / Image Recognition : 3rd generation
  • 31. Layout-based testing Test scripts leverage the UI structure to • Identify and detect UI components • Interact with them
  • 32. Layout-based testing Elements are identified through layout properties (e.g., IDs, text, content description, widget type)
  • 36. Espresso – Test Script @Test public void testCreateNote() { onView(withId(R.id.fab_expand_menu_button)). perform(click()); onView(withId(R.id.fab_note)).perform(click()); onView(withId(R.id.detail_title)). perform(typeTextIntoFocusedView("Ciao")); onView(withContentDescription("drawer open")). perform(click()); onView(withText("Ciao")). check(matches(isDisplayed())); }
  • 41. Espresso + Recorder – Test Script @Test public void recordedTest() { ViewInteraction viewInteraction = onView( allOf(withId(R.id.fab_expand_menu_button), childAtPosition(allOf(withId(R.id.fab), childAtPosition( withClassName(is("android.widget.FrameLayout")), 2)), 3), isDisplayed())); viewInteraction.perform(click()); This is just for the first click!
  • 42. Espresso + Recorder – Test Script // Added a sleep statement to match the app's execution delay. // The recommended way to handle such scenarios is to use Espresso idling resources: // https://google.github.io/android-testing-support- library/docs/espresso/idling-resource/index.html try { Thread.sleep(150); } catch (InterruptedException e) { e.printStackTrace(); } A number of sleeps added even if not required
  • 43. Espresso + Recorder – Test Script ViewInteraction viewInteraction = onView( allOf(withId(R.id.fab_expand_menu_button), childAtPosition(allOf(withId(R.id.fab), childAtPosition( withClassName(is("android.widget.FrameLayout")), 2)), 3), isDisplayed())); viewInteraction.perform(click()); onView(withId(R.id.fab_expand_menu_button)). perform(click());
  • 44. Visual testing • Image recognition techniques are used to identify elements of the user interface to interact with. • Ease of definition of test cases with no tech knowledge required • only screen captures are needed • Can be applied seamlessly to any kind of software provided with an (emulated) user interface • Very high fragility to even minor changes in the GUI • Difficult in-depth testing of application functionalities.
  • 45. Visual testingImage recognition of screen captures on an emulated Android Virtual Device Visual GUI Testing of Android Apps
  • 48. Script EyeAutomate Click "{ImageFolder}/1557782216425.png" Click "{ImageFolder}/1557782221958.png" Click "{ImageFolder}/1557782228188.png" Type "Ciao" Click "{ImageFolder}/1557782244581.png" Check "{ImageFolder}/1557782252007.png"
  • 51. How much is E2E testing used? And which tools are used, how much?
  • 55. Tool Diffusion 0% 1% 2% 3% 4% 5% Selendroid Appium UI Automator Robotium Espresso Robolectric
  • 56. Tool Diffusion 0.01% 0.08% 0.33% 0.84% 2.43% 4.12% 20.00% 0% 5% 10% 15% 20% Selendroid Appium UI Automator Robotium Espresso Robolectric Junit
  • 57. Tools diffusion Results from Cruz et al., 2019
  • 58. How much test code? 2.8% 7.4% 6.2% 7.6% 13.5% 0% 2% 4% 6% 8% 10% 12% 14% Appium UI Automator Robotium Espresso Robolectric TLR = Test LOC / Project LOC
  • 60. Fragility A test case is fragile if it requires interventions when the application evolves due to any modification applied to the Application Under Test.
  • 61. Fragility related drawbacks • When a fragility manifests, a test fails • Then extra effort is required to: • Verify that no regression has occurred • Modify the failing test to adapt it to the changed UI • Re-run the test
  • 62. Visual fragility Graphic changes: invalidation of Visual test scripts.Graphic changes: invalidation of Visual test scripts. App: K9 Mail
  • 63. Layout-based fragility Properties change: invalidation of Layout-based test scripts.
  • 64. How much fragility? • Test Suite Volatility (TSV) • Proportion of releases that required any test code modification • Modified Test Classes Ratio (MCR) • Average proportion of test classes modified on each release • Modified Classes With Modified Methods ratio • Discards new methods and other cosmetic changes
  • 65. How much fragility? Espresso UI Automator Robotium Robolectric 0% 5% 10% 15% 20% 25% 30% Test Suite Volatility
  • 66. How much fragility? Espresso UI Automator Robotium Robolectric 0% 2% 4% 6% 8% 10% 12% 14% 16% 18% 20% Modified Class Ratio
  • 67. How much fragility? Espresso UI Automator Robotium Robolectric 0% 10% 20% 30% 40% 50% 60% 70% Modified Classes With Modified Methods
  • 69. Taxonomy of change causes (top-level)
  • 71. Taxonomy of change causes Modifications of test code without connection to production code. (e.g., changes in checked assertions, refactoring of test code, addition or removal of log instructions or screen captures, syntax corrections) - assertThat(activity, notNullValue()); - assertThat(activity.toolbar, notNullValue()); - assertThat(activity.presenter, notNullValue()); + assertThat(activity.drawerToggle, notNullValue());
  • 72. Taxonomy of change causes Modifications in test code due to changes in production code that are unrelated to the graphic appearance of the app (e.g., changes in Activity methods and startup, changes in the application data structures, application code refactoring) + Intent intent = new Intent(); + intent.putExtra(Judo.JUDO_OPTIONS, getJudo().build()); - activityTestRule.launchActivity(getIntent()); + activityTestRule.launchActivity(intent);
  • 73. Taxonomy of change causes Changes in the time needed by the app to perform operations (e.g., changes in View transition duration, or long-running activity tasks) - Thread.sleep(500); + Thread.sleep(1000);
  • 74. Taxonomy of change causes Adaptations of test classes to guarantee compatibility with different versions of the Android OS (e.g., changed classes for the same Widget or OS version check) - rotateToPortrait( this ); + if (VERSION.SDK_INT >= + VERSION_CODES.JELLY_BEAN_MR2) { + ritateToPortrait( this );
  • 75. Taxonomy of change causes Modifications in the operations that can be performed over existing widgets of the user interfac (e.g., changed in the navigation, in keyboard opening methods, in checked properties of widgets) - onView(withId(R.id.fitnessProgramButton)). perform(ViewActions(scrollTo()); + onView(withId(R.id.fitnessProgramButton)). perform(ViewActions.scrollTo()), click());
  • 76. Taxonomy of change causes Modifications in the number and type of elements in the visual hierarchy of the tested activities (e.g., addition, removal or substitution of widgets) expectVisible(viewThat( - hasAncestorThat(withId( - R.id.attribute_symptoms_onset_days)), + hasAncestorThat(withId(R.id.attribute_weight)), hasText(" ");
  • 77. Taxonomy of change causes Changes in the way the widgets are identified in test code (e.g., changes in unique IDs or text content of views) - onView(withId(R.id.morse_input_text_card)) + onView(withId(R.id.morse_input_text_container)) .perform(click());
  • 78. Taxonomy of change causes Changed ways to access resources that are used as oracles by the test code (e.g., changes in retrieving of text or graphical resources) - onView(withText("Coupon")).perform(click()) + onView(withText(R.string.category_coupon)) .perform(click());
  • 79. Taxonomy of change causes Modification in the actual appearance of widgets (e.g., changes in animations, transparencies, themes, absolute coordinates, sizes)
  • 80. Taxonomy of change causes (full)
  • 81. Fragility changes Espresso UI Automator Robotium Robolectric 0% 10% 20% 30% 40% 50% 60% 70% 80% 90% Changed test files with modification linked to AUT…Changed test files with modifications linked to AUT changes
  • 82. Non-Fragility changes Espresso UI Automator Robotium Robolectric 0% 10% 20% 30% 40% 50% 60% 70% 80% 90% Changed test files with modifications not linked to AUT…Changed test files with modifications NOT linked to AUT changes
  • 83. GUI related changes Espresso UI Automator Robotium Robolectric 0% 10% 20% 30% 40% 50% 60% 70% 80% 90% AUT related changes linked to GUI changes
  • 84. Visual vs. Layout-Based Cost of test development
  • 85. Experiment Goal • Analyze the E2E testing process • to understand what technique • Layout-based • Visual • yields • higher productivity • high quality of tests
  • 86. Experiment Goal • Analyze the E2E testing process • to understand what technique • Layout-based • Visual • yields • higher productivity • high quality of tests Omni-Notes Context Android native app: MSc Students in Software Engineering course
  • 87. Research Questions RQ1 Productivity: What is the productivity in test script production of graduate students with Visual and Layout-based testing tools for Android App testing? RQ2 Quality: What is the quality of the test suites produced by graduate students using Visual and Layout-based testing tools for Android App testing? RQ3 Obstacles: What are the perceived difficulties in applying Visual and Layout-based testing tools for Android App testing?
  • 88. Experiment Design Session 1 Session 2 Scenarios Eye Automate Test scripts Test scripts Feedback Test results Test results Feedback RQ3 RQ1 RQ2
  • 89. Scenarios Open Info Screen Open AboutActivity and verify that App icon and copyright notice are shown; Add a note Insert a note with custom title and content, and verify that it is shown in the note list; Search a note Input a note’s text in search bar, and verify that such note is shown; Check available languages Open Language option in SettingsActivity and verify that English, Italian and French language are available; Delete a note Delete and then restore a note from the TrashAc- tivity, then check that it is shown again in the MainActivity; Restore a note Add and then delete a note, and check that it is no longer shown in the MainActivity; Add note category Add a note category with custom name and color, and check that it is shown among available ones in the DrawerMenu.
  • 90. Feedback Questionnaire • Implementing the test suite with EyeAutomate / Espresso was easy and intuitive • The EyeStudio / Android Studio IDE was helpful in the creation of test scripts • It was easy to identify elements with the EyeAutomate / Espresso technique • What were the main issues in identifying elements of the screen using the EyeAutomate / Espresso testing approach? (Open) • Which tool would you choose if you had to perform E2E testing in the future? And why? (Open)
  • 91. ?(Open) Espresso frame- plementation of using the layout- elements of the rform UI testing omment) average number was 0.6. 21.5%) reported Layout−based Visual −0.25 0.00 0.25 −0.25 0.00 0.25 0 2 4 6 Productivity[testcases] Results: productivity ⚖️ No significant difference ( p = 0.625 )
  • 92. ?(Open) Espresso frame- plementation of using the layout- elements of the rform UI testing omment) average number was 0.6. 21.5%) reported Layout−based Visual −0.25 0.00 0.25 −0.25 0.00 0.25 0 2 4 6 Productivity[testcases] Layout−based No Yes 0 2 4 6 Productivity[testcases] Results: productivity Within Espresso student using Test Recorder (average 6.7) and those who didn’t (average 4.13) show a significant difference (p<0.001)
  • 93. Layout Visual −0.25 0.00 0.25 −0.25 0.00 0.25 0.00 0.25 0.50 0.75 1.00 TestCaseQuality Results: quality 👍 Significant difference ( p = 0.025 Cliff’s δ = 0.18 )
  • 94. Layout Visual −0.25 0.00 0.25 −0.25 0.00 0.25 0.00 0.25 0.50 0.75 1.00 TestCaseQuality Results: quality 👍 Layout−based No Yes 0.00 0.25 0.50 0.75 1.00 TestCaseQuality Within Espresso, student using Test Recorder (average 0.57) and those who didn’t (average 0.71) show a significant difference (p=0.021)
  • 95. Results: perception by ed g e st ge st ar, he g ns s, h g n h ad ot es be ft Hs30 participants’ perceived easiness in nding properties to discriminate GUI components, using theVisual or the Layout-based approach 0.0181 Reject Layout−based Visual 1 2 3 4 5 (a) 2.2 - 2.6: Implementing the test suite was easy and in- tuitive Layout−based Visual 1 2 3 4 5 (b) 2.3 - 2.7: The IDE was helpful in the creation of test scripts Visual g re st ge st ar, he ng ns s, h ng n h ad ot es be ft as components, using theVisual or the Layout-based approach Layout−based Visual 1 2 3 4 5 (a) 2.2 - 2.6: Implementing the test suite was easy and in- tuitive Layout−based Visual 1 2 3 4 5 (b) 2.3 - 2.7: The IDE was helpful in the creation of test scripts Layout−based Visual ere est ge est Bar, he ng ns ns, th ng in th ad pot es be eft as ms der Layout−based Visual 1 2 3 4 5 (a) 2.2 - 2.6: Implementing the test suite was easy and in- tuitive Layout−based Visual 1 2 3 4 5 (b) 2.3 - 2.7: The IDE was helpful in the creation of test scripts Layout−based Visual 1 2 3 4 5 Ease of use IDE support Element identification 👍 🏻 👍 🏻 👍 🏻
  • 96. Results: visual obstacles • Issues with image recognition • Capture size • Click position • Other issues (e.g. small images) • Resolution / Portability
  • 97. Results: layout-based obstacles • Identifying widgets • Missing / ambiguous properties • Layout hierarchy • Recording tool
  • 98. Results • RQ1: the learnability of the two tools is similar, for non-professional developers approaching them. • RQ2: the test suites developed with EyeAutomate possess a higher quality than those developed with Espresso. • Better quality has been achieved by the participants when manually writing test scripts, as opposed to leveraging the Capture & Replay approach implemented by Espresso Test Recorder.
  • 99. Results • RQ3: developing a test suite with EyeAutomate (w/EyeStudio IDE) is slightly easier than with Espresso (w/Android Studio IDE) • The main obstacles are: • imprecision of the image recognition library (especially with small elements and very simple patterns) • difficulty of finding unambiguous layout properties • Preference towards the visual approach • higher intuitiveness and ease of use in building test scripts through screen captures.
  • 100. Visual vs. Layout-Based Summary • Visual testing tools enable testers to deliver similar productivity but a higher quality when compared to layout-based tools • Visual testing tools exhibit problems in image capture and recognition • Especially with small items • Layout-based test scripts is difficult due to the incomplete or ambiguous definition of GUI components or layouts
  • 101. Take away • If you are an app developer, then • consider adopting “testability” guidelines • If you are a tester, then • think about visual tools • If you are a visual tool developer, then • improve image recognition • If you are a layout-based tool developer, then • improve script capturing
  • 103. Combined Layout-Visual Approach • Translation from Layout-based test cases to Visual test cases, and viceversa; • From 2° generation properties to 3° generation screen captures; • From 3° generation screen captures to 2° generation properties.
  • 104. Combined Layout-Visual Approach: 2nd  3rd Static analysis and enhancement of original layout files; Addition of unique IDs to widgets of the Activities; Addition of instructions for screen capturing to test code.
  • 105. Combined Layout-Visual Approach: 2nd  3rd Execution of the test script on an Android Virtual Device; Runtime extraction of (Element, Interaction) pairs through the use of screen capturing libraries on the AVD.
  • 106. Combined Layout-Visual Approach: 2nd  3rd Generation of the Visual test script for the selected Visual testing tool.
  • 107. Combined Layout-Visual Approach: 3rd  2nd Adds callbacks for operations on any on-screen widgets, allowing logging of the operations that are performed.
  • 108. Combined Layout-Visual Approach: 3rd  2nd Execution of the 3° generation script on the instrumented Android app.
  • 109. Combined Layout-Visual Approach: 3rd  2nd Extracts layout properties from the log generated during the execution, obtaining (property, interaction) pairs
  • 110. Combined Layout-Visual Approach: 3rd  2nd Translates the sequence of steps in the desired layout- based scripting syntax.
  • 111. Combined Approach: advantages • Automated generation of layout-based (visual) test cases reusing existing visual (layout-based) test cases; • Automated porting of existing visual scripts to other devices / screen sizes / resolutions; • Reduced maintenance of test cases; • Reduced impact of fragilities on test cases.
  • 117. References • Android Distribution Dashboard: https://developer.android.com/about/dashboards/ • L. Cruz, R. Abreu, D. Lo. «To the Attention of Mobile Software Developers: Guess What, Test your App!» Empirical Software Engineering, 2019 https://luiscruz.github.io/papers/cruz2019attention.pdf • R. Coppola, M. Morisio, M. Torchiano, L. Ardito. «Scripted GUI Testing of Android Open-Source Apps: Evolution of Test Code and Fragility Causes» Empirical Software Engineering, 2019
  • 118. References • M. Fowler. “TestPyramid”, 2012 https://martinfowler.com/bliki/TestPyramid.html • Nayebi, M., Adams, B., & Ruhe, G. (Dec 2015). “Mobile App Releases – A Survey Research on Developers and Users Perception”, SANER 2015

Editor's Notes

  1. TVDPI Medium High density ≈160–213 dots per inch HDPI or HiDPI High density ≈213–240 dots per inch XHDPI eXtra High density ≈240–320 dots per inch XXHDPI eXtra eXtra High density ≈320–480 dots per inch
  2. Impact on data preparation: many users
  3. The officially recommended tool for testing android apps
  4. Robolectric is mostly a unit-test tool therefore is less affected by fragility
  5. Robolectric is apparently lower level, therefore it requires more maintenance Espresso requires relatively less maintenance
  6. Robolectric is not a GUI testing tool it is used ALSO for that purpose
  7. Testing mobile apps is hard Diversity is one
  8. The diversity adds to general pyramid consideration about testing economics That explains the limited adoption of mobile UI testing
  9. The leading cause is fragility This applies to both 2nd and 3rd generation tools
  10. A possible way out is a combined approach, though tools (both) need to improve