Roboelectric 3.0测试片段 [英] Roboelectric 3.0 testing fragments
本文介绍了Roboelectric 3.0测试片段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是新来rooelectric测试。
我试图按照这发布测试片段。我使用以下内容作为依赖
{相关性
编译文件树(导演:'库',包括:['的* .jar'])
testCompileorg.robolectric:robolectric:3.0
testCompile'的JUnit:JUnit的:4.12
编译com.android.support:appcompat-v7:22.2.0
编译com.google code.gson:GSON:2.3
编译com.android.support:support-v4:22.1.0
编译com.google.android.gms:播放服务:7.5.0
}
但这种进口是给我编译问题,我不能够解决符号SupportFragmentTestUtil开始。请指导我,我缺少的是什么?
org.robolectric.shadows.support.v4.SupportFragmentTestUtil
解决方案
您需要添加Ø依赖于V4阴影支持。在你的依赖文件添加这一点。
testCompileorg.robolectric:阴影支持-V4:3.0
I am new to rooelectric testing. I am trying to follow this post to test fragments. I am using following as dependency
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile "org.robolectric:robolectric:3.0"
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.google.code.gson:gson:2.3'
compile 'com.android.support:support-v4:22.1.0'
compile 'com.google.android.gms:play-services:7.5.0'
}
But this import is giving me compilation issues, and I am not able to resolve the symbol SupportFragmentTestUtil to start with. Kindly guide me what I am missing??
org.robolectric.shadows.support.v4.SupportFragmentTestUtil
解决方案
You need o add the dependency for v4 shadows support. Add this in your dependency file.
testCompile "org.robolectric:shadows-support-v4:3.0"
这篇关于Roboelectric 3.0测试片段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文