Testing Scala methods

Here, we will see some simple techniques for testing Scala methods. For Scala users, this is the most familiar unit testing framework (you can also use it for testing Java code and soon for JavaScript). ScalaTest supports a number of different testing styles, each designed to support a specific type of testing need. For details, see ScalaTest User Guide at http://www.scalatest.org/user_guide/selecting_a_style. Although ScalaTest supports many styles, one of the quickest ways to get started is to use the following ScalaTest traits and write the tests in the TDD (test-driven development) style:

  1. FunSuite
  2. Assertions
  3. BeforeAndAfter

Feel free to browse the preceding URLs to learn more about these traits; that will make the ...

Get Apache Spark 2: Data Processing and Real-Time Analytics now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.