specs2 The Getting Started

Updated 2 years ago

specs2 the first steps

Eric in http://stackoverflow.com/a/27575113/1305344 wrote:

In specs2 there is a distinction between test declaration and test execution. When you write "application" should ... you just declare tests. The executable part is what is enclosed in the ... in ... part.

The general solution for what you want to achieve in specs2 is to use Steps like this:

class ApplicationSpec extends Specification { sequential

  step("start application")

  "Application" should {
    "send 404 on a bad request" in { ... }

    "post signup request" in { ... }

  step("stop application")

Then, the way the specs2 execution model works, you will get your fake application started before all the tests start and terminated when all the tests are finished (whether you use sequential or not)