我正在尝试将Google Truth框架包含在我的项目中进行测试。我遵循了有关如何进行项目设置的文档。
这来自我的应用程序的build.gradle文件:
dependencies {
...
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.2-alpha01'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.2-alpha01'
androidTestImplementation 'androidx.test.ext:truth:1.1.0'
androidTestImplementation 'com.google.truth:truth:0.43'
}
Run Code Online (Sandbox Code Playgroud)
同步过程成功完成。
然后,我尝试运行本地单元测试,例如:
import org.junit.Test
import com.google.common.truth.Truth.*
class CustomExampleUnitTest {
@Test
fun testBlank_isCorrect() {
assertThat("".isBlank()).isTrue()
}
}
Run Code Online (Sandbox Code Playgroud)
我收到Kotlin编译器错误:无法解析的参考:真相
有几件事要注意:
因此,在完成上述步骤之后,我尝试运行测试,但仍然遇到未解决的问题。
任何人都可以尝试阐明这一点吗?有没有人遇到这个。我真的很感谢任何帮助!
google-truth ×1