Skip to content

Commit a2a145d

Browse files
committed
ReqnrollFormatters.Standard: Add DynamicIgnore
1 parent ee8b1ed commit a2a145d

File tree

3 files changed

+57
-1
lines changed

3 files changed

+57
-1
lines changed

ReqnrollFormatters/ReqnrollFormatters.Standard/Features/Basics.feature

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Scenario: Passing scenario
1515
Scenario: Failing scenario
1616
When I do something
1717
Then the scenario fails
18+
And nothing else matters
1819

1920
Scenario Outline: Outline with multiple examples
2021
Given the first parameter is "<param>"
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
@dynamicignore
2+
Feature: DynamicIgnore
3+
4+
@ignore
5+
Scenario: Ignored scenario
6+
When I do something
7+
8+
Scenario Outline: Outline with ignored examples
9+
Given the first parameter is "<param>"
10+
And <other param> is the second parameter
11+
When I do something
12+
Then the scenario <result>
13+
Examples:
14+
| param | other param | result |
15+
| foo bar | 12 | passes |
16+
@ignore
17+
Examples: Ignored tests
18+
| param | other param | result |
19+
| hello | 12 | passes |
20+
21+
Scenario: Dynamically ignored
22+
Given the scenario is ignored
23+
When I do something
24+
25+
Scenario: Dynamically marked inconclusive
26+
Given the scenario is marked inconclusive
27+
When I do something
28+
29+
Scenario: Pending scenario
30+
Given the scenario is pending
31+
When I do something

ReqnrollFormatters/ReqnrollFormatters.Standard/StepDefinitions/ProjectStepDefinitions.cs

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
using Reqnroll;
2+
using Reqnroll.UnitTestProvider;
23

34
namespace ReqnrollFormatters.Standard.StepDefinitions;
45

56
[Binding]
6-
public sealed class ProjectStepDefinitions(IReqnrollOutputHelper outputHelper)
7+
public sealed class ProjectStepDefinitions(IReqnrollOutputHelper outputHelper, ScenarioContext scenarioContext)
78
{
89
[When("I do something")]
910
public void WhenIDoSomething()
@@ -16,6 +17,11 @@ public void ThenTheScenarioFails()
1617
throw new Exception("simulated error");
1718
}
1819

20+
[Then("nothing else matters")]
21+
public void ThenNothingElseMatters()
22+
{
23+
}
24+
1925
[Given("the first parameter is {string}")]
2026
public void GivenTheFirstParameterIs(string firstParam)
2127
{
@@ -54,4 +60,22 @@ public void AfterAttachmentScenario()
5460
{
5561
outputHelper.WriteLine("after attachment scenario hook executed");
5662
}
63+
64+
[Given("the scenario is ignored")]
65+
public void GivenTheScenarioIsIgnored()
66+
{
67+
scenarioContext.ScenarioContainer.Resolve<IUnitTestRuntimeProvider>().TestIgnore("This is ignored!");
68+
}
69+
70+
[Given("the scenario is marked inconclusive")]
71+
public void GivenTheScenarioIsMarkedInconclusive()
72+
{
73+
scenarioContext.ScenarioContainer.Resolve<IUnitTestRuntimeProvider>().TestIgnore("This is inconclusive!");
74+
}
75+
76+
[Given("the scenario is pending")]
77+
public void GivenTheScenarioIsPending()
78+
{
79+
throw new PendingStepException();
80+
}
5781
}

0 commit comments

Comments
 (0)