RobolectricGradleTestRunner 对比 RobolectricTestRunner.class
RobolectricGradleTestRunner vs RobolectricTestRunner.class
在 roboelectric 中编写测试时 class 您已经声明了 @RunWith 注释,其中有 RobolectricGradleTestRunner 和 RobolectricTestRunner.class。有什么区别,我们应该使用哪一个?为什么首先有2个。如果我使用 RobolectricTestRunner,那么它对我不起作用,它会显示一些奇怪的错误,例如:
"java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity."
不过,如果我使用 RobolectricGradleTestRunner,这似乎就会消失。
RobolectricTestRunner 是第一个,用于基于 maven 的项目。
RobolectricGradleTestRunner 适用于基于 gradle 的项目,因为某些路径已更改。
自 robolectric 3.1.1 以来,这不再是必需的,现在已弃用。
有关详细信息,另请参阅 http://robolectric.org/getting-started/
在 roboelectric 中编写测试时 class 您已经声明了 @RunWith 注释,其中有 RobolectricGradleTestRunner 和 RobolectricTestRunner.class。有什么区别,我们应该使用哪一个?为什么首先有2个。如果我使用 RobolectricTestRunner,那么它对我不起作用,它会显示一些奇怪的错误,例如:
"java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity."
不过,如果我使用 RobolectricGradleTestRunner,这似乎就会消失。
RobolectricTestRunner 是第一个,用于基于 maven 的项目。
RobolectricGradleTestRunner 适用于基于 gradle 的项目,因为某些路径已更改。 自 robolectric 3.1.1 以来,这不再是必需的,现在已弃用。
有关详细信息,另请参阅 http://robolectric.org/getting-started/