I'm following the dev guide here:
https://developer.android.com/guide/components/activities/testing
and have a test class like:
@RunWith(AndroidJUnit4::class)
class MyTestSuite {
@get:Rule var activityScenarioRule = activityScenarioRule<MyActivity>()
@Test fun testEvent() {
val scenario = activityScenarioRule.scenario
}
}
the method activityScenarioRule<T>()
is not defined. What dependency do I need? Also, what is the best way to determine which dependencies to add when reading these docs?
The activityScenarioRule<T>()
method is part of the androidx.test.ext:junit-ktx:1.1.0
dependency.
Usually, this would be listed under the List of AndroidX Test dependencies, but it appears it isn't up to date with the junit-ktx
or core-ktx
modules as of yet, despite it being explicitly mentioned as part of the Version 1.1.0-beta01 release notes