private FeatureResults Run(IFeatureRunner featureRunner, IEnumerable<Feature> features, IRunContext context) { var result = new FeatureResults(); foreach (Feature feature in features) { FeatureResult featureResult = null; try { context.FeatureStarted(feature); featureResult = featureRunner.Run(feature); result.Add(featureResult); } finally { context.FeatureFinished(featureResult); } } return result; }
private FeatureResults Run(IFeatureRunner featureRunner, IEnumerable <Feature> features, IRunContext context) { var result = new FeatureResults(); foreach (Feature feature in features) { FeatureResult featureResult = null; try { context.FeatureStarted(feature); featureResult = featureRunner.Run(feature); result.Add(featureResult); } finally { context.FeatureFinished(featureResult); } } return(result); }
public void Execute(CommandLineArguments arguments) { var assemblyPath = arguments.AssemblyPath; var featurePattern = arguments.FeaturePattern; featureRunner.AddListener(new ConsoleWritingEventListener { ShowCurrentTimes = arguments.ShowCurrentTime, }); var filter = new TagFilter(arguments.TagsToInclude, arguments.TagsToExclude); var featuresToRun = featureFileFinder.Find(featurePattern) .SelectMany(fileName => gherkinParser.Parse(fileName, fileReader.Read(fileName, Encoding.UTF8)).Features) .Where(f => filter.IsSatisfiedBy(f.Tags)); Console.WriteLine("Found {0} features containing {1} executable scenarios", featuresToRun.Count(), featuresToRun.Sum(f => f.Scenarios.Count)); var actionStepsTypes = actionStepsFinder.FindTypesWithActionSteps(assemblyPath); var options = new RunnerOptions { Filter = filter, DruRun = arguments.DruRun, SuccessRequired = arguments.SuccessRequired, }; foreach (var feature in featuresToRun) { var featureResult = featureRunner.Run(feature, actionStepsTypes, options); if (options.SuccessRequired && !featureResult.Success) { break; } } }