Using ScalaTest
JUnit is a good starting point for unit testing Scala code. However, as you get more familiar with Scala, you’ll want to take advantage of Scala’s conciseness and idioms for unit testing as well. When you’re ready for that, you may want to graduate to using ScalaTest. ScalaTest is a testing framework written in Scala by Bill Venners, with contribution from many other developers. It provides concise syntax for assertions and functional style for testing both Scala and Java code.
ScalaTest doesn’t ship with Scala, so first you need to download it.[7] Once you download the JAR, set an environment variable, SCALA_TEST_JAR, to refer to the full path of that JAR.
Now that you’ve downloaded ScalaTest, let’s write a test, similar to ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access