From fd881be4c5b12612d9523d151fa79328065c5146 Mon Sep 17 00:00:00 2001 From: Chris Rudolphi <1702962+clrudolphi@users.noreply.github.com> Date: Thu, 25 Apr 2024 10:41:08 -0500 Subject: [PATCH 1/3] Added test case with an @ignore'd Rule --- .../Reqnroll.SystemTests/Generation/GenerationTestBase.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Tests/Reqnroll.SystemTests/Generation/GenerationTestBase.cs b/Tests/Reqnroll.SystemTests/Generation/GenerationTestBase.cs index 561f42714..324a49afc 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: Rule ignored 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("Rule ignored")) + .Which.Outcome.Should().Be(expectedIgnoredOutcome); AssertIgnoredScenarioOutlineExampleHandled(); } From d070e9f0d2029faa27a53d1ca4bcddb78424abd5 Mon Sep 17 00:00:00 2001 From: Chris Rudolphi <1702962+clrudolphi@users.noreply.github.com> Date: Fri, 26 Apr 2024 10:33:29 -0500 Subject: [PATCH 2/3] Modified code generator to check ScenarioInfo.CombinedTags property --- Reqnroll.Generator/Generation/UnitTestMethodGenerator.cs | 4 +++- Tests/Reqnroll.SystemTests/Generation/GenerationTestBase.cs | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) 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 324a49afc..1df2aff18 100644 --- a/Tests/Reqnroll.SystemTests/Generation/GenerationTestBase.cs +++ b/Tests/Reqnroll.SystemTests/Generation/GenerationTestBase.cs @@ -87,7 +87,7 @@ When the step @ignore Rule: Scenario in this Rule should be Ignored - Scenario: Rule ignored scenario + Scenario: Ruleignored scenario When the step passes """); _projectsDriver.AddPassingStepBinding(stepRegex: "the step passes"); @@ -140,7 +140,7 @@ When the step passes .Should().ContainSingle(tr => tr.TestName.StartsWith("ExampleIgnored")) .Which.Outcome.Should().Be(expectedIgnoredOutcome); _vsTestExecutionDriver.LastTestExecutionResult.LeafTestResults - .Should().ContainSingle(tr => tr.TestName.StartsWith("Rule ignored")) + .Should().ContainSingle(tr => tr.TestName.StartsWith("Ruleignored")) .Which.Outcome.Should().Be(expectedIgnoredOutcome); AssertIgnoredScenarioOutlineExampleHandled(); } From 4acb87faa5163fe998c233b044e4b6145bf7beeb Mon Sep 17 00:00:00 2001 From: Chris Rudolphi <1702962+clrudolphi@users.noreply.github.com> Date: Mon, 29 Apr 2024 07:54:14 -0500 Subject: [PATCH 3/3] Updated Changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) 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