>adb shell pm list instrumentation(该命令会列出所有已经安装的apk)
instrumentation:com.android.cts.stub/android.content.pm.cts.TestPmInstrumentation (target=android)
instrumentation:com.android.cts.animation/android.test.InstrumentationTestRunner (target=com.android.cts.anima
tion)
instrumentation:com.android.cts.app/android.test.InstrumentationCtsTestRunner (target=com.android.cts.stub)
instrumentation:com.android.cts.os/android.test.InstrumentationCtsTestRunner (target=com.android.cts.stub)
用该命令列出之后,测试单个函数或测试包时要与这里的相对应,如下面的例子所示:
1.cts测试单个函数:
eg:
a.测试testCurrentPlayTime方法
>adb shell am instrument -e class android.animation.cts.ValueAnimatorTest#te
stCurrentPlayTime -w -r com.android.cts.animation/android.test.InstrumentationTestRunner
b.测试testGetMemoryClass方法
>adb shell am instrument -e class android.app.cts.ActivityManagerMemoryClass
Test#testGetMemoryClass -w -r com.android.cts.app/android.test.InstrumentationCtsTestRunner
2.测试整个包
eg:
a.测试Android.animation这个包:
>adb shell am instrument -w -r com.android.cts.animation/android.test.InstrumentationTestRunner
b.测试Android.app这个包:
>adb shell am instrument -w -r com.android.cts.app/android.test.InstrumentationCtsTestRunner