需要帮助在运行Android单元测试项目上的真实电话



我已经创建了一个android和相应的测试项目。当我将Android测试项目作为"Android junit测试"运行时。我的android项目和我的android测试项目都在eclipse下编译。

但是当我在真正的手机上运行时(将我的手机连接到我的笔记本电脑并在eclipse中单击"运行为Android junit测试"),我得到了这个"instrumentation目标包"。

[2011-08-02 14:33:36 - MyApp-test2] ------------------------------
[2011-08-02 14:33:36 - MyApp-test2] Android Launch!
[2011-08-02 14:33:36 - MyApp-test2] adb is running normally.
[2011-08-02 14:33:36 - MyApp-test2] Performing android.test.InstrumentationTestRunner JUnit launch
[2011-08-02 14:33:36 - MyApp-test2] Automatic Target Mode: using device 'HT9BSP800010'
[2011-08-02 14:33:36 - MyApp-test2] Application already deployed. No need to reinstall.
[2011-08-02 14:33:36 - MyApp-test2] Project dependency found, installing: MyApp
[2011-08-02 14:33:37 - MyApp] Application already deployed. No need to reinstall.
[2011-08-02 14:33:37 - MyApp-test2] Launching instrumentation android.test.InstrumentationTestRunner on device HT9BSP800010
[2011-08-02 14:33:37 - MyApp-test2] Collecting test information
[2011-08-02 14:33:37 - MyApp-test2] Test run failed: Unable to find instrumentation target package:

给我们看看你的android manifest文件,或者确保你有以下内容:

<manifest ..>
 <instrumentation
        android:name="android.test.InstrumentationTestRunner"
        android:targetPackage="YourTargetPkgNameHere" />
 <application ...>
<uses-library android:name="android.test.runner" />
</application>
</manifest>

最新更新