【发布时间】:2022-01-11 20:46:16
【问题描述】:
我正在尝试在 AS Arctic Fox 2020.3.1 Patch 3 ARM 预览版上使用 espresso 运行一些 UI 测试。按照 Google 说明设置这些是我的依赖项:
// Core library
androidTestImplementation 'androidx.test:core:1.4.0'
// AndroidJUnitRunner and JUnit Rules
androidTestImplementation 'androidx.test:runner:1.4.0'
androidTestImplementation 'androidx.test:rules:1.4.0'
androidTestUtil 'androidx.test:orchestrator:1.4.0'
// Assertions
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.ext:truth:1.4.0'
androidTestImplementation 'com.google.truth:truth:1.0.1'
// Espresso dependencies
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
androidTestImplementation 'androidx.test.espresso:espresso-contrib:3.4.0'
androidTestImplementation 'androidx.test.espresso:espresso-intents:3.4.0'
androidTestImplementation 'androidx.test.espresso:espresso-accessibility:3.4.0'
androidTestImplementation 'androidx.test.espresso:espresso-web:3.4.0'
androidTestImplementation 'androidx.test.espresso.idling:idling-concurrent:3.4.0'
我还在 Gradle 中将 testInstrumentationRunner 添加到 testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
我正在尝试运行以下最简单的测试:
import androidx.test.ext.junit.runners.AndroidJUnit4
import org.junit.Test
import org.junit.runner.RunWith
@RunWith(AndroidJUnit4::class)
class DummyTest {
@Test
fun test() {
assert(false)
}
}
但是当我单击运行我的测试时,看起来我有 0 个测试。有什么我想念的吗?谢谢
【问题讨论】:
-
我也遇到了同样的问题。
-
@Mona101ma 检查更新的答案
标签: android automated-tests android-espresso android-testing