droidconIN 2016

The sixth edition of droidconIN

Baskara Nur Patria

@baskara

Test Driven Android Development

Submitted Aug 9, 2016

Driving Android Code with tests is often difficult due to the tight coupling between the Android Platform and Java code. Challenge often is to separate the concerns between the domain and view logic in a manner that both can be tested independently. Writing Android code with heavy coupling between domain and view allows only for functional tests to be introduced which are slow, brittle and can quickly lead to a maintenance hazard. More so, adding just functional tests describe the classic inverted pyramid problem which is not a recommended software engineering practice.

In order to write tests first and let those drive the development of code, our code needs to be restructured in a way that it’s unit testable.

Outline

In this 6 hour workshop, we will deep dive into testing by building a demo app from scratch by strictly following the TDD practice.

Over the course of the workshop, the participants will learn about:

  • Idea of unit testing
    • Mocks, stubs and the difference between them
  • Model-View-Presenter Pattern
    • Advantages
    • Unit Testing presenters by mocking Android dependencies
  • Testing network and database layers
    • Abstracting network and database layers as services
    • Adding unit tests for network calls
    • Instrumentation tests for database layer
  • Model-View-ViewModel Pattern
    • Advantages
    • Two way data binding
    • Testing view models
  • UI Testing using Espresso
    • Using Dagger to inject test dependencies easily
    • Using mock web server to provide mocked API responses

MindMap: https://goo.gl/Vdcz2V

Requirements

Basic Android development skills
Laptop with Android Studio installed

Speaker bio

I am Baskara and my co-presenters Chirag and Sumit, work at Go-Jek Engineering. We have beeing working on a large scale mobile-first transportation startup with an app having 20 million Play Store and App Store downloads, which has seen 900x growth in the past year.

Comments

{{ gettext('Login to leave a comment') }}

{{ gettext('Post a comment…') }}
{{ gettext('New comment') }}
{{ formTitle }}

{{ errorMsg }}

{{ gettext('No comments posted yet') }}

Hosted by

droidconIN is an annual conference on Android, part of the worldwide series of events. more