无法找到以下内容的检测信息:ComponentInfo {../ android.support.test.runner.AndroidJUnitRunner}

时间:2018-02-01 13:04:53

标签: android android-instrumentation android-junit androidjunitrunner

我编写了一个简单的Android工具测试用例来测试网络操作。

Test case class name: Main3ActivityTest.java
Method name:addNewEmployee

我使用命令行运行我的测试用例然后我遇到了异常。

Command:
./adb -s emulator-5554 shell am instrument -w -r -e class murali.myapplication.Main3ActivityTest#addNewEmployee murali.myapplication.test/android.support.test.runner.AndroidJUnitRunner

Issue:
INSTRUMENTATION_STATUS: id=ActivityManagerService
    INSTRUMENTATION_STATUS: Error=Unable to find instrumentation info for: ComponentInfo{murali.myapplication.test/android.support.test.runner.AndroidJUnitRunner}
    INSTRUMENTATION_STATUS_CODE: -1
    android.util.AndroidException: INSTRUMENTATION_FAILED: murali.myapplication.test/android.support.test.runner.AndroidJUnitRunner
        at com.android.commands.am.Am.runInstrument(Am.java:1093)
        at com.android.commands.am.Am.onRun(Am.java:371)
        at com.android.internal.os.BaseCommand.run(BaseCommand.java:47)
        at com.android.commands.am.Am.main(Am.java:100)
        at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
        at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:251)

在检测列表中找不到我的测试用例(murali.myapplication.Main3ActivityTest):

$ ./adb -s emulator-5554 shell pm list instrumentation
instrumentation:com.android.emulator.smoketests/android.support.test.runner.AndroidJUnitRunner (target=com.android.emulator.smoketests)
instrumentation:com.android.smoketest.tests/com.android.smoketest.SmokeTestRunner (target=com.android.smoketest)
instrumentation:com.example.android.apis/.app.LocalSampleInstrumentation (target=com.example.android.apis)

我添加了testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

请帮我解决问题?

1 个答案:

答案 0 :(得分:1)

好像您尚未安装该应用- 使用以下命令安装应用程序:

$adb shell pm install -r <directory/apk_name> 

随后您将能够看到正在运行的仪器

$adb shell pm list instrumentation