Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 111 ignore attr not inherited from rule #113

Merged
merged 3 commits into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Reqnroll.Generator/Generation/UnitTestMethodGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -277,8 +277,10 @@ internal void GenerateTestMethodBody(TestClassGenerationContext generationContex
var tagsOfScenarioVariableReferenceExpression = new CodeVariableReferenceExpression(GeneratorConstants.SCENARIO_TAGS_VARIABLE_NAME);
var featureFileTagFieldReferenceExpression = new CodeFieldReferenceExpression(null, GeneratorConstants.FEATURE_TAGS_VARIABLE_NAME);

var scenarioCombinedTagsPropertyExpression = new CodePropertyReferenceExpression(new CodeVariableReferenceExpression("scenarioInfo"), "CombinedTags");

var tagHelperReference = new CodeTypeReferenceExpression(_codeDomHelper.GetGlobalizedTypeName(typeof(TagHelper)));
var scenarioTagIgnoredCheckStatement = new CodeMethodInvokeExpression(tagHelperReference, nameof(TagHelper.ContainsIgnoreTag), tagsOfScenarioVariableReferenceExpression);
var scenarioTagIgnoredCheckStatement = new CodeMethodInvokeExpression(tagHelperReference, nameof(TagHelper.ContainsIgnoreTag), scenarioCombinedTagsPropertyExpression);
var featureTagIgnoredCheckStatement = new CodeMethodInvokeExpression(tagHelperReference, nameof(TagHelper.ContainsIgnoreTag), featureFileTagFieldReferenceExpression);

var ifIsIgnoredStatement = new CodeConditionStatement(
Expand Down
8 changes: 8 additions & 0 deletions Tests/Reqnroll.SystemTests/Generation/GenerationTestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@ When the step <result>
Examples:
| result |
| fails |

@ignore
Rule: Scenario in this Rule should be Ignored
Scenario: Ruleignored scenario
When the step passes
""");
_projectsDriver.AddPassingStepBinding(stepRegex: "the step passes");
_projectsDriver.AddFailingStepBinding(stepRegex: "the step fails");
Expand Down Expand Up @@ -134,6 +139,9 @@ When the step <result>
_vsTestExecutionDriver.LastTestExecutionResult.LeafTestResults
.Should().ContainSingle(tr => tr.TestName.StartsWith("ExampleIgnored"))
.Which.Outcome.Should().Be(expectedIgnoredOutcome);
_vsTestExecutionDriver.LastTestExecutionResult.LeafTestResults
.Should().ContainSingle(tr => tr.TestName.StartsWith("Ruleignored"))
.Which.Outcome.Should().Be(expectedIgnoredOutcome);
AssertIgnoredScenarioOutlineExampleHandled();
}

Expand Down