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
This is what I noticed in my project, in my app(main) module build.gradle I had the following buildType configuration
buildTypes {
debug {
multiDexEnabled true
}
mock {
initWith(buildTypes.debug)
}
}
testBuildType "mock"
When I used AndroidJUnitRunner as the test runner(both from Android Studio) and as testInstrumentationRunner in build.gradle, tests ran without hitch.
In a submodule that had multiDexEnabled true as defaultConfig
defaultConfig {
multiDexEnabled true
....
}
I ran into the problem of
Test running startedTest running failed: Unable to find instrumentation info for:{mypackage.x.y/android.support.test.runner.AndroidJUnitRunner"}
when I specified AndroidJUnitRunner in IDE and the submodule build.gradle. And this was fixed by specifying MultiDexTestRunner as the test runner in IDE/build.gradle.
To summarize, Use MultiDexTestRunner to run tests when multiDexEnabled true is specified in build.gradle, else use AndroidJUnitRunner as the test runner.