trait
RegexSteps extends AnyRef
Value Members
-
final
def
!=(arg0: AnyRef): Boolean
-
final
def
!=(arg0: Any): Boolean
-
final
def
##(): Int
-
final
def
==(arg0: AnyRef): Boolean
-
final
def
==(arg0: Any): Boolean
-
implicit
def
RegexFragmentToFragments(r: RegexFragment): Fragments
-
final
def
asInstanceOf[T0]: T0
-
def
clone(): AnyRef
-
implicit
def
downcastGiven[X, Y <: X](gv: Given[Y]): Given[X] { def extract(s: String): Y }
-
final
def
eq(arg0: AnyRef): Boolean
-
def
equals(arg0: Any): Boolean
-
def
finalize(): Unit
-
final
def
getClass(): Class[_]
-
def
hashCode(): Int
-
final
def
isInstanceOf[T0]: Boolean
-
final
def
ne(arg0: AnyRef): Boolean
-
final
def
notify(): Unit
-
final
def
notifyAll(): Unit
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
-
def
toString(): String
-
implicit
def
upcastThen[X, Y <: X](th: Then[X]): Then[Y]
-
implicit
def
updowncastWhen[P, Q, R <: P, S >: Q](wh: When[P, Q]): When[R, S]
-
final
def
wait(): Unit
-
final
def
wait(arg0: Long, arg1: Int): Unit
-
final
def
wait(arg0: Long): Unit
Inherited from AnyRef
Inherited from Any
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 aText
:"name: ${user}" ^ givenName
This 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
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 theThen
objects to create Examples.The last PostStep object contains the list of all fragments created by the Given/When/Then sequence: