indi mars
indi mars

Reputation: 133

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

Upvotes: 6

Views: 4049

Answers (1)

Nicks
Nicks

Reputation: 16317

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

testCompile "org.robolectric:shadows-support-v4:3.0"

Upvotes: 11

Related Questions