diff --git a/CHANGELOG.md b/CHANGELOG.md index 7bc04007f..68b8079b5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ * Support for Scenario Outline / DataRowAttribute in MsTest adapter * Fix for #81 in which Cucumber Expressions fail when two enums or two custom types with the same short name (differing namespaces) are used as parameters * Fix: Adding @ignore to an Examples block generates invalid code for NUnit v3+ (#103) +* Fix: #111 @ignore attribute is not inherited to the scenarios from Rule # v1.0.1 - 2024-02-16 diff --git a/Reqnroll.Generator/Generation/UnitTestMethodGenerator.cs b/Reqnroll.Generator/Generation/UnitTestMethodGenerator.cs index ba2ef7e3a..252c6ca34 100644 --- a/Reqnroll.Generator/Generation/UnitTestMethodGenerator.cs +++ b/Reqnroll.Generator/Generation/UnitTestMethodGenerator.cs @@ -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( diff --git a/Tests/Reqnroll.SystemTests/Generation/GenerationTestBase.cs b/Tests/Reqnroll.SystemTests/Generation/GenerationTestBase.cs index 561f42714..1df2aff18 100644 --- a/Tests/Reqnroll.SystemTests/Generation/GenerationTestBase.cs +++ b/Tests/Reqnroll.SystemTests/Generation/GenerationTestBase.cs @@ -84,6 +84,11 @@ When the step 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"); @@ -134,6 +139,9 @@ When the step _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(); }