我正在尝试使用 Robolectric 来运行单元测试,但 Android Studio 无法识别以下类:
@RunWith(RobolectricTestRunner.class)
Details:
classpath 'com.android.tools.build:gradle:3.0.0'
我正在导入依赖项:
testImplementation "org.robolectric:robolectric:3.5.1"
And:
android {
testOptions {
unitTests {
includeAndroidResources = true
}
}
}
它根本没有出现导入类的选项。
我应该添加更多我忘记的依赖项吗?
Error:
error: package org.robolectric does not exist
error: package org.robolectric does not exist
error: package org.robolectric.shadows does not exist
error: cannot find symbol class RobolectricTestRunner
error: cannot find symbol variable Robolectric
error: cannot find symbol variable ShadowApplication
我只是通过将测试类放入src \ test
文件夹而不是将其放入src \ androidTest
folder
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)