cannot resolve symbol RobolectricTestRunner

1,818 views
Skip to first unread message

Károly Holczhauser

unread,
Mar 24, 2016, 4:20:14 PM3/24/16
to Robolectric
Hello,
I would like to ask, after adding the Robolectric dependency to my gradle file, why my project can't see in Android Studio 2.0 the RobolectricTestRunner?
I got the following message, when trying to import the class: "cannot resolve symbol RobolectricTestRunner"


@RunWith(RobolectricTestRunner.class)
public class MainActivityTest {

   
@Before
    public void setUp() throws Exception {

   
}

   
@After
    public void tearDown() throws Exception {

   
}
}


testCompile
"org.robolectric:robolectric:3.0"
androidTestCompile 'junit:junit:4.12'


Thanks,
Karoly

Károly Holczhauser

unread,
Mar 24, 2016, 6:18:05 PM3/24/16
to Robolectric
ok, I find it out: I had to move my test from the src/androidTest folder TO src/test folder 

Igor Ganapolsky

unread,
Sep 30, 2016, 4:39:10 PM9/30/16
to Robolectric
This doesn't help.  Even my test in /app/src/test cannot find RobolectricTestRunner.

em...@thenetcircle.com

unread,
Jan 16, 2018, 9:36:32 PM1/16/18
to Robolectric
firstly, in module build.gradle
testImplementation "org.robolectric:robolectric:3.6.1"
testOptions {
unitTests {
includeAndroidResources = true
}
}

secondly, set up you test file in app/src/test.
it's work
Reply all
Reply to author
Forward
0 new messages