TestNavHostController is not found

Viewed 8

I'm learning Kotlin using free course which android studio itself provides. I'm stuck at a place that I'm supposed to test the navigations (according to this). The issue is I'm not getting the TestNavHostController down in this code and gets the wavey red underlined. (When I type TestNavHo..., I get no suggestion like it's not even there)

@RunWith(AndroidJUnit4::class)
class NavigationTests {
    @Test
    fun navigate_to_words_nav_component() {
        val navController = TestNavHostController
        )
    }
}

I added these dependencies as I was told by course

implementation "androidx.core:core-ktx:$core_ktx_version"
implementation "androidx.appcompat:appcompat:$appcompat_version"
implementation "com.google.android.material:material:$material_version"
implementation "androidx.navigation:navigation-fragment-ktx:$nav_version"
implementation "androidx.navigation:navigation-ui-ktx:$nav_version"
implementation "androidx.constraintlayout:constraintlayout:$constraintlayout_version"

androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
androidTestImplementation 'com.android.support.test.espresso:espresso-contrib:3.4.0'
androidTestImplementation "androidx.navigation:navigation-testing:$nav_version"
androidTestImplementation 'junit:junit:4.13.2'

debugImplementation 'androidx.fragment:fragment-testing:1.4.1'

How am I supposed to get this class working?

0 Answers
Related