纯粹做个笔记
root@hammerhead:/data/local/tmp #uiautomator runtest /data/local/tmp/appsimulation.jar -c com.dkxy.appsimulation.AppSimulationTestCase#main INSTRUMENTATION_STATUS: numtests=1 INSTRUMENTATION_STATUS: stream= com.dkxy.appsimulation.AppSimulationTestCase: INSTRUMENTATION_STATUS: id=UiAutomatorTestRunner INSTRUMENTATION_STATUS: test=main INSTRUMENTATION_STATUS: class=com.dkxy.appsimulation.AppSimulationTestCase INSTRUMENTATION_STATUS: current=1 INSTRUMENTATION_STATUS_CODE: 1 INSTRUMENTATION_STATUS: numtests=1 INSTRUMENTATION_STATUS: stream= Error in main: java.lang.NoClassDefFoundError: com.dkxy.appsimulationcommon.BaseSimulation at com.dkxy.appsimulation.AppSimulationTestCase.main(AppSimulationTestCase.java:22) at java.lang.reflect.Method.invokeNative(Native Method) at com.android.uiautomator.testrunner.UiAutomatorTestRunner.start(UiAutomatorTestRunner.java:160) at com.android.uiautomator.testrunner.UiAutomatorTestRunner.run(UiAutomatorTestRunner.java:96) at com.android.commands.uiautomator.RunTestCommand.run(RunTestCommand.java:91) at com.android.commands.uiautomator.Launcher.main(Launcher.java:83) at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method) at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:243) at dalvik.system.NativeStart.main(Native Method) INSTRUMENTATION_STATUS: id=UiAutomatorTestRunner INSTRUMENTATION_STATUS: test=main INSTRUMENTATION_STATUS: class=com.dkxy.appsimulation.AppSimulationTestCase INSTRUMENTATION_STATUS: stack=java.lang.NoClassDefFoundError: com.dkxy.appsimulationcommon.BaseSimulation at com.dkxy.appsimulation.AppSimulationTestCase.main(AppSimulationTestCase.java:22) at java.lang.reflect.Method.invokeNative(Native Method) at com.android.uiautomator.testrunner.UiAutomatorTestRunner.start(UiAutomatorTestRunner.java:160) at com.android.uiautomator.testrunner.UiAutomatorTestRunner.run(UiAutomatorTestRunner.java:96) at com.android.commands.uiautomator.RunTestCommand.run(RunTestCommand.java:91) at com.android.commands.uiautomator.Launcher.main(Launcher.java:83) at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method) at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:243) at dalvik.system.NativeStart.main(Native Method) INSTRUMENTATION_STATUS: current=1 INSTRUMENTATION_STATUS_CODE: -1 INSTRUMENTATION_STATUS: stream= Test results for WatcherResultPrinter=.E Time: 0.053 FAILURES!!! Tests run: 1,Failures: 0,Errors: 1 INSTRUMENTATION_STATUS_CODE: -1
比较奇葩的是,通过adb shell执行的命令没有任何的提示
C:\Users\win10>adb shell "uiautomator runtest /data/local/tmp/appsimulation.jar -c com.dkxy.appsimulation.AppSimulationTestCase" INSTRUMENTATION_STATUS: stream= Test results for WatcherResultPrinter= Time: 0.007 OK (0 tests) INSTRUMENTATION_STATUS_CODE: -1
实际有效命令:
uiautomator runtest /data/local/tmp/appsimulation.jar /data/local/tmp/appsimulationcommon.jar -c com.dkxy.appsimulation.AppSimulationTestCase#main