Exemplo n.º 1
0
 public DirectoryTreeCrawler(FeatureParser featureParser, RelevantFileDetector relevantFileDetector,
                             FeatureNodeFactory featureNodeFactory)
 {
     this.featureParser = featureParser;
     this.relevantFileDetector = relevantFileDetector;
     this.featureNodeFactory = featureNodeFactory;
 }
Exemplo n.º 2
0
 public FeatureNodeFactory(RelevantFileDetector relevantFileDetector, FeatureParser featureParser, HtmlMarkdownFormatter htmlMarkdownFormatter, IFileSystem fileSystem)
 {
     this.relevantFileDetector  = relevantFileDetector;
     this.featureParser         = featureParser;
     this.htmlMarkdownFormatter = htmlMarkdownFormatter;
     this.fileSystem            = fileSystem;
 }
Exemplo n.º 3
0
 public DirectoryTreeCrawler(FeatureParser featureParser, RelevantFileDetector relevantFileDetector,
                             FeatureNodeFactory featureNodeFactory)
 {
     this.featureParser        = featureParser;
     this.relevantFileDetector = relevantFileDetector;
     this.featureNodeFactory   = featureNodeFactory;
 }
Exemplo n.º 4
0
 public FeatureNodeFactory(RelevantFileDetector relevantFileDetector, FeatureParser featureParser, HtmlMarkdownFormatter htmlMarkdownFormatter, IFileSystem fileSystem)
 {
     this.relevantFileDetector = relevantFileDetector;
     this.featureParser = featureParser;
     this.htmlMarkdownFormatter = htmlMarkdownFormatter;
     this.fileSystem = fileSystem;
 }
Exemplo n.º 5
0
        public void ThenShouldLocalizeExamplesKeyword()
        {
            string featureText =
                @"# language: nl-NL
Functionaliteit: Test het abstract scenario

Abstract Scenario: Het Scenario
    Stel dat ik 50 ingeef
    En dat ik 70 ingeef
    Als ik plus druk
    Dan moet het resultaat 120 zijn

Voorbeelden:
    | a |
    | 1 |
    | 2 |
";

            var     parser  = new FeatureParser(this.Configuration);
            Feature feature = parser.Parse(new StringReader(featureText));

            var formatter = Container.Resolve <HtmlFeatureFormatter>();
            var output    = formatter.Format(feature);

            var value = output.ToString();

            Check.That(value).Contains("Voorbeelden");
        }
        public void ThenCanParseMostBasicFeatureSuccessfully()
        {
            string featureText =
                @"# language: sv
# ignorera denna kommentar
Egenskap: Test egenskap
  Som svensk användare
  Vill jag skriva mina krav på svenska
  Så att beställaren kan förstå dem

  Scenario: Ett scenario
        Givet en egenskap
        När den körs
        Så skall jag se att det inträffat";

            var configuration = new Configuration
            {
                Language = "sv"
            };

            var     parser  = new FeatureParser(FileSystem);
            Feature feature = parser.Parse(new StringReader(featureText));

            Check.That(feature).IsNotNull();
            Check.That(feature.Name).IsEqualTo("Test egenskap");
            Check.That(feature.Description.ComparisonNormalize()).IsEqualTo(@"  Som svensk användare
  Vill jag skriva mina krav på svenska
  Så att beställaren kan förstå dem".ComparisonNormalize());
            Check.That(feature.FeatureElements.Count).IsEqualTo(1);
            Check.That(feature.Tags.Count).IsEqualTo(0);

            IFeatureElement scenario = feature.FeatureElements.First();

            Check.That(scenario.Name).IsEqualTo("Ett scenario");
            Check.That(scenario.Description).IsEqualTo(string.Empty);
            Check.That(scenario.Steps.Count).IsEqualTo(3);
            Check.That(scenario.Tags.Count).IsEqualTo(0);

            Step givenStep = scenario.Steps[0];

            Check.That(givenStep.Keyword).IsEqualTo(Keyword.Given);
            Check.That(givenStep.Name).IsEqualTo("en egenskap");
            Check.That(givenStep.DocStringArgument).IsNull();
            Check.That(givenStep.TableArgument).IsNull();

            Step whenStep = scenario.Steps[1];

            Check.That(whenStep.Keyword).IsEqualTo(Keyword.When);
            Check.That(whenStep.Name).IsEqualTo("den körs");
            Check.That(whenStep.DocStringArgument).IsNull();
            Check.That(whenStep.TableArgument).IsNull();

            Step thenStep = scenario.Steps[2];

            Check.That(thenStep.Keyword).IsEqualTo(Keyword.Then);
            Check.That(thenStep.Name).IsEqualTo("skall jag se att det inträffat");
            Check.That(thenStep.DocStringArgument).IsNull();
            Check.That(thenStep.TableArgument).IsNull();
        }
Exemplo n.º 7
0
        public void IHaveThisFeatureDescription(string featureDescription)
        {
            FeatureParser parser = new FeatureParser(this.FileSystem);

            var feature = parser.Parse(new StringReader(featureDescription));

            this.nodes = new GeneralTree <INode>(new FeatureNode(this.FileSystem.DirectoryInfo.FromDirectoryName(@"c:\output\"), string.Empty, feature));
        }
Exemplo n.º 8
0
        public void IHaveThisFeatureDescription(string featureDescription)
        {
            FeatureParser parser = new FeatureParser(this.FileSystem);

            var feature = parser.Parse(new StringReader(featureDescription));

            this.nodes = new GeneralTree<INode>(new FeatureNode(this.FileSystem.DirectoryInfo.FromDirectoryName(@"c:\output\"), string.Empty, feature));
        }
        public void ThenCanParseMostBasicFeatureSuccessfully()
        {
            string featureText =
                @"# ignorera denna kommentar
Egenskap: Test egenskap
    Som svensk användare
    Vill jag skriva mina krav på svenska
    Så att beställaren kan förstå dem

  Scenario: Ett scenario
        Givet en egenskap
        När den körs
        Så skall jag se att det inträffat";

            var configuration = new Configuration
            {
                Language = "sv"
            };

            var     parser  = new FeatureParser(new LanguageServices(configuration), FileSystem);
            Feature feature = parser.Parse(new StringReader(featureText));

            feature.ShouldNotBeNull();
            feature.Name.ShouldEqual("Test egenskap");
            feature.Description.ShouldEqual(@"  Som svensk användare
  Vill jag skriva mina krav på svenska
  Så att beställaren kan förstå dem");
            feature.FeatureElements.Count.ShouldEqual(1);
            feature.Tags.Count.ShouldEqual(0);

            IFeatureElement scenario = feature.FeatureElements.First();

            scenario.Name.ShouldEqual("Ett scenario");
            scenario.Description.ShouldEqual(string.Empty);
            scenario.Steps.Count.ShouldEqual(3);
            scenario.Tags.Count.ShouldEqual(0);

            Step givenStep = scenario.Steps[0];

            givenStep.Keyword.ShouldEqual(Keyword.Given);
            givenStep.Name.ShouldEqual("en egenskap");
            givenStep.DocStringArgument.ShouldBeNull();
            givenStep.TableArgument.ShouldBeNull();

            Step whenStep = scenario.Steps[1];

            Assert.AreEqual(Keyword.When, whenStep.Keyword);
            Assert.AreEqual("den körs", whenStep.Name);
            whenStep.DocStringArgument.ShouldBeNull();
            whenStep.TableArgument.ShouldBeNull();

            Step thenStep = scenario.Steps[2];

            thenStep.Keyword.ShouldEqual(Keyword.Then);
            thenStep.Name.ShouldEqual("skall jag se att det inträffat");
            thenStep.DocStringArgument.ShouldBeNull();
            thenStep.TableArgument.ShouldBeNull();
        }
Exemplo n.º 10
0
        public void Parse_InvalidFeatureContent_ThrowsFeatureParseException()
        {
            var parser = new FeatureParser(Configuration);

            var reader = new System.IO.StringReader("Invalid feature file");

            Check.ThatCode(() => parser.Parse(reader)).Throws <FeatureParseException>()
            .WithMessage("Unable to parse feature");
        }
Exemplo n.º 11
0
        public void IHaveThisFeatureDescription(string featureDescription)
        {
            var           configuration = this.Configuration;
            FeatureParser parser        = new FeatureParser(configuration);

            var feature = parser.Parse(new StringReader(featureDescription));

            this.nodes = new Tree(new FeatureNode(this.FileSystem.DirectoryInfo.FromDirectoryName(@"c:\output\"), string.Empty, feature));
        }
Exemplo n.º 12
0
        public void IHaveThisFeatureDescription(string featureDescription)
        {
            var configuration = this.Container.Resolve<IConfiguration>();
            FeatureParser parser = new FeatureParser(this.FileSystem, configuration);

            var feature = parser.Parse(new StringReader(featureDescription));

            this.nodes = new GeneralTree<INode>(new FeatureNode(this.FileSystem.DirectoryInfo.FromDirectoryName(@"c:\output\"), string.Empty, feature));
        }
        public void ThenCanParseMostBasicFeatureSuccessfully()
        {
            string featureText =
                @"# language: sv
# ignorera denna kommentar
Egenskap: Test egenskap
  Som svensk användare
  Vill jag skriva mina krav på svenska
  Så att beställaren kan förstå dem

  Scenario: Ett scenario
        Givet en egenskap
        När den körs
        Så skall jag se att det inträffat";

            var configuration = new Configuration
            {
                Language = "sv"
            };

            var parser = new FeatureParser(FileSystem);
            Feature feature = parser.Parse(new StringReader(featureText));

            Check.That(feature).IsNotNull();
            Check.That(feature.Name).IsEqualTo("Test egenskap");
            Check.That(feature.Description.ComparisonNormalize()).IsEqualTo(@"  Som svensk användare
  Vill jag skriva mina krav på svenska
  Så att beställaren kan förstå dem".ComparisonNormalize());
            Check.That(feature.FeatureElements.Count).IsEqualTo(1);
            Check.That(feature.Tags.Count).IsEqualTo(0);

            IFeatureElement scenario = feature.FeatureElements.First();
            Check.That(scenario.Name).IsEqualTo("Ett scenario");
            Check.That(scenario.Description).IsEqualTo(string.Empty);
            Check.That(scenario.Steps.Count).IsEqualTo(3);
            Check.That(scenario.Tags.Count).IsEqualTo(0);

            Step givenStep = scenario.Steps[0];
            Check.That(givenStep.Keyword).IsEqualTo(Keyword.Given);
            Check.That(givenStep.Name).IsEqualTo("en egenskap");
            Check.That(givenStep.DocStringArgument).IsNull();
            Check.That(givenStep.TableArgument).IsNull();

            Step whenStep = scenario.Steps[1];
            Check.That(whenStep.Keyword).IsEqualTo(Keyword.When);
            Check.That(whenStep.Name).IsEqualTo("den körs");
            Check.That(whenStep.DocStringArgument).IsNull();
            Check.That(whenStep.TableArgument).IsNull();

            Step thenStep = scenario.Steps[2];
            Check.That(thenStep.Keyword).IsEqualTo(Keyword.Then);
            Check.That(thenStep.Name).IsEqualTo("skall jag se att det inträffat");
            Check.That(thenStep.DocStringArgument).IsNull();
            Check.That(thenStep.TableArgument).IsNull();
        }
Exemplo n.º 14
0
        Feature Parse(string FeatureFilePath, string Content)
        {
            Project.LoadFrom(FeatureItem);

            var FeatureFile = new FeatureFile(FeatureFilePath)
            {
                Content = Content
            };

            return(FeatureParser.FeatureFrom(FeatureFile, FeatureItem));
        }
        public void ThenCanParseMostBasicFeatureSuccessfully()
        {
            string featureText =
                @"# ignorera denna kommentar
Egenskap: Test egenskap
    Som svensk användare
    Vill jag skriva mina krav på svenska
    Så att beställaren kan förstå dem

	Scenario: Ett scenario
        Givet en egenskap
        När den körs
        Så skall jag se att det inträffat";

            var configuration = new Configuration
                                    {
                                        Language = "sv"
                                    };

            var parser = new FeatureParser(new LanguageServices(configuration));
            Feature feature = parser.Parse(new StringReader(featureText));

            feature.ShouldNotBeNull();
            feature.Name.ShouldEqual("Test egenskap");
            feature.Description.ShouldEqual(@"  Som svensk användare
  Vill jag skriva mina krav på svenska
  Så att beställaren kan förstå dem");
            feature.FeatureElements.Count.ShouldEqual(1);
            feature.Tags.Count.ShouldEqual(0);

            IFeatureElement scenario = feature.FeatureElements.First();
            scenario.Name.ShouldEqual("Ett scenario");
            scenario.Description.ShouldEqual(string.Empty);
            scenario.Steps.Count.ShouldEqual(3);
            scenario.Tags.Count.ShouldEqual(0);

            Step givenStep = scenario.Steps[0];
            givenStep.Keyword.ShouldEqual(Keyword.Given);
            givenStep.Name.ShouldEqual("en egenskap");
            givenStep.DocStringArgument.ShouldBeNull();
            givenStep.TableArgument.ShouldBeNull();

            Step whenStep = scenario.Steps[1];
            Assert.AreEqual(Keyword.When, whenStep.Keyword);
            Assert.AreEqual("den körs", whenStep.Name);
            whenStep.DocStringArgument.ShouldBeNull();
            whenStep.TableArgument.ShouldBeNull();

            Step thenStep = scenario.Steps[2];
            thenStep.Keyword.ShouldEqual(Keyword.Then);
            thenStep.Name.ShouldEqual("skall jag se att det inträffat");
            thenStep.DocStringArgument.ShouldBeNull();
            thenStep.TableArgument.ShouldBeNull();
        }
Exemplo n.º 16
0
        public void WhenIndicatingTheLanguageAndCultureInTheFeature_ThenCanParseTheFeature()
        {
            string featureText =
                @"# language: nl-BE
Functionaliteit: Test de Cultuur

Scenario: Het Scenario
    Stel dat ik 50 ingeef
    En dat ik 70 ingeef
    Als ik plus druk
    Dan moet het resultaat 120 zijn";

            var     configuration = this.Configuration;
            var     parser        = new FeatureParser(FileSystem, configuration);
            Feature feature       = parser.Parse(new StringReader(featureText));

            Check.That(feature).IsNotNull();
        }
Exemplo n.º 17
0
        public void SetUp()
        {
            Feature = Actors.FeatureWithStepDefinitions;
            Step = Feature.Steps.First();

            Feature.Content =
            @"
                Feature: Name
                Scenario: Name
            ";

            FeatureParser = Create.TestObjectFor<FeatureParser>();

            ObjectFactory.Return<FeatureParserClass>(FeatureParser);

            Given.That(FeatureParser)
                .IgnoringArgs()
                .FeatureFrom("", null)
                .WillReturn(Feature);
        }
Exemplo n.º 18
0
        public void SetUp()
        {
            Feature = Actors.FeatureWithStepDefinitions;
            Step    = Feature.Steps.First();

            Feature.Content =
                @"
                Feature: Name
                Scenario: Name
            ";

            FeatureParser = Create.TestObjectFor <FeatureParser>();

            ObjectFactory.Return <FeatureParserClass>(FeatureParser);

            Given.That(FeatureParser)
            .IgnoringArgs()
            .FeatureFrom("", null)
            .WillReturn(Feature);
        }
Exemplo n.º 19
0
        public void Then_can_parse_scenario_with_tags_successfully()
        {
            string featureText =
                @"# ignore this comment
@feature-tag
Feature: Test
    In order to do something
    As a user
    I want to run this scenario

    @scenario-tag-1 @scenario-tag-2
	Scenario: A scenario
		Given some feature
		When it runs
		Then I should see that this thing happens"        ;

            var     parser  = new FeatureParser(new LanguageServices(new Configuration()));
            Feature feature = parser.Parse(new StringReader(featureText));

            Assert.AreEqual("@feature-tag", feature.Tags[0]);
            Assert.AreEqual("@scenario-tag-1", feature.FeatureElements[0].Tags[0]);
            Assert.AreEqual("@scenario-tag-2", feature.FeatureElements[0].Tags[1]);
        }
Exemplo n.º 20
0
        public void Then_can_parse_scenario_with_tags_successfully()
        {
            string featureText =
                @"# ignore this comment
@feature-tag
Feature: Test
    In order to do something
    As a user
    I want to run this scenario

    @scenario-tag-1 @scenario-tag-2
	Scenario: A scenario
		Given some feature
		When it runs
		Then I should see that this thing happens";

            var parser = new FeatureParser(new LanguageServices(new Configuration()));
            Feature feature = parser.Parse(new StringReader(featureText));

            Assert.AreEqual("@feature-tag", feature.Tags[0]);
            Assert.AreEqual("@scenario-tag-1", feature.FeatureElements[0].Tags[0]);
            Assert.AreEqual("@scenario-tag-2", feature.FeatureElements[0].Tags[1]);
        }
        public void WhenIndicatingTheLanguageAndCultureInTheFeature_ThenCanParseTheFeature()
        {
            string featureText =
       @"# language: nl-BE
Functionaliteit: Test de Cultuur

Scenario: Het Scenario
    Stel dat ik 50 ingeef
    En dat ik 70 ingeef
    Als ik plus druk
    Dan moet het resultaat 120 zijn";

            var configuration = this.Configuration;
            var parser = new FeatureParser(FileSystem, configuration);
            Feature feature = parser.Parse(new StringReader(featureText));

            Check.That(feature).IsNotNull();
        }