android - 运行 Android Junit 时找不到测试类异常

标签 android android-testing

我正在尝试通过 Eclipse 将我的测试类作为 Android Junit Test 运行,然后它找不到测试类异常。

我已经在我的生产代码包中正确提到了检测目标包。

下面是android list

<?xml version="1.0" encoding="utf-8"?>

<uses-sdk android:minSdkVersion="15" />

<instrumentation
    android:name="android.test.InstrumentationTestRunner"
    android:targetPackage="com.abc.android" />

<application
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name" >
    <uses-library android:name="android.test.runner" />
</application>

我还检查了构建路径,它正确地包含了目标类,以便可以找到类文件。

找不到问题所在。

感谢和问候, 索拉夫

最佳答案

我删除了我的项目并从我的源代码库中获取了最新版本。

然后我运行了我的测试,它确实有效。

但想知道为什么会出现问题。

从 Eclipse 运行时,Android junit 测试在哪里选择它的类?...我假设它的 bin/classes 在构建路径中...无法弄清楚问题是什么

关于android - 运行 Android Junit 时找不到测试类异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20215252/

相关文章:

android - 实现观察者模式的 fragment

android - Kotlin 中的单例类

android - iOS/Android firebase 后台同步

android - 我如何在android中创建联系人 View 界面?

android - 在 Android Studio 中找不到 junit :junit:4. 12

android - 浓缩咖啡 :No views in hierarchy found matching with id: android:id/home

android - 特定于测试的应用程序子类

Android 兼容性 ExceptionInInitializerError

android - 安装的测试 APK 没有出现在设备的主屏幕上

android - Robolectric:Resources$NotFoundException:带有 Android Gradle 插件 3 的字符串资源 ID