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