Development issue/problem:
I’m trying to get the espresso tests, but I keep getting this error message:
INSTRUMENTATION_STATUS : Error = No information about the device can be found: ComponentInfo{com.mikeestrada.test/android.test.InstrumentationTestRunner}
It worked once, but I can’t seem to recover the reports properly. They were left empty, without checking anything.
I’ve tried many orders, including
adb shell am tool -w -r com.mikeestrada.test/android.test.instrumentationTestRunner
и
adb shell am tool -w -r com.mikeestrada.test/com.google.android.apps.common.testing.runner.GoogleInstrumentation TestRunner
Here are my code snippets:
com.mikeestrada.test.package ;
import android.test.ActivityInstrumentationTestCase2;
import android.test.ActivityUnitTestCase;
import android.test.AndroidTestCase;
import android.test.suitebuilder.annotation.LargeTest;
import android.view.view. Look, um..;
import.example.myapplication.MainActivity;
import.example.myapplication.R;
import.google.android.apps.common.test.ui.espresso.Espresso;
import.google.android.apps.common.test.ui.espresso.ViewAssertion;
import.google.android.apps.common.testing.ui.test.ui.espresso.ViewInteraction;
import com.google.android.apps.common.testresults;
import com.google.android apps.common.testresults.ui.espresso assertion.ViewAssertions;
import com.google.android.apps.common.testresults.viewMatchers;
import junit.framework.Assert ;
import org.hamcrest.Matcher ;
The TestStartScreen public class extends the ActivityInstrumentationTestCase2 {
public TestStartup() {
super(MainActivity.class);
}
@LargeTestpublic void testHelloWorld(final Matcher viewMatcher) {// Find/ Find Button/Interaction button1 = onView(ViewMatchers.withId(R.id.button1)); // Find ButtonViewInteraction helloWorldText = Espresso.onView(ViewMatchers.withText(Hello world !)); // Find Text
// action
//button1.perform(ViewActions.click()); // button
helloWorldText.perform(ViewActions.typeText(Bye World!));
Espresso.onView(ViewMatchers.withText(R.id.withText))
// Check
helloWorldText.check(ViewAssertions.matches((ViewMatchers.isDisplayed()))); // The hello text is hidden.
//Espresso.onView(withId(R.id.my_view)).check(withText(Hello World !))));
}
}
build {
repositories {
mavenCentral()
}
dependencies {
classpath ‘com.android.tools.build:gradle:0.7.+’
}
}
application plugin : android
Deposits {
mavenCentral()
}
android {
compileSdkVersion 19
buildToolsVersion 19.0.0
defaultConfig {
minSdkVersion 7
targetSdkVersion 19
}
compileOptions {
sourceJavaVersion.VERSION_1_7
targetJavaVersion.VERSION_1_7
compatibility }
sourceSet {
main {
manifest.srcFile AndroidManifest.xml
assets.srcDirs = [‘assets’]
}
}
} } }
dependencies {
compile ‘com.android.support:appcompat-v7:+’
instrumentTestCompile files (‘libs/espresso-1.1-bundled.jar’)
}
android { default
Config {
testInstrumentationRunner com.google.android.apps.common.testrunner.GoogleInstrumentationTestRunner
}
} Task wrapper
(type: wrapper) {
gradlerVersion = ‘1.9’
}
If it means anything – the manifest attributes are colored red, as if IntelliJ doesn’t recognize them.
Any help is welcome, thank you!
How can I solve this problem?
Solution 1:
You need to check which device packages are installed on your device:
Party equipment
Check if com.mikeestrada.test is actually listed there.
Solution 2:
If the device package is missing, install it with the following command:
$ gradle :{$project}:installDebugAndroidTest
Solution 3:
If you look at your build.gradle file, the problem is actually that you do not have the following configuration under defaultConfig :
testInstrumentationRunner com.google.android.apps.common.testrunner.GoogleInstrumentationTestRunner
Espresso needs GoogleInstrumentationTestRunner to run.
Even with the layered build system, you don’t need the AndroidManifest.xml file for the test project because it’s automatically generated.
Solution 4:
Also, it looks like your application is com.mikeestrada.
So, in AndroidManifest, define android:targetPackage as android:targetPackage=com.mikeestrada.
I hope this helps.
Solution no. 5:
The problem is that you don’t have enough room:
Instrumentation and android: title
must
Instrumentation and android: name
Solution no. 6:
https://developer.android.com/studio/test/command-line
It looks like you need to make sure the application and test applications are installed.
Good luck!
Related Tags:
testinstrumentationrunnerarguments, android instrumentation test, adb shell am instrument, unit testing android studio, test running failed: unable to find instrumentation info for: componentinfo, android.util.androidexception: instrumentation_failed, instrumentation_status: error=unable to find instrumentation target package:, onerror: commanderror=true message=instrumentation_failed, instrumentation_result: shortmsg=process crashed.