-
Notifications
You must be signed in to change notification settings - Fork 84
Closed
Labels
Milestone
Description
I would like to write a test with examples.. Initial thoughts:
//https://github.com/cucumber/cucumber/wiki/Scenario-Outlines
//Scenario: eat 5 out of 20
// Given there are 20 cucumbers
// When I eat 5 cucumbers
// Then I should have 15 cucumbers
//Scenario Outline: eating
// Given there are <start> cucumbers
// When I eat <eat> cucumbers
// Then I should have <left> cucumbers
this.Given(_ => _.Start, "Given there are {0} cucumbers")
.When(_ => _.Eat, "When I eat {0} cucumbers")
.Then(_ => _.Left, "Then I should have {0} cucumbers")
.WithExamples(()=>
@"
| start | eat | left |
| 12 | 5 | 7 |
| 20 | 5 | 15 |
")
.BDDfy();
this.Given(_ => _.Start, "Given there are {0} cucumbers")
.When(_ => _.Eat, "When I eat {0} cucumbers")
.Then(_ => _.Left, "Then I should have {0} cucumbers")
.WithExamples(()=>
{
yield return new FluentExample(12, 5, 7);
yield return new FluentExample(20, 5, 15);
})
.BDDfy();
this.Given(_ => _.Start, "Given there are {0} cucumbers")
.When(_ => _.Eat, "When I eat {0} cucumbers")
.Then(_ => _.Left, "Then I should have {0} cucumbers")
.WithExamples(()=> new Examples<FluentExamples>(_ => _.Start, _ => _.Eat, _ => _.Left)
{
new[] { 12, 5, 7 },
new[] { 20, 5, 15 }
})
.BDDfy();
this.Given(_ => _.Start, "Given there are {0} cucumbers")
.When(_ => _.Eat, "When I eat {0} cucumbers")
.Then(_ => _.Left, "Then I should have {0} cucumbers")
.WithExamples(
new[] { "Start", "Eat", "Left" },
new[] { 12, 5, 7 },
new[] { 20, 5, 15 })
.BDDfy();Each example should be run once, setting the appropriate properties on the SUT. The report should format like this:
Scenario Outline: eating
Given there are <start> cucumbers
When I eat <eat> cucumbers
Then I should have <left> cucumbers
Examples:
| Start | Eat | Left |
| 12 | 5 | 7 |
| 20 | 5 | 15 |
Reactions are currently unavailable