Search code examples
androidandroid-testinggradle-android-test-plugi

robolelectric setup issue -- how to start with roboelectric framework


I am starting with Robolectric framework 3.0. for android testing. I am goingthrough there site and they mention the first step as adding in build gradle

testCompile "org.robolectric:robolectric:3.0"

I have done that and did a complete clean build. Now once I start writing my first test case I get comilation issue-- cannot find symbol class RunWith for the annotation @

RunWith(RobolectricGradleTestRunner.class)

Please tell me, what I am missing? I thought mavencentral() will download the respective jar file.

Thanks in advance.


Solution

  • You can refer this this link.

    Make sure your test case locations are proper.

    Android Studio defaults to looking for tests in the following locations: Unit Tests => src/test/java