Ada*_*itz 4 junit android junit4 kotlin android-testing
导入库,比如androidx.test:core:1.2.0
,androidx.test.ext:truth:1.2.0
,com.google.truth:truth:0.44
,等进入当地的JUnit命名测试类ExampleUnitTest.kt。
未解决的参考:测试
示例UnitTest.kt
import androidx.test.core.app.ApplicationProvider.getApplicationContext
import com.google.common.truth.Truth.assertThat
Run Code Online (Sandbox Code Playgroud)
Ada*_*itz 20
这似乎是Android 测试代码实验室示例应用中记录的问题。
在 Codelab 示例build.gradle 中,这被称为已知问题。
// Once https://issuetracker.google.com/127986458 is fixed this can be testImplementation
implementation "androidx.test:core:$androidXTestCoreVersion"
Run Code Online (Sandbox Code Playgroud)
我重构了我的应用程序的依赖项testImplementation
而不是androidTestImplementation
.
testImplementation 'androidx.test:core:1.2.0'
testImplementation 'androidx.test.ext:truth:1.2.0'
testImplementation 'com.google.truth:truth:0.44'
Run Code Online (Sandbox Code Playgroud)
注-应更新Google 文档为 AndroidX 测试设置项目以反映此问题,因为它当前指示开发人员使用androidTestImplementation
. 我已经提交了一个文档问题来解决这个问题。
归档时间: |
|
查看次数: |
5661 次 |
最近记录: |