diff --git a/src/xRetry.SpecFlow/TestGeneratorProvider.cs b/src/xRetry.SpecFlow/TestGeneratorProvider.cs index 47a960b..0362dfe 100644 --- a/src/xRetry.SpecFlow/TestGeneratorProvider.cs +++ b/src/xRetry.SpecFlow/TestGeneratorProvider.cs @@ -24,6 +24,8 @@ public TestGeneratorProvider(CodeDomHelper codeDomHelper, ProjectSettings projec this.retryTagParser = retryTagParser; } + // Called for scenario outlines, even when it has no tags. + // We don't yet have access to tags against the scenario at this point, but can handle feature tags now. public override void SetRowTest(TestClassGenerationContext generationContext, CodeMemberMethod testMethod, string scenarioTitle) { base.SetRowTest(generationContext, testMethod, scenarioTitle); @@ -33,6 +35,8 @@ public override void SetRowTest(TestClassGenerationContext generationContext, Co applyRetry(featureTags, Enumerable.Empty(), testMethod); } + // Called for scenarios, even when it has no tags. + // We don't yet have access to tags against the scenario at this point, but can handle feature tags now. public override void SetTestMethod(TestClassGenerationContext generationContext, CodeMemberMethod testMethod, string friendlyTestName) { base.SetTestMethod(generationContext, testMethod, friendlyTestName); @@ -42,6 +46,7 @@ public override void SetTestMethod(TestClassGenerationContext generationContext, applyRetry(featureTags, Enumerable.Empty(), testMethod); } + // Called for both scenarios & scenario outlines, but only if it has tags public override void SetTestMethodCategories(TestClassGenerationContext generationContext, CodeMemberMethod testMethod, IEnumerable scenarioCategories) { @@ -50,6 +55,7 @@ public override void SetTestMethodCategories(TestClassGenerationContext generati base.SetTestMethodCategories(generationContext, testMethod, scenarioCategories); + // Feature tags will have already been processed in one of the methods above, which are executed before this IEnumerable featureTags = generationContext.Feature.Tags.Select(t => stripLeadingAtSign(t.Name)); applyRetry((string[]) scenarioCategories, featureTags, testMethod); }