How to launch a JUnit Robolectric test


In a SBT project, I can launch correctly Robolectric tests with this setting:

managedClasspath in Test <++= (platformJars in Android, baseDirectory) map {
   case ((j,_), b) =>
      Seq(Attributed.blank(b / "bin" / "classes"), Attributed.blank(file(j)))

In order to debug it with IDEA, I create a Run/Debug configuration of type JUnit.
The problem is that I get this exception:

java.lang.NoClassDefFoundError: android/content/Context

This doesn't happen when launching using: "sbt test".

How can I tell IDEA to use the correct classpath?.
I've set a standard JRE 7 as the alternative JRE of the Run/Debug configuration.

Any help, please?


Please sign in to leave a comment.