$30 off During Our Annual Pro Sale. View Details »

Having a taste of Android? testing in 10 minutes...

Tuenti
February 27, 2014

Having a taste of Android? testing in 10 minutes...

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.

Tuenti

February 27, 2014
Tweet

More Decks by Tuenti

Other Decks in Technology

Transcript

  1. Having a taste of ANDROID?
    testing in 10 minutes…
    @fernando_cejas
    Code samples:
    https://github.com/android10/Inside_Android_Testing
    https://github.com/android10/AndroidApplicationTestingSample

    View Slide

  2. @fernando_cejas
    •  Software Engineer
    •  GDG Barcelona Organizer
    •  Android lover
    •  Geek
    •  Gintonic fan…
    …y un pelotudo…

    View Slide

  3. Agenda? Noooo…only 10 minutes
    pitch…

    View Slide

  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.

    View Slide

  5. 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

    View Slide

  6. 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?

    View Slide

  7. Dagger
    Directed
    Acyclic
    Graph

    View Slide

  8. Dagger Graph sample

    View Slide

  9. Martin Fowler:
    "...test-doubles ... preprogrammed with
    expectation"
    What is this mock thing?

    View Slide

  10. 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
    WELCOME TO…
    mockito
    Mock objects can simulate
    the behaviour of complex
    objects.

    View Slide

  11. Allows you to run your android
    code on JVM.
    Allows loading of Android
    Classes in pure Java
    Projects.
    TO THE RESCUE…

    View Slide

  12. •  Uses real Android SDK code
    •  Styles and themes supported
    •  System resources are available
    •  Performance improved
    •  Bugs fixed
    Robolectric 2.0+

    View Slide

  13. Spoon
    •  Acceptance tests (black box)
    •  Automation of test execution across multiple
    devices
    •  Aggregation of the results

    View Slide

  14. Spoon
    •  Acceptance tests
    (black box)
    •  Automation of test
    execution across
    multiple devices
    •  Aggregation of the
    results

    View Slide

  15. •  Robojuice
    •  Robotium
    •  Android Testing Framework
    •  UI Automator
    •  Monkey Runner
    •  Espresso
    •  Calabash
    More tools…

    View Slide

  16. 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…

    View Slide

  17. DO NOT LET YOUR CODE TO BE BROKEN…
    DO NOT BREAK EXISTING FUNCTIONLITY…

    View Slide

  18. View Slide

  19. Questions? At the end of the seesion…

    View Slide

  20. @fernando_cejas
    https://github.com/android10
    [email protected]
    http://corporate.tuenti.com/es/dev/blog
    THANKS!!!

    View Slide