at any point in time a regex sequence can be transformed as a sequence of Fragments
at any point in time a regex sequence can be transformed as a sequence of Fragments
implicit conversion to transform a Given[Y] to Given[X] when Y <: X
implicit conversion to transform a Given[Y] to Given[X] when Y <: X
implicit conversion to transform a Then[Y] to Then[X] when Y <: X
implicit conversion to transform a Then[Y] to Then[X] when Y <: X
implicit conversion to transform a When[P, Q] to When[R, S] when R <: P and S >: Q
implicit conversion to transform a When[P, Q] to When[R, S] when R <: P and S >: Q
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
Givenstep to aText:"name: ${user}" ^ givenNameThis creates a PreStep object containing the current context (representing all the extracted values) and a list of Fragments containing:
Text("name: ${user}")${}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
Whenstep 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
Thenstep is added, a sequence of PostStep/PostStepText objects is created. Those objects use the current context and the results returned by theThenobjects to create Examples.The last PostStep object contains the list of all fragments created by the Given/When/Then sequence: