O'Reilly logo

Pragmatic Scala by Venkat Subramaniam

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required