Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Android Test-Driven Development

Android Test-Driven Development

Test-Driven Development (TDD) is a software development process where you write failing tests before writing the code to make it pass. This can be a common practice in some technology circles, but we’ve seen slow adoption on Android. Because it’s not embedded in the Android culture, it can be hard to learn how to get started with TDD. In this talk, we’ll go over the basics of TDD, how you can apply it at varying levels in an Android architecture, and what steps to take if you’re working with legacy code. You should walk away from this talk with the tools you need to get started exploring practicing TDD on your own.

Victoria Gonda

October 15, 2019
Tweet

More Decks by Victoria Gonda

Other Decks in Programming

Transcript

  1. Hello, I'm Victoria! • Android Engineer at Buffer • Author

    at RayWenderlich.com • Hedgehog and cat owner
  2. Android Test-Driven Development by Tutorials A book that teaches you

    to write sustainable, testable apps, as well as to apply testing strategies to legacy projects via Espresso and UI tests, code coverage and refactoring.
  3. What to test? ▪ Do test code that: ▪ Contains

    logic ▪ Is fragile ▪ Will change
  4. What to not test? ▪ Don't test code that: ▪

    Is not yours ▪ Is generated ▪ Is throwaway
  5. What is TDD ▪ Write a failing test ▪ Write

    code to make it pass ▪ Refactor
  6. Why use TDD? ▪ Write intentionally ▪ Automatically document ▪

    Keep maintainable code ▪ Have confidence in your code ▪ Develop faster ▪ Higher test coverage
  7. Robolectric ▪ "Robolectric is a framework that brings fast and

    reliable unit tests to Android." ▪ Android sandbox, off device
  8. Espresso ▪ UI Testing ▪ "Use Espresso to write concise,

    beautiful, and reliable Android UI tests."
  9. Android Test-Driven Development by Tutorials A book that teaches you

    to write sustainable, testable apps, as well as to apply testing strategies to legacy projects via Espresso and UI tests, code coverage and refactoring.