我创建了这个 android 测试:
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)
}
}
我有这个gradle配置:
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'
当我运行我的测试时,我有这个错误:
$ 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 连接到在设备“google-pixel_3-89KX0AP57”上处理 27190。
开始运行测试
java.lang.ClassNotFoundException:fr.tisseo.android.repository.productlocalization.tests.TodeleteTest
我在实施过程中遗漏了什么?