android 单元测试cmd 命令集
对app进行单元测试时,或使用robotium进行黑盒测试时,需要把测试apk安装到模拟器或者android真机上,然后用命令去驱动测试
1.运行测试程序命令-运行测试工程中所有test方法:
>adb shell am instrument -w 测试程序packageName/android.test.InstrumentationTestRunner
例如:
>adb shell am instrument -w com.example.action02.test/android.test.InstrumentationTestRunner
2.运行测试程序命令-运行测试工程中指定测试类方法:
>abd shell am instrument -e class package.testClass(测试类)-w packageName/android.test.InstrumentationTestRunner
例如:adb shell am instrument -e class com.example.action02.test.testlogin -w com.example.action02.test/android.test.InstrumentationTestRunner
3.运行测试程序命令-运行单个测试方法
>adb shell am instrument -e class package.testClass#testmethod-w cpackageNameandroid.test.InstrumentationTestRunner
例如:adb shell am instrument -e class com.example.action02.test.testloginandquit#testlogin -w com.example.action02.test/android.test.InstrumentationTestRunner
更多相关文章
- Android(安卓)Too many classes in --main-dex-list 错误原因及A
- AOSP和Chromium的Android(安卓)WebViewTest
- Android利用setLayoutParams在代码中调整布局(Margin和居中)
- android开发环境搭建备忘
- 让Android后台运行,不用service
- Android—— ubuntu下【CTS】测试TV真机
- Android(安卓)== 在Android系统上运行JAVA程序
- 通过终端命令生成并在手机上运行dex文件
- Robotium---环境搭建及入门示例