Last active
August 29, 2015 14:11
-
-
Save gkthiruvathukal/b1de0d5a17e8fb250d54 to your computer and use it in GitHub Desktop.
Interactive Scala testing in sbt test:console
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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