Esempio n. 1
0
        public void IsScenarioIgnored_Does_Not_Treat_Ignored_If_No_Ignore_Tag()
        {
            //arrange.
            var featureTags = new Gherkin.Ast.Tag[]
            {
                new Gherkin.Ast.Tag(null, "featuretag-1"),
                new Gherkin.Ast.Tag(null, "featuretag-2")
            };

            var scenarioTags = new Gherkin.Ast.Tag[]
            {
                new Gherkin.Ast.Tag(null, "scenarioTag-1"),
                new Gherkin.Ast.Tag(null, "scenarioTag-2"),
                new Gherkin.Ast.Tag(null, "scenarioTag-3")
            };

            var scenarioName = "scenario name 123";

            var feature = new Gherkin.Ast.Feature(
                featureTags, null, null, null, null, null,
                new Gherkin.Ast.ScenarioDefinition[]
            {
                new Gherkin.Ast.Scenario(scenarioTags, null, null, scenarioName, null, null)
            });

            //act.
            var isIgnored = feature.IsScenarioIgnored(scenarioName);

            //assert.
            Assert.False(isIgnored);
        }
Esempio n. 2
0
        public void GetScenarioTags_Retrieves_Tags_Of_Feature_And_Scenario_Combined()
        {
            //arrange.
            var featureTags = new Gherkin.Ast.Tag[]
            {
                new Gherkin.Ast.Tag(null, "featuretag-1"),
                new Gherkin.Ast.Tag(null, "featuretag-2")
            };

            var scenarioTags = new Gherkin.Ast.Tag[]
            {
                new Gherkin.Ast.Tag(null, "scenarioTag-1"),
                new Gherkin.Ast.Tag(null, "scenarioTag-2"),
                new Gherkin.Ast.Tag(null, "scenarioTag-3")
            };

            var scenarioName = "scenario name 123";

            var feature = new Gherkin.Ast.Feature(
                featureTags, null, null, null, null, null,
                new Gherkin.Ast.ScenarioDefinition[]
            {
                new Gherkin.Ast.Scenario(scenarioTags, null, null, scenarioName, null, null)
            });

            //act.
            var scenarioTagNames = feature.GetScenarioTags(scenarioName);

            //assert.
            Assert.NotNull(scenarioTagNames);

            var expectedTagNames = featureTags.Union(scenarioTags).Select(t => t.Name);

            Assert.Equal(expectedTagNames, scenarioTagNames);
        }
Esempio n. 3
0
        public void IsScenarioIgnored_Treats_Ignored_If_Scenario_Is_Ignored()
        {
            //arrange.
            var featureTags = new Gherkin.Ast.Tag[]
            {
                new Gherkin.Ast.Tag(null, "featuretag-1"),
                new Gherkin.Ast.Tag(null, "featuretag-2")
            };

            var scenarioTags = new Gherkin.Ast.Tag[]
            {
                new Gherkin.Ast.Tag(null, "scenarioTag-1"),
                new Gherkin.Ast.Tag(null, GherkinFeatureExtensions.IgnoreTag),
                new Gherkin.Ast.Tag(null, "scenarioTag-3")
            };

            var scenarioName = "scenario name 123";

            var feature = new Gherkin.Ast.Feature(
                featureTags, null, null, null, null, null,
                new Gherkin.Ast.ScenarioDefinition[]
            {
                new Gherkin.Ast.Scenario(scenarioTags, null, null, scenarioName, null, null)
            });

            //act.
            var isIgnored = feature.IsScenarioIgnored(scenarioName);

            //assert.
            Assert.True(isIgnored);
        }
        private static Gherkin.Ast.Scenario CreateTestScenario()
        {
            var tags = new Gherkin.Ast.Tag[] { new Gherkin.Ast.Tag(null, "test") };
            var location = new Gherkin.Ast.Location(1, 1);
            var steps = new Gherkin.Ast.Step[] { new Gherkin.Ast.Step(null, null, "step", null) };

            return new Gherkin.Ast.Scenario(tags, location, "keyword", "name", "description", steps);            
        }
Esempio n. 5
0
        public void GetExamplesTags_Retrieves_Tags_Of_Feature_And_OutLine_And_Examples_Combined()
        {
            //arrange.
            var featureTags = new Gherkin.Ast.Tag[]
            {
                new Gherkin.Ast.Tag(null, "featuretag-1"),
                new Gherkin.Ast.Tag(null, "featuretag-2")
            };

            var outlineTags = new Gherkin.Ast.Tag[]
            {
                new Gherkin.Ast.Tag(null, "outlinetag-1"),
                new Gherkin.Ast.Tag(null, "outlinetag-2"),
                new Gherkin.Ast.Tag(null, "outlinetag-3")
            };

            var examplesTags = new Gherkin.Ast.Tag[]
            {
                new Gherkin.Ast.Tag(null, "examplestag-1"),
                new Gherkin.Ast.Tag(null, "examplestag-2"),
                new Gherkin.Ast.Tag(null, "examplestag-2"),
                new Gherkin.Ast.Tag(null, "examplestag-3")
            };

            var scenarioOutlineName = "scenario name 123";
            var examplesName        = "examples name 123";

            var feature = new Gherkin.Ast.Feature(
                featureTags, null, null, null, null, null,
                new Gherkin.Ast.ScenarioDefinition[]
            {
                new Gherkin.Ast.ScenarioOutline(outlineTags, null, null, scenarioOutlineName, null, null,
                                                new Gherkin.Ast.Examples[]
                {
                    new Gherkin.Ast.Examples(examplesTags, null, null, examplesName, null, null, null)
                })
            });

            //act.
            var examplesTagNames = feature.GetExamplesTags(scenarioOutlineName, examplesName);

            //assert.
            Assert.NotNull(examplesTagNames);

            var expectedTagNames = featureTags.Union(outlineTags).Union(examplesTags).Select(t => t.Name);

            Assert.Equal(expectedTagNames, examplesTagNames);
        }
Esempio n. 6
0
        public void IsExamplesIgnored_Treats_Ignored_If_Examples_Is_Ignored()
        {
            //arrange.
            var featureTags = new Gherkin.Ast.Tag[]
            {
                new Gherkin.Ast.Tag(null, "featuretag-1"),
                new Gherkin.Ast.Tag(null, "featuretag-2")
            };

            var outlineTags = new Gherkin.Ast.Tag[]
            {
                new Gherkin.Ast.Tag(null, "outlinetag-1"),
                new Gherkin.Ast.Tag(null, "outlinetag-2"),
                new Gherkin.Ast.Tag(null, "outlinetag-3")
            };

            var examplesTags = new Gherkin.Ast.Tag[]
            {
                new Gherkin.Ast.Tag(null, "examplestag-1"),
                new Gherkin.Ast.Tag(null, "examplestag-2"),
                new Gherkin.Ast.Tag(null, GherkinFeatureExtensions.IgnoreTag),
                new Gherkin.Ast.Tag(null, "examplestag-3")
            };

            var scenarioOutlineName = "scenario name 123";
            var examplesName        = "examples name 123";

            var feature = new Gherkin.Ast.Feature(
                featureTags, null, null, null, null, null,
                new Gherkin.Ast.ScenarioDefinition[]
            {
                new Gherkin.Ast.ScenarioOutline(outlineTags, null, null, scenarioOutlineName, null, null,
                                                new Gherkin.Ast.Examples[]
                {
                    new Gherkin.Ast.Examples(examplesTags, null, null, examplesName, null, null, null)
                })
            });

            //act.
            var isIgnored = feature.IsExamplesIgnored(scenarioOutlineName, examplesName);

            //assert.
            Assert.True(isIgnored);
        }