Chapter 8. Testing

This chapter covers

  • Integration testing with Specs2
  • Unit testing with Specs2
  • Testing with ScalaTest

By now, you’ve had a thorough introduction to the basic features of Scalatra. As good test-first developers, we feel a little guilty about waiting until now to introduce testing, but here we are.

Scalatra comes with a test DSL to simplify testing your application. The DSL follows the Scalatra philosophy of not being particularly opinionated. It works with both major Scala test frameworks, ScalaTest and Specs2. It’s suited to both integration and unit testing. And if it doesn’t fully suit your needs, it’s easy to pull out the pieces that do. It’s time to write your first test.

8.1. Integration testing with Specs2

Scalatra ...

Get Scalatra in Action 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.