8 questions
10 votes
3 answers
4k views
GrantPermissionRule stopped working
The GrantPermissionRule that I successfully implemented in my Android app on 1/3/2018 no longer works. When I run my Espresso tests through Android Studio, the emulator blocks waiting for permissions....
3 votes
1 answer
4k views
GrantPermissionRule leads to PermissionException
I've tried today the new android testing support lib. I need the write external storage permission for my tests so I've created the following test with the new GrantPermissionRule. ExternalDirTest....
0 votes
1 answer
91 views
running androidTest folder empty test throws errnoexception
i have an empty android UI test for my MainActivity clas code below. @RunWith(AndroidJUnit4.class) public class MainActivityTest { @Rule public ActivityTestRule<MainActivity> mActivityRule = ...
5 votes
3 answers
2k views
Cannot resolve symbol 'LargeTest'
I am converting all of my tests over to the Testing Support Library. However, when I try to import the LargeTest annotation like this import android.support.test.filters.LargeTest; I get Cannot ...
11 votes
4 answers
10k views
Destroy and restart Activity with Testing Support Library
Using the old JUnit3-style tests in Android, I could do the following to destory and restart an activity: Instrumentation inst = getInstrumentation(); Activity activity = inst.getActivity(); // do ...
9 votes
1 answer
1k views
Parameterized Instrumented Tests for Android
The answer to AndroidJUnit4 and Parameterized tests links to a Google example for using @RunWith(Parameterized.class). However, this is a simple unit test. How do I run parameterized instrumented ...
2 votes
1 answer
2k views
Testing AutoCompleteTextView with Espresso
I am using Espresso to test an app with several AutoCompleteTextViews. For one particular test, the autocomplete popup appears, but I want to just ignore it and move to the next TextView. How can I do ...
162 votes
21 answers
87k views
Cannot resolve symbol 'AndroidJUnit4'
Obviously I need the correct import statment to solve this problem. According to the docs for AndroidJUnit4, this should be import android.support.test.runner.AndroidJUnit4; When I do that, Android ...