It is well known that testing offers significant advantages as a development practice and helps ensure higher quality code with fewer defects.
In this session we are gonna talk about available tools and practices that could help us write tests for the Android platform.
Having a taste of ANDROID?
testing in 10 minutes…
• Software Engineer
• GDG Barcelona Organizer
• Android lover
• Gintonic fan…
…y un pelotudo…
Agenda? Noooo…only 10 minutes
• Testing increases the level of conﬁdence in
• Testing makes it possible to write new code,
and refactor existing code, without worrying
that you’ve broken existing functionality.
Types of tests:
• Unit testing
• Integration Testing
• Functional and System Testing
1. Stress Testing
2. Performance Testing
3. Usability Testing
• Acceptance Testing
• Regression Testing
1. Smoke Testing
Dependency injection is a software design
pattern that allows the removal of hard-coded
dependencies and makes it possible to change
them, whether at run-time or compile-time
Dagger Graph sample
"...test-doubles ... preprogrammed with
What is this mock thing?
Mocking Frameworks allow us to test the
code you want, without its dependencies.
Mock objects isolate the unit
of code you are testing.
GIVE A WARM
Mock objects can simulate
the behaviour of complex
Allows you to run your android
code on JVM.
Allows loading of Android
Classes in pure Java
TO THE RESCUE…
• Uses real Android SDK code
• Styles and themes supported
• System resources are available
• Performance improved
• Bugs ﬁxed
• Acceptance tests (black box)
• Automation of test execution across multiple
• Aggregation of the results
• Acceptance tests
• Automation of test
• Aggregation of the
• Android Testing Framework
• UI Automator
• Monkey Runner
• Simplify your architecture
• Have a robust testing strategy
• Use continuous integration tools
• Mock/stub functionality
• Create your own test runner
Best practices and some advice…
DO NOT LET YOUR CODE TO BE BROKEN…
DO NOT BREAK EXISTING FUNCTIONLITY…
Questions? At the end of the seesion…