RobolectricGradleTestRunner vs RobolectricTestRunner.class

In roboelectric, when you write your test class, you declare the @RunWith annotation, which has RobolectricGradleTestRunner and RobolectricTestRunner.class. What is the difference and which one should we use? Why, firstly, 2. If I use RobolectricTestRunner, then it does not work for me, this indicates some strange error, for example:

"java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity." 

However, this seems to disappear if I use RobolectricGradleTestRunner.

+6
source share
1 answer

RobolectricTestRunner was the first and designed for maven-based projects.

RobolectricGradleTestRunner was for gradle projects because some ways have changed. Since robolectric 3.1.1 it is no longer necessary and is now deprecated.

See also http://robolectric.org/getting-started/ for more details.

+18
source

All Articles