我正在 Android Studio 中学习 Kotlin 初学者课程 - 在测试阶段,检测结果总是0/0。我怎样才能完成这些测试?
代码由 Google Android 开发人员编写,应该可以完美运行。 (我用的是同样的)。应用程序编译没有错误。代码在这里:https://github.com/google-developer-training/android-basics-kotlin-words-app
我尝试了各种解决方案:
- Espresso 测试未在 Android 12 上运行
- Android 仪器测试 未找到测试
- 将 gradle 和所有内容升级到最新版本。
- 在 Pixel 2 和 Pixel 3 模拟器上尝试过
这可能与 Android Studio 版本 Bumblebee 或模拟器中阻止测试的某些设置有关。我怀疑这一点,因为在创建以前的应用程序时,在测试阶段发生了同样的事情(测试结果0/0)
测试结果说:
05/04 21:06:18:在 Pixel 3 API 29 上启动“navigate_to_words_...()”。
应用程序重新启动成功,无需重新安装。
运行测试
$ adb shell am Instrument -w -m -e debug false -e class 'com.example.wordsapp.NavigationTests#navigate_to_words_nav_component' com.example.wordsapp.test/android.support.test.runner.AndroidJUnitRunner
连接到设备“Pixel_3_API_29 [emulator-5556]”上的进程 10870。>
您对此有何看法?感谢您的时间!
只看原作build.gradle- 您使用了错误的测试运行程序:
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)