Everytime I try to run my tests the console says this:
Running tests
Test running startedTest running failed: Unable to find instrumentation info for:
ComponentI
I had to do a combination of VikingGlen's answer, Liuting's answer, and this answer. This answer works for Android Studio version 2.1.
Run -> Edit Configurations... -> General -> Specific instrumentation runner (optional): "android.support.test.runner.AndroidJUnitRunner"
In build.gradle
(the one with all your dependencies), put this:
defaultConfig {
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
Then it could run tests of this type:
@RunWith(AndroidJUnit4.class)
@LargeTest
public class ApplicationTest {
@Rule
public ActivityTestRule mActivityTestRule = new ActivityTestRule<>(MainActivity.class);
@Test
public void login() {
//Open Drawer to click on navigation.
onView(withId(R.id.drawer_layout))
.check(matches(isClosed(Gravity.LEFT))) // Left Drawer should be closed.
.perform(open()); // Open Drawer
}
}