我正在尝试在Mac上编写Android的单元测试脚本。我能够通过Eclipse运行它,但需要能够自动化所有内容。
创建我正在运行的项目
~/workspace$ android create test-project -m ../ -p ROAMpayX/tests -n ROAMPayTest
我正在尝试运行以下命令
adb shell am instrument -w com.roamdata.roampayx/android.test.InstrumentationTestRunner
并不断收到以下错误(我的测试文件夹中的AndroidManifest.xml给了我)
显然,这是一种路径问题。有什么东西我错过了吗?我试过从mainproject文件夹和testsproject文件夹运行命令。INSTRUMENTATION_STATUS:id = ActivityManagerService INSTRUMENTATION_STATUS:错误=无法找到以下内容的检测信息:ComponentInfo {com.roamdata.roampayx / android.test.InstrumentationTestRunner} android.util.AndroidException:INSTRUMENTATION_FAILED:com.roamdata.roampayx / android.test.InstrumentationTestRunner INSTRUMENTATION_STATUS_CODE:-1 在com.android.commands.am.Am.runInstrument(Am.java:616) 在com.android.commands.am.Am.run(Am.java:118) 在com.android.commands.am.Am.main(Am.java:81) at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method) 在com.android.internal.os.RuntimeInit.main(RuntimeInit.java:235) 在dalvik.system.NativeStart.main(本地方法)
有什么想法吗?
答案 0 :(得分:2)
在运行adb
命令之前,您是否构建并安装了测试项目?
您可以使用以下命令轻松地执行此操作:
ant debug install test
答案 1 :(得分:1)
无法找到以下内容的检测信息:ComponentInfo {com.roamdata.roampayx / android.test.InstrumentationTestRunner}
它说无法在com.roamdata.roampayx中找到android.test.InstrumentationTestRunner
为什么不使用ant http://developer.android.com/tools/testing/testing_otheride.html进行测试运行?这是特定目的吗?
如果你选择ant,你可以从https://github.com/inazaruk/robomorphine-testrunner/wiki中获取一些想法或蚂蚁任务,但现在可能是开销。