我最近将我的项目迁移到使用 AndroidX,并使用以下文档为 gradle 上的 espresso 测试配置了测试编排器:
https://developer.android.com/training/testing/junit-runner#using-android-test-orchestrator https://developer.android.com/training/testing/junit-runner#using-android-test-orchestrator
我有依赖性:
androidTestUtil 'androidx.test:orchestrator:1.1.0-beta01'
然而,我的测试都没有被执行,并且在运行 gradle 时运行以下 adb shell 命令时看起来它们失败了,即:
adb shell 'CLASSPATH=$(pm path android.support.test.services) app_process / \
android.support.test.services.shellexecutor.ShellMain am instrument -w -e \
targetInstrumentation com.example.test/androidx.test.runner.AndroidJUnitRunner \
android.support.test.orchestrator/.AndroidTestOrchestrator'
从上面的内容来看:它似乎正在尝试使用 android 支持版本而不是 androidx 版本执行此命令。
似乎没有任何地方记录 androidx 使用什么。
纯粹通过猜测,我在我的 gradle 配置中更改了以下内容
from:
testOptions {
execution 'ANDROID_TEST_ORCHESTRATOR'
}
to
testOptions {
execution 'ANDROIDX_TEST_ORCHESTRATOR'
}
一切似乎都有效。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)