dimanche 2 décembre 2018

Custom runner class AndroidJUnit4 should have a public constructor with signature AndroidJUnit4(Class testClass)

After launching my instrumented test, recorded via Espresso Test Recording, i get this error.

"Custom runner class AndroidJUnit4 should have a public constructor with signature AndroidJUnit4(Class testClass)"

I tried to resolve it by adding following dependancies to gradle:

androidTestCompile 'androidx.test:runner:1.1.0'
    androidTestCompile 'androidx.test:rules:1.1.0'
    // Optional -- Hamcrest library
    androidTestImplementation 'org.hamcrest:hamcrest-library:1.3'
    // Optional -- UI testing with Espresso
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
    // Optional -- UI testing with UI Automator
    androidTestImplementation 'androidx.test.uiautomator:uiautomator:2.2.0'

and also android section

android{
    useLibrary 'android.test.mock'
    defaultConfig {
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
}

My tests are placed inside androidTest folder. What should I do to solve my issue?

Aucun commentaire:

Enregistrer un commentaire