adb命令行執行uiautomator2


命令行格式:

  adb shell am instrument -w -r [-e ] 執行器

獲取instrumentation執行器

在命令行執行adb shell pm list instrumentation, 獲取自己需要執行的instrumentation執行器

 

執行全部用例

  adb shell am instrument -w -r 執行器, adb shell am instrument -w -r com.haofenqi.myapplication04.test/androidx.test.runner.AndroidJUnitRunner

過濾器

  執行某一個類中的測試用例(-e class )

    adb shell am instrument -w -r -e class 全類名  com.haofenqi.myapplication04.test/androidx.test.runner.AndroidJUnitRunner

   執行某一個類下的某一個用例

    adb shell am instrument -w -r -e class 全類名#方法名  com.haofenqi.myapplication04.test/androidx.test.runner.AndroidJUnitRunner

  執行某一個包下全部用例

    adb shell am instrument -w -r -e package 包名  com.haofenqi.myapplication04.test/androidx.test.runner.AndroidJUnitRunner

  執行指定注解的用例

    adb shell am instrument -w -r -e annotation 注解名  com.haofenqi.myapplication04.test/androidx.test.runner.AndroidJUnitRunner

    執行自定義注解執行用例,自由度很高, 用例比較多,且執行邏輯比較復雜時, 可以使用自方法

    

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM