Android Test Orchestrator和自定义Application类

Android Test Orchestrator和自定义Application类,第1张

概述我尝试了 Android Test Orchestrator,如果更改了Application类,它没有看到任何测试.很容易重现. >在Android Studio 3预览Beta 6中使用向导创建简单项目 >创建自定义跑步者: class CustomTestRunner : AndroidJUnitRunner() { override fun newApplication(cl: 我尝试了 Android Test orchestrator,如果更改了Application类,它没有看到任何测试.很容易重现.

>在AndroID Studio 3预览Beta 6中使用向导创建简单项目
>创建自定义跑步者:

class CustomTestRunner : AndroIDJUnitRunner() {      overrIDe fun newApplication(cl: ClassLoader?,classname: String?,context: Context?): Application {       return super.newApplication(cl,TestApplicationClass::class.simplename,context)      }    }

>用新仪器更换仪表转轮
>运行仪器化测试后未找到测试

有任何想法吗?看起来orchestrator依赖于清单中的应用程序类名称.

我使用此配置为测试使用特殊的Dagger依赖项.

解决方法 我有类似的问题,有一个自定义测试运行器.确保TestApplicationClass在运行时不会崩溃.如果自定义运行器崩溃,那么orchestrator将无法获取有关测试的信息,并将返回消息:

没有找到测试.这通常意味着您的测试类不是您的测试运行器期望的形式(例如,不从TestCase继承或缺少@Test注释).

这就是我在自定义跑步者身上发生的事情.

祝好运!

总结

以上是内存溢出为你收集整理的Android Test Orchestrator和自定义Application类全部内容,希望文章能够帮你解决Android Test Orchestrator和自定义Application类所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/1124045.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-30
下一篇2022-05-30

发表评论

登录后才能评论

评论列表(0条)

    保存