Testing in Android Part 3: Ent-to-End Tests

Using Android, Compose, and Coroutine Test Libraries to Test Features End-to-End

Siva Ganesh Kantamani
5 min readDec 18, 2022


Photo by UX Indonesia on Unsplash


In the first article of this series, we covered testing business logic with unit tests and in the second one, we covered integration tests. In this article, we will test various features of the EasyTODO application using end-to-end tests.

End-to-End are large tests that focus on testing a feature from end-to-end(similar to how the users act). These tests obviously involve android components so we need a physical device or emulator to run them. End-to-End tests go under androidTest similar to integration tests.

Involving android components make things a bit complicated to set up end-to-end tests like custom test runner, hilt test setup, etc. We’ve covered all of this in part 2 while writing integration tests, though I’ll give a quick recap then we’ll start on writing end-to-end tests.

Hilt SetUp Recap

This section is just a recap of the Hilt setup, please go through part 2 of this series for in-detailed implementation. There are two things that we need to take care of to use hilt for testing.

  1. Custom Runner: we should create a custom AndroidJUnitRunner and use HiltTestApplication as a class. Then configure it as the testInstrumentationRunner in-app level gradle file.
  2. TestAppModule: We should be creating a test app module where we can provide test variant dependencies instead of actual dependencies. Like providing in memory room database instead of an actual database.

I recommend reading the series from part 1 to have a constructive idea of how the testing architecture is designed and avoid any potential blockers in the implementation.

End-to-End Tests

To better understand how to write end-to-end test cases we’re considering three important features of our EasyTODO application, and these features involve testing…