This repository has been archived by the owner on Jun 12, 2021. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 46
Skipping steps and scenarios
Adam Ralph edited this page Feb 23, 2018
·
5 revisions
In the event you want to commit an unfinished scenario, in order to keep your test suite green, you may want to temporarily skip a step within a scenario:
[Scenario]
public void Addition(int x, int y, Calculator calculator, int answer)
{
"Given the number 1"
.x(() => x = 1);
"And the number 2"
.x(() => y = 2);
"And a calculator"
.x(() => calculator = new Calculator());
"When I add the numbers together"
.x(() => answer = calculator.Add(x, y));
"Then the answer is 3"
.x(() => Assert.Equal(3, answer))
.Skip("I've almost got this addition thing working, I just can't quite get the right numbers out.");
}
or perhaps things are so bad right now you need to temporarily skip an entire scenario:
[Scenario(Skip = "I just can't work out this addition business yet, I'm getting exceptions thrown everywhere.")]
public void Addition(int x, int y, Calculator calculator, int answer)
{
"Given the number 1"
.x(() => x = 1);
"And the number 2"
.x(() => y = 2);
"And a calculator"
.x(() => calculator = new Calculator());
"When I add the numbers together"
.x(() => answer = calculator.Add(x, y));
"Then the answer is 3"
.x(() => Assert.Equal(3, answer));
}