I usually use IntelliJ IDE for Scala (which has a REPL and debugger among other things). Ammonite is great replacement though, when I don’t want to start up full blown IDE.
It’s really easy to get started with Ammonite. First it needs to be added to
built.sbt file as a library dependency via:
libraryDependencies += "com.lihaoyi" % "ammonite" % "1.4.2" % "test" cross CrossVersion.full
Once there, I just need to add the following lines of code to my file that I am trying to test:
ammonite.Main( predefCode = "println(\"Starting Debugging!\")" ).run( "test" -> myTestValue )
For example running a test for my test class above, via:
sbt "testOnly com.alexkras.AmmoniteTestClass"
Will start the interactive REPL, where
myTestValue will get exposed as a variable named
test, allowing me to explore how test can be used.