outware / Scenarios

Human-oriented testing in Swift
Apache License 2.0
20 stars 5 forks source link

Explicitly define the order in which different kinds of steps can be composed #2

Closed sharplet closed 9 years ago

sharplet commented 9 years ago

In the current implementation, Given or Then is just synactic suger, and they are semantically identical. This isn't ideal, as there is a proper grammer to when the different kinds of step should be applied.

Currently Scenario is just an untyped builder object, and you can just keep chaining of invocations of Given() or Then() to continue to append new steps. I'm thinking we could add stricter types (via protocols), to encapsulate this logic:

  1. The first step has to be Given
  2. When is optional, and if used must follow Given
  3. Then may follow either Given or When
  4. And can extend any kind of step, but preserves the current kind