I\'m learning android instrumentation testing with espresso. I have an app which has a drawer menu and there is a menu called About. I was testing click on that menu item and co
I had the same problem and solved it by using IntentsTestRule
instead of ActivityTestRule
. IntentsTestRule
is a subclass of ActivityTestRule
. Set up your @Rule
which creates the activity like so:
@Rule
public IntentsTestRule mActivity = new IntentsTestRule(MyActivity.class) {
@Override
protected Intent getActivityIntent() {
...
}
};
See the following project for more information: https://github.com/googlesamples/android-testing/tree/master/ui/espresso/IntentsBasicSample