I have created this android test:
package fr.tisseo.android.repository.productlocalization.tests
import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner
import org.junit.Test
import org.junit.runner.RunWith
@RunWith(AndroidJUnit4ClassRunner::class)
class TodeleteTest {
@Test
fun testTodelete(){
Assert.assertTrue(true)
}
}
I have this gradle configuration:
defaultConfig {
...
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
//Unit testing
testImplementation 'junit:junit:4.13.1'
androidTestImplementation 'androidx.test:runner:1.3.0'
androidTestImplementation 'androidx.test:rules:1.3.0'
When I'm running my test, I have this error:
$ adb shell am instrument -w -r -e debug false -e class 'fr.tisseo.android.repository.productlocalization.tests.TodeleteTest' fr.tisseo.android.debug.test/androidx.test.runner.AndroidJUnitRunner Connected to process 27190 on device 'google-pixel_3-89KX0AP57'.
Started running tests
java.lang.ClassNotFoundException: fr.tisseo.android.repository.productlocalization.tests.TodeleteTest
What did I missed during my implemantation?
I had a similar issue launching the AndroidTest target.
I used Kotlin source code too. Adding
apply plugin: 'kotlin-android'
to the Gradle configuration file solved my issue.