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. ...