I have an Espresso test suite for UI tests that looks like this:
@RunWith(AndroidJUnit4.class)
public class SpecialUiTests {
@Rule
public final ActivityTestRule<SpecialActivity> activity
= new ActivityTestRule<>(SpecialActivity.class);
@Test
public void specialTest() {
...
}
...
}
The problem is, that activity expects a bundle, and crashes when it can't find the value it expects
public class SpecialActivity extends Activity {
protected void onCreate(Bundle savedInstanceState) {
final String specialValue = getIntent().getBundleExtra(ARG_SPECIAL_BUNDLE)
.getString(KEY_SPECIAL_VALUE);
//Do something with specialValue <--- Crash
}
...
}
Can I set up a test rule and still pass the parameter (a bundle) the activity expects?