Esempio n. 1
0
        public IEnumerable <IXunitTestCase> Discover(
            ITestFrameworkDiscoveryOptions discoveryOptions,
            ITestMethod testMethod,
            IAttributeInfo factAttribute)
        {
            var feature = new FeatureDiscoveryModel(new FeatureFileRepository("*.feature")).Discover(testMethod.TestClass.Class.ToRuntimeType());

            foreach (var scenarioOutline in feature.Children.OfType <ScenarioOutline>())
            {
                foreach (var example in scenarioOutline.Examples)
                {
                    var rowIndex = 0;
                    foreach (var row in example.TableBody)
                    {
                        var tags = feature.GetExamplesTags(scenarioOutline.Name, example.Name);
                        var skip = feature.IsExamplesIgnored(scenarioOutline.Name, example.Name);

                        yield return(new ScenarioXunitTestCase(
                                         _messageSink,
                                         testMethod,
                                         feature.Name,
                                         !string.IsNullOrWhiteSpace(example.Name)
                                ? $"{scenarioOutline.Name} :: {example.Name} :: #{rowIndex + 1}"
                                : $"{scenarioOutline.Name} :: #{rowIndex + 1}",
                                         tags,
                                         skip,
                                         new object[] { scenarioOutline.Name, example.Name, rowIndex }));

                        rowIndex++;
                    }
                }
            }
        }
        public IEnumerable <IXunitTestCase> Discover(
            ITestFrameworkDiscoveryOptions discoveryOptions,
            ITestMethod testMethod,
            IAttributeInfo factAttribute)
        {
            var feature = new FeatureDiscoveryModel(new FeatureFileRepository("*.feature")).Discover(testMethod.TestClass.Class.ToRuntimeType());

            foreach (var scenario in feature.Children.OfType <global::Gherkin.Ast.Scenario>())
            {
                var  tags = feature.GetScenarioTags(scenario.Name);
                bool skip = feature.IsScenarioIgnored(scenario.Name);

                yield return(new ScenarioXunitTestCase(
                                 _messageSink,
                                 testMethod,
                                 feature.Name,
                                 scenario.Name,
                                 tags,
                                 skip,
                                 new object[] { scenario.Name }));
            }
        }