当我试图通过Android项目从Eclipse运行单元测试时,我得到了这个错误。Android首选项中的Instrumentation Test Runners列表为空。
2009-06-17 23:57:51 - MyApp错误:应用程序未指定使用指令插入或未声明android.test.InstrumentationTestRunner - android.test.runner
它还恼人地决定,因为我曾经尝试过运行单元测试,所以这就是我一直想要做的。
发布于 2009-11-09 15:09:16
在Run Configuration
中,您可能有Android JUnit Test
,如果其中有任何新的启动配置条目,您可以删除它,然后运行它将运行的应用程序。
注意-如果您尝试在将正确的行添加到清单之前运行测试用例,这可能是解决方案,如Josef的答案中所述。如果您已经这样做了,请删除配置(它将报告在其标头中没有指定插装测试运行器),然后再次将其作为Android Junit test运行,它将创建一个有效的配置,选取您已添加到清单中的正确内容(请参阅Josef的答案)。
发布于 2009-06-18 12:39:14
您的AndroidManifest.xml
中可能缺少uses-library
和instrumentation
节点
<manifest ...>
<application ...>
<!-- ... -->
<uses-library android:name="android.test.runner" />
</application>
<instrumentation android:name="android.test.InstrumentationTestRunner"
android:targetPackage="your.package"
android:label="your tests label" />
</manifest>
发布于 2010-01-18 00:18:25
我在这次讨论中注意到的一件事可能会让一些人陷入困境,那就是您需要确保清单中的“工具”元素是“清单”的子元素,而不是“应用程序”的子元素。(这里的示例是正确的,但这很容易混淆。)
http://developer.android.com/guide/topics/manifest/instrumentation-element.html
如果您将您的工具放在应用程序中,它将不会被提取,并且您在Eclipse ADT插件中为工具运行器所做的选择可能是空白的。(但不会抛出或显示错误,等等)
https://stackoverflow.com/questions/1009970
复制相似问题