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
When I created a new package, Studio created an ApplicationTest class. Using us.myname.mypackage as an example, the following directory structure was created:
app/[myPackage]/src/androidTest/java/us/myname/mypackage/ApplicationTest.class
Initially it worked out of the box. It quit working after I installed product flavors. I subsequently made the following changes to build.gradle:
defaultConfig {
...
testInstrumentationRunner "android.test.InstrumentationTestRunner"
}
some prefer
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
(With my current configuration, I have to use ...InstrumentationTestRunner
when in debug, and AndroidJUnitRunner
while using release build type.)
The above configuration only works with the debug build type. If you wish to use it with release or with a custom build type, you can include the following in build.gradle:
buildTypes {
release {
...
}
debug {
...
}
}
testBuildType "release"
In the Build Variants tab on the lower left side of Studio, make sure you have Android Instrumentation Tests
and the correct buildType
selected.