從現有 APK 執行檢測設備測試

這些操作說明假設您已在本地取得 Trade Federation 套件;如果沒有,請按照下載操作說明取得。

然後使用下列指令安裝插樁測試的 APK、執行測試,並顯示正在執行的測試:

./tradefed.sh run instrumentations --apk-path <path of your apk>

輸出內容類似如下:

07-17 10:55:32 D/InvocationToJUnitResultForwarder: Starting test: android.animation.cts.ValueAnimatorTest#testOfArgb
07-17 10:55:33 D/InvocationToJUnitResultForwarder: Starting test: android.animation.cts.ValueAnimatorTest#testIsRunning
07-17 10:55:34 D/InvocationToJUnitResultForwarder: Starting test: android.animation.cts.ValueAnimatorTest#testGetCurrentPlayTime
07-17 10:55:35 D/InvocationToJUnitResultForwarder: Starting test: android.animation.cts.ValueAnimatorTest#testStartDelay
07-17 10:55:35 I/InvocationToJUnitResultForwarder: Run ended in 2m 20s

您可以選擇指定要針對特定裝置執行的 --serial <device serial number>。你可以使用 adb devices 取得裝置序號。

如要進一步瞭解 Tradefed 執行作業,請參閱「透過 Tradefed 進行測試」一節。