【发布时间】:2025-12-26 02:55:07
【问题描述】:
但 ExampleInstrumentedTest 正在运行。
这是我的测试文件,我已经注释掉所有内容,留下一个空函数
@RunWith(AndroidJUnit4ClassRunner::class)
class ExploreFragmentTest {
@get: Rule
val activityRule = ActivityScenarioRule(MainActivity::class.java)
@Test
fun test_isSearchButtonDisplayed() {
//onView(withId(R.id.btn_search)).check(matches(isDisplayed()))
}
}
这是我在 app/gradle 中的依赖项
// AndroidX Test - Instrumented testing
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
androidTestImplementation 'androidx.test:rules:1.4.0'
androidTestImplementation 'androidx.test.espresso:espresso-contrib:3.4.0'
仍在寻找答案:如何查看实际的错误信息???
我们可以在错误反馈上做得更好吗?
【问题讨论】:
-
这里也发生了。你发现它是什么了吗?
-
这意味着应用程序在运行测试时崩溃了。在我的例子中,分段分析试图在测试环境中进行网络调用。糟糕的错误信息。
-
谢谢,这很有帮助。我的情况和你的一样。看了 crashlytics 就知道了。
标签: android android-espresso ui-testing