Questions tagged [testing-support-library]

Library for automated tests in Android

The Android Testing Support Library provides tools for automated unit, functional, and integration tests.

8 questions
158
votes
19 answers

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 Studio highlights runner in red and complains…
11
votes
4 answers

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…
Code-Apprentice
  • 81,660
  • 23
  • 145
  • 268
10
votes
3 answers

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. However, when I run the tests from the command…
Michael Osofsky
  • 11,429
  • 16
  • 68
  • 113
9
votes
1 answer

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 tests?
5
votes
3 answers

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 resolve symbol 'LargeTest'. What dependency do I need…
Code-Apprentice
  • 81,660
  • 23
  • 145
  • 268
2
votes
1 answer

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.java @Rule public GrantPermissionRule…
user3166372
  • 158
  • 2
  • 10
2
votes
1 answer

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 this? My ideas are to either simulate a "Back"…
0
votes
1 answer

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 mActivityRule = new ActivityTestRule<>( MainActivity.class); …
filthy_wizard
  • 740
  • 11
  • 25