Sign in Go Pro

Dependency Injection in Android using Kodein

Injecting Mocks on your UI tests

This lesson is for PRO members.

Upgrade today to get access to all the PRO lessons.

Unlock this lesson



On previous lesson, we learned how to inject mocks at any level of our architecture using Kodein binding overrides, which is a key feature. On this one, and given that we are going to be writing UI tests, we will learn:

  • Since Android has a strong IoC (Inversion of Control), we will learn how to override dependencies at Application and Activity scopes by shortcutting binding overrides through the application class from our testing environments.
  • How to mock dependencies at any arbitrary level of depth in our dependency tree and use the production ones for the rest of the pieces involved.
  • Write neat UI tests using this system.


There are no comments on this lesson, start the conversation below ...


Lessons in Dependency Injection in Android using Kodein