The Best of Android Testing and More

Chuck Greb
4 min readFeb 7, 2023

It’s been a while since writing any new articles on here, but recently I’ve had a number of folks reach out about blog posts I’ve written, conference talks I’ve given, and open source projects I’ve worked on over the years.

So I decided to put together “best of” article of sorts — highlighting some of my more popular talks, posts, and projects all in one place.

The astute reader will notice a common theme here, as many of these topics come from my Android Testing blog series, but there’s a few (hopefully) interesting bits on other topics as well.

Enjoy.

Conference Talks

DevFest Ukraine 2018

Productivity Hacks for Busy Engineers | Droidcon NYC 2019
What do tomatoes have to do with productivity? Does multi-tasking really work? Can organizing your TODO list into boxes really help you get more things done? I don’t know. But come to this interactive session and we’ll find out together.

Working Effectively with Android Legacy Code | DevFest Ukraine 2018
Android isn’t new anymore. Most applications are not greenfield projects. Many of us find ourselves in the position of working with code we did not the author and which we don’t fully understand.

Clean app design with Architecture Components | Droidcon SF 2017
Handling lifecycle events, maintaining view state, and persisting data are all common challenges on Android that have contributed to the widespread adoption of clean architecture patterns like MVC, MVP, and MVVM. Android Architecture Components is a new collection of libraries to help developers manage these same nagging issues. This talk explores how components like Lifecycle, ViewModel, LiveData, and Room can be leveraged in an app already using clean architecture principles to help make your code even more robust, maintainable, and testable.

Testable Android Architecture | Droidcon NYC 2016
Today we have many testing tools for Android including JUnit, Mockito, PowerMock, Robolectric, Espresso, and more. But how can you design your application to leverage each one most effectively? This talk introduces a modified version of the Model View Presenter (MVP) architecture that organizes your code to be more flexible, maintainable, and testable.

Forks, Fragmentation, and the Future of Android | Droidcon SF 2015
Android powers more than 80% of smartphones worldwide and shipped on over 1 billion devices in 2014. However the hidden story in these numbers is that Android forks now account for over 20% of the global Android ecosystem and 41% of new devices. Early on “fragmentation” was an issue of screen size, display density, and platform version. The new “fragmentation” is forked versions of the OS and alternate app stores.

Blog Posts

DevFest Conakry 2019 group photo on the steps of the Malick Conde Cultural Center in Guinea, West Africa

Build, Collaborate, Scale: DevFest Conakry 2019
The second annual DevFest Conakry was held on December 7, 2019 in Guinea, West Africa. This is the story of that event told by an attendee, speaker, and organizer.

Working Effectively with (Android) Legacy Code
Android isn’t new anymore. Most apps are not greenfield projects. Many of us find ourselves in the position of working with code we did not author and which we don’t fully understand.

Breaking Dependencies
Dependencies are one of the biggest challenges to getting legacy code into a test harness. Especially dependencies on the Android framework.

Test First Then Refactor
Tests are the safety net that allow you to refactor with confidence. But what if your legacy code doesn’t have any tests? Then add some!

Passive View
Passive View is the concept that logic in UI code should be minimized. This idea is also sometimes referred to as Humble View.

Refactoring
Refactoring is making a series of small structural changes to improve readability and maintainability of software without modifying existing behavior.

Testing Presenters
Since all our Android framework dependencies are encapsulated in the view layer, the presenter can be tested using pure JUnit.

Integration Testing with Robolectric
This amazing framework made it possible to unit test Android code in the local JVM using bytecode manipulation to replace Android classes with mock (shadow) classes.

The 3 tiers of the Android test pyramid
The test pyramid is a concept that any automated testing strategy should have more low-level unit tests than high-level UI tests. Let’s take a look at how the test pyramid can be applied to modern Android development.

Open Source

Loginator: A clean architecture case study based on the Android Studio login template

Location Open Source Tracker (LOST)
Drop-in replacement for Google’s proprietary location services library for Android focused on data transparency and privacy.

Mapzen Android SDK
Mapping SDK and replacement for Google Places API for location based apps using OpenStreetMap data.

Mapzen iOS SDK
Open source and open data mapping SDK for location based apps on iOS using OpenStreetMap data.

Eraser Map
Privacy-focused mapping application for Android where we adopted Kotlin (pre-1.0 release) in early 2015.

Robolectric
I was an early contributor to one of the first unit testing frameworks for Android that is still around today.

Loginator
Clean architecture case study based on the Android Studio login template.

Model View Presenter Controller
Demo app with my own take on clean architecture based on MVP and MVI design patterns. (see Testable Android Architecture video above)

If you found this article helpful, please give it some applause 👏 to help others find it. You can also leave a comment below. Thanks!

--

--

Chuck Greb

Mission-driven engineering leader. Community organizer. Digital minimalist.