Error=Unable to find instrumentation info for: ComponentInfo{ }

后端 未结 7 1489
太阳男子
太阳男子 2021-01-31 15:00

I am trying to stand up espresso tests but I keep getting this error:

INSTRUMENTATION_STATUS: Error=Unable to find instrumentation info for: ComponentInfo{com.mi         


        
相关标签:
7条回答
  • 2021-01-31 15:36

    If the instrumentation package is missing install it with the following command:

    $ gradle :{$project}:installDebugAndroidTest
    

    0 讨论(0)
  • 2021-01-31 15:36

    To correctly run instrumentation testing, follow these instructions:

    1. Install the base package on device/emulator. For example if you want to test devDebug {flavorBuildType} combination, execute ./gradlew installDevDebug. Replace devDebug string with flavor and buildType you have in your project.

    2. Install the test package on device/emulator. If you installed devDebug now execute ./gradlew installDevDebugAndroidTest, by default this will install the base package adding the .test suffix

    3. Verify instrumentation is correctly installed, running adb shell pm list instrumentation it should print a line with your test package and the available runner, something like: androidx.test.runner.AndroidJUnitRunner

    4. Launch the instrumentation test. For example if you want to test a single test class from your package, you can go with this: adb shell am instrument -w -e class com.your.base.package.MyClassTest com.your.base.package.test/androidx.test.runner.AndroidJUnitRunner. Check the doc here for all the available options

    5. Optional: After tests have been completed you can uninstall the packages with ./gradlew uninstallDevDebug uninstallDevDebugAndroidTest

    0 讨论(0)
  • 2021-01-31 15:41

    Also, looks like yours app package is com.mikeestrada. So in AndroidManifest set android:targetPackage as android:targetPackage="com.mikeestrada".

    I hope this will help.

    0 讨论(0)
  • 2021-01-31 15:42

    https://developer.android.com/studio/test/command-line

    Looks like you need to make sure you app and test apks are installed.

    0 讨论(0)
  • 2021-01-31 15:49

    You need to check which instrumentation packages have been installed on your device:

     adb shell pm list instrumentation
    

    Then verify whether com.mikeestrada.test is actually listed there.

    0 讨论(0)
  • 2021-01-31 15:50

    The issue is that you are missing a space:

    instrumentationandroid:name
    

    should be

    instrumentation android:name
    
    0 讨论(0)
提交回复
热议问题