>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