ActivityTestRule is deprecated on android test

Viewed 3064

This is a scope of my instrumented test:

...
import androidx.test.rule.ActivityTestRule

@RunWith(AndroidJUnit4::class)
@LargeTest
class InstrumentDialogFragmentTest {

    @get:Rule
    val activityRule = ActivityTestRule(MainActivity::class.java)
}

My gradle:

androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test:rules:1.4.0'

I'm getting this warning:

'ActivityTestRule<T : Activity!>' is deprecated. Deprecated in Java
1 Answers

You can still use it on 'androidx.test:rules:1.2.0'. It is deprecated on 1.4.0. Use ActivityScenario or ActivityScenarioRule instead.

check more: enter link description here

Related