1

I am migrating a quite extensive app with many instrumented tests in it.

The way the app is structured is:

// in the main sources
open class MainApp {
    open val appComponent: ApplicationComponent = DaggerApplicationComponent.factory...
}

// in the test sources
class TestApp: MainApp {
    override val appComponent: ApplicationComponent = DaggerTestApplicationComponent.factory...
}

and of course TestApplicationComponent implements ApplicationComponent.

The main component had a lot of sub-modules, and by following the guide on how to migrate the app by creating an aggregator entry point, everything compiles and works more than fine.

The missing piece is the TestApp, and that is the main subject of this issue. Is there a way to migrate (partially) the TestApp so that I simply can run the tests as they were, and in future I will migrate it to use either CustomTestApplication or HiltTestApplication?

As an initial stage of our migration, I don't need @HiltAndroidTest to be usable: I just need the old tests to be runnable like they were on Dagger 2.

This question has been raised also as an issue at https://github.com/google/dagger/issues/2757.

Alex Facciorusso
  • 2,290
  • 3
  • 21
  • 34
  • 1
    hey @Alex Facciorusso, since this question was almost a year old, wondering if you were able to figure a way to gradually migrating to Hilt Tests? – praveen_85 May 20 '22 at 00:37

0 Answers0