Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Roboelectric 3.0 testing fragments

I am new to Roboelectric 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
like image 314
indi mars Avatar asked Aug 07 '15 03:08

indi mars


1 Answers

You need to add the dependency for v4 shadows support. Add this in your dependency file.

testCompile "org.robolectric:shadows-support-v4:3.0"
like image 161
Nicks Avatar answered Oct 11 '22 15:10

Nicks