You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In some JUnit tests, I would like to use the test runner Enclosed for nice grouping of tests in a file (and do be able to use a clean whenXYZ, shouldABC naming convention).
Would it be possible to do the same in Robo? If so, how would I go about it? Do I need to create a custom test runner ala ParameterizedRobolectricTestRunner?
The text was updated successfully, but these errors were encountered:
It's pretty much the same as using the Enclosed test runner on its own. You just have to add @RunWith(RobolectrTestRunner.class) to one of the static inner classes. Here's an example of how you would do this.
@RunWith(Enclosed.class)
public class FooServiceTest {
// All tests will need to extend this one
@Ignore
@RunWith(RobolectricTestRunner.class)
@Config(constants = BuildConfig.class)
public abstract static class GivenRobolectricContext {
ServiceController<FooService> serviceController;
@Before
public void givenRobolectricContext() {
serviceController = Robolectric.buildService(FooService.class).create();
}
}
public static class GivenFooService extends GivenRobolectricContext {
// put your context specific tests here.
}
}
In some JUnit tests, I would like to use the test runner Enclosed for nice grouping of tests in a file (and do be able to use a clean whenXYZ, shouldABC naming convention).
Would it be possible to do the same in Robo? If so, how would I go about it? Do I need to create a custom test runner ala ParameterizedRobolectricTestRunner?
The text was updated successfully, but these errors were encountered: