Skip to content

Instantly share code, notes, and snippets.

@pfn
Created April 26, 2012 21:46
Show Gist options
  • Save pfn/2503441 to your computer and use it in GitHub Desktop.
Save pfn/2503441 to your computer and use it in GitHub Desktop.
sbt configuration for testing with robolectric
import AndroidKeys._
libraryDependencies ++= Seq(
"com.pivotallabs" % "robolectric" % "1.1" % "test",
"junit" % "junit" % "4.8.2" % "test",
"xpp3" % "xpp3" % "1.1.4c" % "test",
"org.scalatest" %% "scalatest" % "1.7.1" % "test"
)
seq(androidBuildSettings: _*)
managedClasspath in Test <++= (platformJar in Android, baseDirectory) map {
(j, b) =>
Seq(Attributed.blank(b / "bin" / "classes"), Attributed.blank(file(j)))
}
exportJars in Test := false
@romansky
Copy link

Hi,
Where can I find example project with "robolectric"?

Thanks!
Roman

@pfn
Copy link
Author

pfn commented May 11, 2012

Shouldn't need an example project, just put any junit or scalatest case in test/ of an existing android project; run sbt test to execute the test case, see the robolectric docs for how to write a test case with robolectric.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment