Your SlideShare is downloading. ×
How ANDROID TESTING changed how we think about Death - Second Edition
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Saving this for later?

Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime - even offline.

Text the download link to your phone

Standard text messaging rates apply

How ANDROID TESTING changed how we think about Death - Second Edition

1,494
views

Published on

"Irreproducible bugs become highly reproducible right after delivery to the customer". This is something that happens "almost" everyday. …

"Irreproducible bugs become highly reproducible right after delivery to the customer". This is something that happens "almost" everyday.
It is well known that testing offers significant advantages as a development practice and helps ensure higher quality code with fewer defects.
Unfortunately, testing Android apps can be challenging, so in this session we are gonna talk about available tools and practices that could help us accomplish our goals.

Published in: Engineering, Software, Technology

0 Comments
7 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
1,494
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
23
Comments
0
Likes
7
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. How ANDROID TESTING changed how we think about death… @fernando_cejas Code samples: https://github.com/android10/Inside_Android_Testing https://github.com/android10/AndroidApplicationTestingSample Second Edition android10.org
  • 2. Who am I… •  Software Engineer •  GDG Barcelona Organizer android10.org •  Android lover •  Geek •  Gintonic fan…
  • 3. Agenda?
  • 4. Why testing..WTF? •  Testing increases the level of confidence in your code. •  Testing makes it possible to write new code, and refactor existing code, without worrying that you’ve broken existing functionality.
  • 5. •  Unit testing •  Integration Testing •  Functional and System Testing 1.  Stress Testing 2.  Performance Testing 3.  Usability Testing •  Acceptance Testing •  Regression Testing 1.  Smoke Testing Types of tests…
  • 6. Martin Fowler: "...test-doubles ... preprogrammed with expectation" What is this mock thing?
  • 7. Mockito is a mocking framework that tastes really good. Mockito doesn't give you hangover because the tests are very readable and they produce clean verification errors. GIVE A WARM WELCOME TO… mockito
  • 8. Mockito Build-operate-check pattern
  • 9. Mock initizalition
  • 10. Initizalition using mockito test runner
  • 11. Let’s verify some behaviour
  • 12. Argument matchers
  • 13. Verifying number of invocations / at least x / never
  • 14. Making sure interaction(s) never happened on mock
  • 15. Spying on real objects
  • 16. Sounds familiar???
  • 17. Allows you to run your android code on JVM. Allows loading of Android Classes in pure Java Projects. TO THE RESCUE…
  • 18. Shadow Objects!
  • 19. View and Resource Loading…
  • 20. Shadow Activity Shadow ImageView
  • 21. •  Uses real Android SDK code •  Styles and themes supported •  System resources are available •  Performance improved •  Bugs fixed Robolectric 2.0+
  • 22. Perform click Sample
  • 23. Started Activity test Should have fragment test
  • 24. Device Configuration Sample
  • 25. Network sample Robolectric acts as a proxy!!!
  • 26. Creating your own shadows
  • 27. Creating your own shadows
  • 28. Creating your own shadows
  • 29. •  A library by square (FTW!) •  It gives a chainable (or “fluent”) syntax for checking assertions. •  Makes tests easier to write (and read!). FEST Android
  • 30. Sample: code to modify a bitmap
  • 31. Assertions with FEST
  • 32. 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 Dependency what?
  • 33. Dagger Directed Acyclic Graph
  • 34. Dagger Graph sample
  • 35. Dagger sample
  • 36. Declare dependencies
  • 37. Satisfy dependencies
  • 38. Build the graph
  • 39. Modules
  • 40. Spoon •  Acceptance tests (black box) •  Automation of test execution across multiple devices •  Aggregation of the results
  • 41. Spoon •  Aggregation of screenshots while your tests are running
  • 42. •  Robojuice •  Robotium •  Android Testing Framework •  UI Automator •  Monkey Runner •  Espresso •  Calabash More tools…
  • 43. WRITE TESTS!!! •  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…
  • 44. DO NOT LET YOUR CODE TO BE BROKEN… DO NOT BREAK EXISTING FUNCTIONLITY…
  • 45. Questions?
  • 46. @fernando_cejas https://github.com/android10 http://android10.org THANKS!!!