Shalom Halbert
11/27/2021, 1:28 PMloadModules
and unloadModules
, which worked…until I found out it that the module didn’t load before tests started. That yielded test failures that were difficult to debug.
The solution, that doesn’t require test code in production code, was to:
1. Create a new class that extends the production Application
class, let’s call the child InstrumentedTestApplication
2. In InstrumentedTestApplication
, override the list of modules provided in `startKoin`’s modules
declaration to include a testModule
3. Create a new class that extends AndroidJunitRunner
, let’s call it InstrumentedTestJunitRunner
that will instantiate InstrumentedTestApplication
4. Point testInstrumentationRunner
in the app-level build.gradle to InstrumentedTestJunitRunner
Is this something that is in the Koin documentation, and I missed it? If not, is there interest in having it added?arnaud.giuliani
12/02/2021, 8:59 AMShalom Halbert
12/13/2021, 5:05 PMarnaud.giuliani
12/14/2021, 9:03 AMShalom Halbert
12/15/2021, 5:39 PMarnaud.giuliani
12/16/2021, 10:57 AM