Chapter 8. Scala TDD with Specs2

Specs2 is another popular library, which is used to write an executable specification for Scala. Specs2 is contrarily focused than ScalaTest. It also has a different perspective. It is another arsenal in your gambit of writing tests for Scala code. In this chapter, we will look at:

  • Introduction to Specs2
  • Differences between Specs2 and ScalaTest
  • Setting up Specs2
  • Unit specification
  • Functional specification
  • Matchers

Introduction to Specs2

Much like ScalaTest, Specs2 also works with SBT. There are both similarities and differences between Specs2 and ScalaTest. Some unique differences between Specs2 and ScalaTest give the developer choice of one over the other depending on the functionality required.

Note

There is a very interesting ...

Get Scala Test-Driven Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.