How to Make Your Android Application More Testable

Ricky Putra
MeetU Engineering
Published in
1 min readMay 2, 2018

At MeetU early stage development, we got a lot of troubles when we try to test our Android client app, because, It’s just freaking hard to test Android app especially the UI part.

This is our code before refactoring.

We can see that, there are a lot of logic involves in our Activity code making this Activity not dumb anymore and make it more dangerous if we decide to just test the Activity based on rendered UI layout.

One solution, that we found along the way is to make this Activity more dumb by delegate validation or logic in our Activity to Presenter, making Activity more dumb and cleaner, also easier to test (we just need to test Presenter logic).

As we can see, right now we can test each function in Presenter separately like this.

Hope you enjoy our content :)

--

--