org.specs2.specification

GivenWhenThen

trait GivenWhenThen extends RegexStepsFactory with TuplesToSeq with FragmentsBuilder with SpecificationStringContext with ArgumentsArgs

This trait provides building blocks to create steps and examples from regular expression.

It is used to implement a Given-When-Then way of describing systems.

Fragments are created by adding a Given step to a Text:

"name: ${user}" ^ givenName

This creates a PreStep object containing the current context (representing all the extracted values) and a list of Fragments containing:

Then, this PreStep object can be followed by another piece of Text to create a PreStepText object. This object merely stores the additional Text fragment so that values can be extracted from it when a When step is added:

// this creates a PreStepText object
"name: ${user}" ^ givenName ^
"age: ${38}"

// this creates a PreStep object
"name: ${user}" ^ givenName ^
"age: ${38}"    ^ thenAge ^

Eventually, when a Then step is added, a sequence of PostStep/PostStepText objects is created. Those objects use the current context and the results returned by the Then objects to create Examples.

The last PostStep object contains the list of all fragments created by the Given/When/Then sequence:

Linear Supertypes
ArgumentsArgs, ArgProperties, SpecificationStringContext, FragmentsBuilder, FormattingTags, Tags, ExamplesFactory, TuplesToSeq, RegexStepsFactory, ImplicitParameters, AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. GivenWhenThen
  2. ArgumentsArgs
  3. ArgProperties
  4. SpecificationStringContext
  5. FragmentsBuilder
  6. FormattingTags
  7. Tags
  8. ExamplesFactory
  9. TuplesToSeq
  10. RegexStepsFactory
  11. ImplicitParameters
  12. AnyRef
  13. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Type Members

  1. case class AsFragments extends Product with Serializable

    Definition Classes
    FragmentsBuilder
  2. class ExampleDesc extends AnyRef

    Definition Classes
    FragmentsBuilder
  3. case class FormattingTagParameter extends Product with Serializable

    Definition Classes
    FormattingTags
  4. class GivenExampleDesc extends ExampleDesc

    transient class to hold an example description before creating a full Example

  5. class GivenWhenThenFragmentsFragment extends FragmentsFragment

  6. class HtmlLinkFragments extends AnyRef

    Definition Classes
    FragmentsBuilder
  7. class HtmlLinkFragments2 extends AnyRef

    Definition Classes
    FragmentsBuilder
  8. trait ImplicitParam extends AnyRef

    Definition Classes
    ImplicitParameters
  9. trait ImplicitParam1 extends AnyRef

    Definition Classes
    ImplicitParameters
  10. trait ImplicitParam10 extends AnyRef

    Definition Classes
    ImplicitParameters
  11. trait ImplicitParam2 extends AnyRef

    Definition Classes
    ImplicitParameters
  12. trait ImplicitParam3 extends AnyRef

    Definition Classes
    ImplicitParameters
  13. trait ImplicitParam4 extends AnyRef

    Definition Classes
    ImplicitParameters
  14. trait ImplicitParam5 extends AnyRef

    Definition Classes
    ImplicitParameters
  15. trait ImplicitParam6 extends AnyRef

    Definition Classes
    ImplicitParameters
  16. trait ImplicitParam7 extends AnyRef

    Definition Classes
    ImplicitParameters
  17. trait ImplicitParam8 extends AnyRef

    Definition Classes
    ImplicitParameters
  18. trait ImplicitParam9 extends AnyRef

    Definition Classes
    ImplicitParameters
  19. class ReadAs extends AnyRef

    This class creates Given or Then extractors from a regular expression and a function

  20. case class SpecIdentificationMarkdownLink extends Product with Serializable

    Definition Classes
    FragmentsBuilder
  21. class SpecTitle extends AnyRef

    Definition Classes
    FragmentsBuilder
  22. implicit class specificationInStringContext extends AnyRef

    Definition Classes
    SpecificationStringContext

Value Members

  1. final def !=(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  4. implicit def RegexFragmentToFragments(r: RegexFragment): Fragments

    at any point in time a regex sequence can be transformed as a sequence of Fragments

  5. implicit def ToFormattingTagParameter(condition: Boolean): Option[FormattingTagParameter]

    Definition Classes
    FormattingTags
  6. implicit def anyAsResultIsSpecPart(r: ⇒ Function0Result): SpecPart

    Definition Classes
    SpecificationStringContext
  7. implicit def anyToArgProperty[T](t: ⇒ T): ArgProperty[T]

    Definition Classes
    ArgProperties
  8. def args(ex: ArgProperty[String], include: ArgProperty[String], exclude: ArgProperty[String], wasIssue: ArgProperty[Boolean], was: ArgProperty[String], plan: ArgProperty[Boolean], skipAll: ArgProperty[Boolean], stopOnFail: ArgProperty[Boolean], stopOnSkip: ArgProperty[Boolean], sequential: ArgProperty[Boolean], isolated: ArgProperty[Boolean], random: ArgProperty[Boolean], xonly: ArgProperty[Boolean], showOnly: ArgProperty[String], color: ArgProperty[Boolean]): Arguments

    Definition Classes
    ArgumentsArgs
  9. lazy val args: ArgumentsNamespace

    Definition Classes
    ArgumentsArgs
  10. implicit def argumentsFragment(a: Arguments): GivenWhenThenFragmentsFragment

    Definition Classes
    GivenWhenThen → FragmentsBuilder
  11. implicit def argumentsIsSpecPart(a: Arguments): SpecPart

    Definition Classes
    SpecificationStringContext
  12. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  13. implicit def asResultIsSpecPart[R](r: ⇒ R)(implicit arg0: AsResult[R]): SpecPart

    Definition Classes
    SpecificationStringContext
  14. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  15. implicit def downcastGiven[X, Y <: X](gv: Given[Y]): Given[X] { def extract(s: String): Y }

    implicit conversion to transform a Given[Y] to Given[X] when Y <: X

  16. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  17. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  18. implicit def exampleFactory: ExampleFactory

    Definition Classes
    ExamplesFactory
  19. implicit def exampleIsSpecPart(e: Example): SpecPart

    Definition Classes
    SpecificationStringContext
  20. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  21. implicit def forExample(s: String): GivenExampleDesc

    This implicit allows to use the "so" object:

    This implicit allows to use the "so" object:

    "given the name: ${eric}, then the age is ${18}" ! so { case (name: String, age: String) => age.toInt must_== 18 }

    Definition Classes
    GivenWhenThen → FragmentsBuilder
  22. def formatSection(markdown: Option[FormattingTagParameter], flow: Option[FormattingTagParameter], verbatim: Option[FormattingTagParameter]): TagFragment

    Definition Classes
    FormattingTags
  23. def formatTag(markdown: Option[FormattingTagParameter], flow: Option[FormattingTagParameter], verbatim: Option[FormattingTagParameter]): TagFragment

    Definition Classes
    FormattingTags
  24. implicit def fragmentFragments(f: ⇒ Fragment): GivenWhenThenFragmentsFragment

    Definition Classes
    GivenWhenThen → FragmentsBuilder
  25. implicit def fragmentIsSpecPart(f: Fragment): SpecPart

    Definition Classes
    SpecificationStringContext
  26. implicit def fragments(f: ⇒ Fragment): Fragments

    Definition Classes
    FragmentsBuilder
  27. implicit def fragmentsFragmentIsSpecPart(ffs: FragmentsFragment): SpecPart

    Definition Classes
    SpecificationStringContext
  28. implicit def fragmentsFragmentToFragments(fs: FragmentsFragment): Fragments

    Definition Classes
    FragmentsBuilder
  29. implicit def fragmentsFragments(fs: ⇒ Fragments): GivenWhenThenFragmentsFragment

    Definition Classes
    GivenWhenThen → FragmentsBuilder
  30. implicit def fragmentsIsSpecPart(fragments: Fragments): SpecPart

    Definition Classes
    SpecificationStringContext
  31. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  32. implicit def givenIsSpecPart[T](g: Given[T]): SpecPart

  33. def groupAs(groupRegex: String): ReadAs

    factory method to create a Given or a Then element from a regex, using a regex denoting groups to extract

    factory method to create a Given or a Then element from a regex, using a regex denoting groups to extract

    Definition Classes
    RegexStepsFactory
  34. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  35. implicit lazy val implicitParam: ImplicitParam

    Definition Classes
    ImplicitParameters
  36. implicit lazy val implicitParam1: ImplicitParam1

    Definition Classes
    ImplicitParameters
  37. implicit lazy val implicitParam10: ImplicitParam10

    Definition Classes
    ImplicitParameters
  38. implicit lazy val implicitParam2: ImplicitParam2

    Definition Classes
    ImplicitParameters
  39. implicit lazy val implicitParam3: ImplicitParam3

    Definition Classes
    ImplicitParameters
  40. implicit lazy val implicitParam4: ImplicitParam4

    Definition Classes
    ImplicitParameters
  41. implicit lazy val implicitParam5: ImplicitParam5

    Definition Classes
    ImplicitParameters
  42. implicit lazy val implicitParam6: ImplicitParam6

    Definition Classes
    ImplicitParameters
  43. implicit lazy val implicitParam7: ImplicitParam7

    Definition Classes
    ImplicitParameters
  44. implicit lazy val implicitParam8: ImplicitParam8

    Definition Classes
    ImplicitParameters
  45. implicit lazy val implicitParam9: ImplicitParam9

    Definition Classes
    ImplicitParameters
  46. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  47. def link(htmlLink: HtmlLink, f: Fragments): Fragments

    Definition Classes
    FragmentsBuilder
  48. def link(htmlLink: HtmlLink, s: SpecificationStructure): Fragments

    Definition Classes
    FragmentsBuilder
  49. def link(fss: Seq[Fragments]): Fragments

    Definition Classes
    FragmentsBuilder
  50. def link(fs: Fragments, fss: Fragments*): Fragments

    Definition Classes
    FragmentsBuilder
  51. def link(fs: Fragments): Fragments

    Definition Classes
    FragmentsBuilder
  52. def link(ss: Seq[SpecificationStructure], dummy: Int): Fragments

    Definition Classes
    FragmentsBuilder
  53. def link(s: SpecificationStructure, ss: SpecificationStructure*): Fragments

    Definition Classes
    FragmentsBuilder
  54. def link(s: SpecificationStructure): Fragments

    Definition Classes
    FragmentsBuilder
  55. implicit def markdownLinkIsSpecPart(link: MarkdownLink): SpecPart

    Definition Classes
    SpecificationStringContext
  56. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  57. final def notify(): Unit

    Definition Classes
    AnyRef
  58. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  59. def readAs(regex: String): ReadAs

    factory method to create a Given or a Then element from a regex

    factory method to create a Given or a Then element from a regex

    Definition Classes
    RegexStepsFactory
  60. def s2(content: String, Yrangepos: Boolean, texts: Seq[String], variables: Seq[SpecPart], rangeExpressions: Seq[String]): Fragments

    Definition Classes
    SpecificationStringContext
  61. def section(names: String*): TagFragment

    Definition Classes
    Tags
  62. def see(htmlLink: HtmlLink, fs: Fragments): Fragments

    Definition Classes
    FragmentsBuilder
  63. def see(htmlLink: HtmlLink, s: SpecificationStructure): Fragments

    Definition Classes
    FragmentsBuilder
  64. def see(fss: Seq[Fragments]): Fragments

    Definition Classes
    FragmentsBuilder
  65. def see(fs: Fragments, fss: Fragments*): Fragments

    Definition Classes
    FragmentsBuilder
  66. def see(fs: Fragments): Fragments

    Definition Classes
    FragmentsBuilder
  67. def see(s: SpecificationStructure): Fragments

    Definition Classes
    FragmentsBuilder
  68. def see(ss: Seq[SpecificationStructure])(implicit p1: ImplicitParam1): Fragments

    Definition Classes
    FragmentsBuilder
  69. def see(s: SpecificationStructure, ss: SpecificationStructure*): Fragments

    Definition Classes
    FragmentsBuilder
  70. implicit def specIdentificationMarkdownLink(s: String): SpecIdentificationMarkdownLink

    Definition Classes
    FragmentsBuilder
  71. implicit def specStructureIsSpecPart(s: SpecificationStructure): SpecPart

    Definition Classes
    SpecificationStringContext
  72. implicit def specificationStructureToFragments(s: SpecificationStructure): AsFragments

    Definition Classes
    FragmentsBuilder
  73. implicit def stringIsSpecPart(s: ⇒ String): SpecPart

    Definition Classes
    SpecificationStringContext
  74. implicit def stringToHtmlLinkFragments(s: String): HtmlLinkFragments

    Definition Classes
    FragmentsBuilder
  75. implicit def stringToHtmlLinkFragments2(s: String): HtmlLinkFragments2

    Definition Classes
    FragmentsBuilder
  76. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  77. def tag(names: String*): TagFragment

    Definition Classes
    Tags
  78. implicit def textFragment(s: String): GivenWhenThenFragmentsFragment

    Definition Classes
    GivenWhenThen → FragmentsBuilder
  79. implicit def textStart(s: String): Fragments

    Definition Classes
    FragmentsBuilder
  80. implicit def thenIsSpecPart[T](t: Then[T]): SpecPart

  81. implicit def title(s: String): SpecTitle

    Definition Classes
    FragmentsBuilder
  82. def toString(): String

    Definition Classes
    AnyRef → Any
  83. implicit def tupleToSeq10[T, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10](t: (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10))(implicit e1: <:<[T1, T], e2: <:<[T2, T], e3: <:<[T3, T], e4: <:<[T4, T], e5: <:<[T5, T], e6: <:<[T6, T], e7: <:<[T7, T], e8: <:<[T8, T], e9: <:<[T9, T], e10: <:<[T10, T]): Seq[T]

    Definition Classes
    TuplesToSeq
  84. implicit def tupleToSeq2[T, T1, T2](t: (T1, T2))(implicit e1: <:<[T1, T], e2: <:<[T2, T]): Seq[T]

    Definition Classes
    TuplesToSeq
  85. implicit def tupleToSeq3[T, T1, T2, T3](t: (T1, T2, T3))(implicit e1: <:<[T1, T], e2: <:<[T2, T], e3: <:<[T3, T]): Seq[T]

    Definition Classes
    TuplesToSeq
  86. implicit def tupleToSeq4[T, T1, T2, T3, T4](t: (T1, T2, T3, T4))(implicit e1: <:<[T1, T], e2: <:<[T2, T], e3: <:<[T3, T], e4: <:<[T4, T]): Seq[T]

    Definition Classes
    TuplesToSeq
  87. implicit def tupleToSeq5[T, T1, T2, T3, T4, T5](t: (T1, T2, T3, T4, T5))(implicit e1: <:<[T1, T], e2: <:<[T2, T], e3: <:<[T3, T], e4: <:<[T4, T], e5: <:<[T5, T]): Seq[T]

    Definition Classes
    TuplesToSeq
  88. implicit def tupleToSeq6[T, T1, T2, T3, T4, T5, T6](t: (T1, T2, T3, T4, T5, T6))(implicit e1: <:<[T1, T], e2: <:<[T2, T], e3: <:<[T3, T], e4: <:<[T4, T], e5: <:<[T5, T], e6: <:<[T6, T]): Seq[T]

    Definition Classes
    TuplesToSeq
  89. implicit def tupleToSeq7[T, T1, T2, T3, T4, T5, T6, T7](t: (T1, T2, T3, T4, T5, T6, T7))(implicit e1: <:<[T1, T], e2: <:<[T2, T], e3: <:<[T3, T], e4: <:<[T4, T], e5: <:<[T5, T], e6: <:<[T6, T], e7: <:<[T7, T]): Seq[T]

    Definition Classes
    TuplesToSeq
  90. implicit def tupleToSeq8[T, T1, T2, T3, T4, T5, T6, T7, T8](t: (T1, T2, T3, T4, T5, T6, T7, T8))(implicit e1: <:<[T1, T], e2: <:<[T2, T], e3: <:<[T3, T], e4: <:<[T4, T], e5: <:<[T5, T], e6: <:<[T6, T], e7: <:<[T7, T], e8: <:<[T8, T]): Seq[T]

    Definition Classes
    TuplesToSeq
  91. implicit def tupleToSeq9[T, T1, T2, T3, T4, T5, T6, T7, T8, T9](t: (T1, T2, T3, T4, T5, T6, T7, T8, T9))(implicit e1: <:<[T1, T], e2: <:<[T2, T], e3: <:<[T3, T], e4: <:<[T4, T], e5: <:<[T5, T], e6: <:<[T6, T], e7: <:<[T7, T], e8: <:<[T8, T], e9: <:<[T9, T]): Seq[T]

    Definition Classes
    TuplesToSeq
  92. implicit def upcastThen[X, Y <: X](th: Then[X]): Then[Y]

    implicit conversion to transform a Then[Y] to Then[X] when Y <: X

  93. implicit def updowncastWhen[P, Q, R <: P, S >: Q](wh: When[P, Q]): When[R, S]

    implicit conversion to transform a When[P, Q] to When[R, S] when R <: P and S >: Q

  94. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  95. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  96. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  97. implicit def whenIsSpecPart[T, U](w: When[T, U]): SpecPart

Inherited from ArgumentsArgs

Inherited from ArgProperties

Inherited from SpecificationStringContext

Inherited from FragmentsBuilder

Inherited from FormattingTags

Inherited from Tags

Inherited from ExamplesFactory

Inherited from TuplesToSeq

Inherited from RegexStepsFactory

Inherited from ImplicitParameters

Inherited from AnyRef

Inherited from Any

Ungrouped