O'Reilly logo

Scala Test-Driven Development by Gaurav Sood

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

Styles

A specification would normally include two things:

  • Informal text describing the functionality of the application code under test.
  • Scala code describing the inputs to the test and then comparing the output with the expected output.

Specs2 provides two ways of doing this:

  • We can write all the informal text in one place and all the Scala code somewhere else. This style of specification is referred to as "acceptance" specification. We will discuss this in more detail later. Since the text is in one place, it is much easier for a non-developer to read the test and endorse the specification.
  • Alternatively, the Scala code and the text can be interleaved with each other. This structure is more akin to the traditional unit test framework like xUnit. ...

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