使用命令行在手机上运行android单元测试

本文假设你已经知道如何adb连接设备,知道如何在eclipse里运行android的单元测试。

关键命令:
直接运行所有有case
adb shell am instrument -w com.myapp.test/android.test.InstrumentationTestRunner

运行一个case
adb shell am instrument -w -e class com.myapp.test.TestDemo#testSearch com.myapp.test/android.test.InstrumentationTestRunner


说明:com.myapp.test是包名,com.myapp.test.TestDemo是类名 testSearch是方法名

更多信息可以参考官网:
http://developer.android.com/tools/testing/testing_otheride.html#RunTestsDevice

猜你喜欢

转载自nid007.iteye.com/blog/2087823