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

Chapter 16Unit Testing

Your code always does what you type—unit tests will assert that it does what you actually meant. As you develop your application, unit testing further helps ensure your code continues to meet your expectations.

Learning to write unit tests in Scala will benefit you in a number of ways:

  • It’s a nice way to introduce Scala on your current projects. Even though your production code may be in Java, you can write the test code in Scala.

  • It’s a good way to learn Scala itself. As you learn the language, you can experiment with the language and its API by writing test cases.

  • It improves your design. It’s very hard to unit test large and complex code. In order to test it, you’d end up making the code smaller. This will lead 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