public void FinalizeTestClass(TestClassGenerationContext generationContext) { _innerGenerator.FinalizeTestClass(generationContext); }
public CodeNamespace GenerateUnitTestFixture(SpecFlowDocument document, string testClassName, string targetNamespace) { var specFlowFeature = document.SpecFlowFeature; testClassName = testClassName ?? $"{specFlowFeature.Name.ToIdentifier()}Feature"; CreateNamespace(targetNamespace); CreateTestClassStructure(testClassName, document); SetupTestClass(); SetupTestClassInitializeMethod(); SetupTestClassCleanupMethod(); SetupTestInitializeMethod(); SetupTestCleanupMethod(); SetupScenarioInitializeMethod(GenerationContext); SetupScenarioStartMethod(GenerationContext); SetupFeatureBackground(GenerationContext); SetupScenarioCleanupMethod(GenerationContext); //NEW CODE START var variantTags = _variantHelper.GetFeatureVariantTagValues(specFlowFeature); _featureVariantTags = _variantHelper.FeatureTags(specFlowFeature); if (_variantHelper.AnyScenarioHasVariantTag(specFlowFeature) && _variantHelper.FeatureHasVariantTags) { throw new TestGeneratorException("Variant tags were detected at feature and scenario level, please specify at one level or the other."); } //NEW CODE END foreach (var scenarioDefinition in specFlowFeature.ScenarioDefinitions) { if (string.IsNullOrEmpty(scenarioDefinition.Name)) { throw new TestGeneratorException("The scenario must have a title specified."); } if (scenarioDefinition is ScenarioOutline scenarioOutline) { //NEW CODE START variantTags = _variantHelper.FeatureHasVariantTags ? variantTags : _variantHelper.GetScenarioVariantTagValues(scenarioDefinition); GenerateScenarioOutlineTest(GenerationContext, scenarioOutline, variantTags); } else { variantTags = _variantHelper.FeatureHasVariantTags ? variantTags : _variantHelper.GetScenarioVariantTagValues(scenarioDefinition); if (variantTags.Count > 0) { variantTags.ForEach(a => GenerateTest(GenerationContext, (Scenario)scenarioDefinition, a)); } else { GenerateTest(GenerationContext, (Scenario)scenarioDefinition, null); } //NEW CODE END } } _testGeneratorProvider.FinalizeTestClass(GenerationContext); CodeNamespace.Comments.Add(new CodeCommentStatement(new CodeComment(CustomGeneratedComment))); //NEW CODE return(CodeNamespace); }
public void FinalizeTestClass(TestClassGenerationContext generationContext) { baseGeneratorProvider.FinalizeTestClass(generationContext); }