Testing frameworks

A testing framework is used for the automated testing of software. It is primarily a collection of postulations, perceptions, and observations which support automated testing of application code. Testing frameworks are not limited to just unit testing, they can very well be used for integration, smoke, and acceptance testing. There are two main frameworks for testing application code written in Scala: ScalaTest and Specs2. Both are equally easy to use and the choice of one over the other will depend on your testing approach. For example, ScalaTest uses the JUnit like testing structure, whereas the Specs2 test by itself is not prosaic but cleaves more closely to an immutability ideal.

ScalaTest is arguably more popular as it makes a transition from JUnit easier. For this reason, we will start with ScalaTest and in later chapters we will compare them both.