I'm testing a play2 project by using specs2. How can I force the test to stop right after one of the tests failed?
You can place args(stopOnFail=true)
in your Specification
, which will cause all other tests within the spec to be skipped after the first failure. Note that this will only skip remaining tests within the Specification
, and not all of the specs.
object TestSpec extends Specification {
args(stopOnFail=true)
// fails
"must fail" in {
true must beFalse
}
// is skipped
"must be arbitrary" in {
1 must equalTo(0)
}
}
I'm not aware of any way to skip all specs after failure. Here's a references for the above: Specs2 Runners