Skip to content

Instantly share code, notes, and snippets.

@gkthiruvathukal
Last active August 29, 2015 14:11
Show Gist options
  • Save gkthiruvathukal/b1de0d5a17e8fb250d54 to your computer and use it in GitHub Desktop.
Save gkthiruvathukal/b1de0d5a17e8fb250d54 to your computer and use it in GitHub Desktop.
Interactive Scala testing in sbt test:console
// Imports need to be done even though you entered a test:console
import org.junit.Test
import org.junit._
import org.junit.Assert._
// Create a test class inline
scala> :paste
// Entering paste mode (ctrl-D to finish)
class Tests {
@Test def testSuccess() {
assertEquals(0, 0)
}
}
// Use JUnitCore to run the tests
val res = org.junit.runner.JUnitCore.runClasses(classOf[Tests])
res.wasSuccessful
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment