小编Jok*_*oks的帖子

无法使用 RobolectricTestRunner 和 Koin 运行单元测试

我有一个RobolectricTestRunner用于获取应用程序上下文的测试类,并且我使用KoinComponent. 当我开始我的测试时,它返回java.lang.IllegalStateException: KoinApplication has not been started并指向我的扩展KoinComponent. 我尝试setUp()通过加载模块的方法启动 Koin并删除了 Robolectric,但以这种方式它找不到应用程序上下文。有没有办法用 Robolectric 和 Koin 编写单元测试?

android unit-testing robolectric koin

5
推荐指数
1
解决办法
1233
查看次数

标签 统计

android ×1

koin ×1

robolectric ×1

unit-testing ×1