C:/Users/Administrator>adb shell am instrument -e class com.xmobileapp.hello.tes
ts.HelloTest -w com.xmobileapp.hello/android.test.InstrumentationTestRunner com.
xmobileapp.hello.tests.HelloTest
Can't dispatch DDM chunk 46454154: no handler defined
Can't dispatch DDM chunk 4d505251: no handler defined
com.xmobileapp.hello.tests.HelloTest:.
Test results for InstrumentationTestRunner=.
Time: 5.19
第一部分:
adb shell am instrument
声明要进行测试
第二部分:
-e class com.xmobileapp.hello.tes
ts.HelloTest
声明进行测试的是HelloTest.java中的全部测试项
第三部分:
-w com.xmobileapp.hello/android.test.InstrumentationTestRunner com.
xmobileapp.hello.tests.HelloTest
前部分为AndroidManifest.xml中声明的targetPackage名称,后部分是Instrumentation自身的名称(类名)
如果只想测试类中某个函数,则在第二部分末尾添加#方法名(一般为test开头的 public void 方法)