0

我使用 jitpack 创建了远程库。

该库包含这些测试库。

dependencies{
    // test
    testApi 'org.robolectric:robolectric:4.5.1'
    testApi 'junit:junit:4.13.2'
    testApi "androidx.arch.core:core-testing:$archTestingVersion"
    testApi "com.google.dagger:hilt-android-testing:$hilt_version" // For Robolectric tests.
    kaptTest "com.google.dagger:hilt-android-compiler:$hilt_version"

    // androidTest
    androidTestApi 'androidx.test:rules:1.4.0'
    androidTestApi 'androidx.test:runner:1.4.0'
    androidTestApi "androidx.room:room-testing:2.3.0"
    androidTestApi "androidx.test.ext:junit:$androidXTestExtKotlinRunnerVersion"
    androidTestApi "androidx.arch.core:core-testing:$archTestingVersion"
    androidTestApi "androidx.test.espresso:espresso-core:$espressoVersion"
    androidTestApi 'androidx.test.espresso:espresso-contrib:3.4.0'
    androidTestApi "com.google.dagger:hilt-android-testing:$hilt_version" // For instrumented tests.
    kaptAndroidTest "com.google.dagger:hilt-android-compiler:$hilt_version"

}

我正在尝试在导入库后进行测试。

class MyUtilTest {
    @Test
    fun getA() {

    }

    @Test
    fun getB() {
    }
}

但是,test/它似乎无法识别测试库。那么,我该如何解决这个问题呢?

4

0 回答 0