用一套方法論去設計許多方法來解決工程上遇到的問題。 即 "一生萬法、萬法圓通"。

Recent in Recipes

3/Food/post-list

從命令列啟動uiautomator

沒有留言

從命令列啟動uiautomator

事先用AS先把測試代碼寫好,編成apk,然後安裝到手機上。

接下來可以透過command line啟動,有兩種方法

referring to: https://developer.android.com/studio/test/command-line

referring to: https://developer.android.com/reference/androidx/test/runner/AndroidJUnitRunner

1.用gradlew

./gradlew connectedAndroidTest
./gradlew cAT

2.用adb

 $ adb shell am instrument -w <test_package_name>/<runner_class>

adb2 shell am instrument -w com.stlab.uiauto2.test/androidx.test.runner.AndroidJUnitRunner
adb2 shell am instrument -w  com.example.android.testing.uiautomator.BasicSample.test/androidx.test.runner.AndroidJUnitRunner
但是要事先把這些apk裝在手機裡面

比較一下 Google範例檔案的 AndroidManifest
這是IDE自動產生的Manifest, 不需要去改動他!
referring to:https://source.android.com/compatibility/tests/development/instrumentation



沒有留言 :

張貼留言