我尝试了 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)
}
}
有什么想法吗?看起来Orchestrator依赖于清单中的应用程序类名称。
我使用此配置为测试使用特殊的Dagger依赖项。
答案 0 :(得分:0)
我有类似的问题,有一个自定义测试运行器。确保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).
这就是我的自定义选手中发生的事情。
祝你好运!