tygerpatch / Pepper

An acceptance test tool based on JBehave and Cucumber that runs through JUnit.
0 stars 0 forks source link

Scenario Templates #1

Open tygerpatch opened 11 years ago

tygerpatch commented 11 years ago

Cucumber allows you to group similar scenarios into a Scenario Outline. The following example was taken from cucke4ninja:

Scenario Outline: third-level ninjas engage samurai   Given the ninja has a <belt level> level black-belt   When attacked by <opponent>   Then the ninja should <expected action>

  Examples:     | belt level | opponent | expected action |     | third | a samurai | engage the opponent |     | third | Chuck Norris | run for his life |

(SEE ALSO: http://cuke4ninja.com/sec_groups_of_scenarios.html)

Note: JBehave calls these Parameterized Scenarios.

Pepper should also have this feature, but I think "Scenario Template" is a more appropriate name. I also think "Content" more accurately describes that the givens values will be used inside the Scenario Template.

Here's what the Pepper equivalent of the above will look like:

# third-level ninjas engage samurai Scenario Template:   Given the ninja has a <belt level> level black-belt   When attacked by <opponent>   Then the ninja should <expected action>

  Content Table:     | belt level | opponent | expected action |     | third | a samurai | engage the opponent |     | third | Chuck Norris | run for his life |

tygerpatch commented 11 years ago

Ignore the part about the issue being Closed. I'm still new to using github's issue tracking feature.

This issue almost fixed. The next step is to allow multiple use cases:

# submit guess Scenario Template:   Given the secret code is "<code>"   When I guess "<guess>"   Then the mark should be "<mark>"

  # no matches   Content Table:     |code|guess|mark|     |1234|5555| |

  # 1 number correct   Content Table:     |code| guess | mark |     |1234|1555| + |     |1234|2555| - |

Note: The above was derived from page 51 of David Chelimsky's "The RSpec Book"