Groups
This trait can be used to standardize names for groups of examples in an acceptance specification.
class MySpecification extends Specification with Examples { def is = s2""" first example in first group ${g1().e1} second example in first group ${g1().e2}
first example in second group ${g2().e1} second example in second group ${g2().e2} """ }
trait Examples extends Groups with Matchers { "first group of examples" - new g1 { e1 := ok e2 := ok } "second group of examples" - new g2 { e1 := ok e2 := ok } }
It is important to notice that the examples must be called with g1().e1
so as to create a new g1
trait instance
with new local variables for the example e1
. If this is not required, the Grouped
trait can be used instead
If you don't want to manage groups and examples numbers it is also possible to write the following (note the script.Specification
):
class MySpecification extends script.Specification with Examples { def is = s2""" first example in first group second example in first group
first example in second group second example in second group """ }
trait Examples extends Groups with Matchers { "first group of examples" - new group { eg := ok eg := ok } "second group of examples" - new group { eg := ok eg := ok } }
Type members
Classlikes
Inherited classlikes
Value members
Concrete methods
Concrete fields
Implicits
Implicits
Inherited implicits
- Inherited from:
- GroupsLike