forked from square/dagger
-
Notifications
You must be signed in to change notification settings - Fork 2k
Closed
Labels
Description
I am trying to write UI test using Hilt. When using androidx.test.runner.AndroidJUnitRunner tests always run with status passed or failed but when using mypackage.HiltTestRunner it's always 0 tests passed for any test cases under @HiltAndroidTest. Here is the class I am using to get the AndroidJUnitRunner,
class HiltTestRunner : AndroidJUnitRunner() {
override fun newApplication(cl: ClassLoader?, name: String?, context: Context?): Application {
return super.newApplication(cl, HiltTestApplication::class.java.name, context)
}
}
I included the AndroidJUnitRunner in my gradle like this testInstrumentationRunner = "com.pinwheel.desktop.HiltTestRunner"
To check hilt test integration I am running a sample activity like this,
@HiltAndroidTest
class WarningActivityTest {
@get:Rule(order = 0)
var hiltRule = HiltAndroidRule(this)
@Test
fun check() {
Timber.d("Testing running check")
hiltRule.inject()
val scenario = launchActivity<WarningActivity>()
}
}
Whatever I run it always say 0 tests passed. Here is the screenshoot from android studio bumblebeee,