草庐IT

RobolectricTestRunner

全部标签

java - 如何覆盖 Robolectric 应用程序?

我继承了旧版Android项目并开始添加Robolectric3和JUnit4测试用例。遗憾的是,由于在Robolectric中不起作用的意大利面条代码和框架,目前无法初始化主应用程序类。我想为测试替换我的应用程序类。但是Robolectric在我更新RuntimeEnviroment.application变量之前就崩溃了。有没有办法在Robolectric中禁用list应用程序创建?这是我一直在尝试做的事情:@RunWith(RobolectricGradleTestRunner.class)@Config(constants=BuildConfig.class,sdk=21,ma

android - 更新 Robolectric 2.4 : Getting application tag error for library projects in eclipse

使用2.4更新robolectric后出现的错误堆栈跟踪有什么解决办法吗?java.lang.RuntimeException:java.lang.IllegalArgumentException:Missingrequiredelementin.\..\google-play-services_lib\AndroidManifest.xmlatorg.robolectric.RobolectricTestRunner$2.evaluate(RobolectricTestRunner.java:226)atorg.junit.runners.ParentRunner.runLeaf(P

android - java.lang.IllegalStateException : there must have been some overlap for resourceIdToResName 错误

我正在尝试为我的Android应用程序设置robolectric。我的主要代码有一个子模块和一个外部库,我不使用Maven。关注steps之后设置robolectric项目,当我尝试运行测试时出现以下错误java.lang.IllegalStateException:theremusthavebeensomeoverlapforresourceIdToResName!expected3014butgot3013atorg.robolectric.res.MergedResourceIndex.merge(MergedResourceIndex.java:20)atorg.robolec

android - 使用 Robolectric 时如何加载 .so?

W/环境:EXTERNAL_STORAGE未定义;回退到默认值java.lang.UnsatisfiedLinkError:com.autonavi.amap.mapcore.MapCore.nativeNewInstance(Ljava/lang/String;)Jatcom.autonavi.amap.mapcore.MapCore.nativeNewInstance(NativeMethod)atcom.autonavi.amap.mapcore.MapCore.(MapCore.java:62)atcom.amap.api.mapcore.AMapDelegateImpGLSu

android - java.lang.ClassNotFoundException : android. R 错误

我正在尝试使用Robolectric2.2运行一个简单的junit测试,但使用ADT包22时出现以下错误:java.lang.NoClassDefFoundError:android/Ratorg.robolectric.bytecode.Setup.(Setup.java:40)atorg.robolectric.RobolectricTestRunner.createSetup(RobolectricTestRunner.java:137)atorg.robolectric.RobolectricTestRunner.createSdkEnvironment(Robolectric

java - Android Instrumentation 在使用 AndroidJunitRunner 和 AndroidJUnit4 时测试 java.lang.UnsatisfiedLinkError

我在单元测试中使用了robolectric。最近在我们的项目中,我们添加了一个来自zendesk的新依赖项。repositories{maven{url'https://zendesk.artifactoryonline.com/zendesk/repo'}}compilegroup:'com.zendesk',name:'sdk',version:'1.3.0.1'现在我们甚至没有从这个库中引用任何类,我们只是通过添加这个依赖项在我们的robolectric单元测试中得到异常。我认为问题出在我们的项目中,但它也发生在示例机器人测试项目中。java.lang.VerifyError:E

java - Robolectric 启动期间反射的 NullPointerException - 有什么提示吗?

我正在Eclipse上开发一个Android项目,我正在尝试从在模拟器/设备上运行测试(这非常慢)切换到Robolectric.我用Robolectric替换了Android库,将JUnit添加到路径中,将测试用例改回常规TestCase并添加了建议的@RunWith(RobolectricTestRunner.class)来自QuickStartguide(进行必要的更改以实例化我的Activity,而不是依赖Android的Activity测试来为我做这件事)。但是,当我运行测试时,我得到:java.lang.NullPointerExceptionatcom.xtremelabs

android - Android Studio 无法识别 "RobolectricTestRunner.class"

我正在尝试使用Robolectric运行单元测试,但AndroidStudio无法识别以下类:@RunWith(RobolectricTestRunner.class)详细信息:classpath'com.android.tools.build:gradle:3.0.0'我正在导入依赖项:testImplementation"org.robolectric:robolectric:3.5.1"和:android{testOptions{unitTests{includeAndroidResources=true}}}它根本没有出现导入类的选项。我是否应该添加我忘记的更多依赖项?错误:e

Android:Robolectric 不支持 API 级别 1

这是我的基本测试类:@RunWith(RobolectricTestRunner.class)publicclassMainActivityTest{@Beforepublicvoidsetup(){//dowhateverisnecessarybeforeeverytest}@TestpublicvoidtestActivityFound(){Activityactivity=Robolectric.buildActivity(MainActivity.class).create().get();Assert.assertNotNull(activity);}}当我在AndroidS

Android:Robolectric 不支持 API 级别 1

这是我的基本测试类:@RunWith(RobolectricTestRunner.class)publicclassMainActivityTest{@Beforepublicvoidsetup(){//dowhateverisnecessarybeforeeverytest}@TestpublicvoidtestActivityFound(){Activityactivity=Robolectric.buildActivity(MainActivity.class).create().get();Assert.assertNotNull(activity);}}当我在AndroidS
12