我尝试了Android Test Orchestrator,如果更改了Application类,它看不到任何测试。很容易重现。
class CustomTestRunner : AndroidJUnitRunner() {
override fun newApplication(cl: ClassLoader?, className: String?, context: Context?): Application {
return super.newApplication(cl, TestApplicationClass::class.simpleName, context)
}
}
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?看起来 Orchestrator 依赖于清单中的应用程序类名。
我使用此配置来使用特殊的 Dagger 依赖项进行测试。
我有一个类似的问题,使用自定义测试运行程序。确保你的程序TestApplicationClass在运行时不会崩溃。如果自定义运行器崩溃,则 Orchestrator 将无法获取有关测试的信息,并将返回消息:
No tests found. This usually means that your test classes are not in the form that your test runner expects (e.g. don't inherit from TestCase or lack @Test annotations).
这就是我在定制跑步机中发生的事情。
祝你好运!
| 归档时间: |
|
| 查看次数: |
441 次 |
| 最近记录: |