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

后端 未结 7 1658
太阳男子
太阳男子 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

    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

提交回复
热议问题