Exemple #1
0
        private void RunFolder(StoryTestSuite theSuite)
        {
            StoryTestPage suiteSetUp = theSuite.SuiteSetUp;

            if (suiteSetUp != null)
            {
                ExecuteStoryPage(suiteSetUp);
            }
            foreach (StoryTestPage testPage in theSuite.Pages)
            {
                ExecuteStoryPage(testPage);
            }

            foreach (StoryTestSuite childSuite in theSuite.Suites)
            {
                RunFolder(childSuite);
            }
            StoryTestPage suiteTearDown = theSuite.SuiteTearDown;

            if (suiteTearDown != null)
            {
                ExecuteStoryPage(suiteTearDown);
            }
            theSuite.Finish();
        }
Exemple #2
0
        private void RunFolder(StoryTestSuite theSuite, bool dryRun)
        {
            var executor = SelectExecutor(dryRun);

            StoryTestPage suiteSetUp = theSuite.SuiteSetUp;

            if (suiteSetUp != null)
            {
                executor.Do(suiteSetUp);
            }
            foreach (StoryTestPage testPage in theSuite.Pages)
            {
                try {
                    executor.Do(testPage);
                }
                catch (Exception e) {
                    myReporter.Write(e.ToString());
                }
            }

            foreach (StoryTestSuite childSuite in theSuite.Suites)
            {
                RunFolder(childSuite, dryRun);
            }
            StoryTestPage suiteTearDown = theSuite.SuiteTearDown;

            if (suiteTearDown != null)
            {
                executor.Do(suiteTearDown);
            }
            if (!dryRun)
            {
                theSuite.Finish();
            }
        }
        private string ExtractPageTags(StoryTestPage page)
        {
            Match  matchingContent = tagExpression.Match(page.Content);
            string rawTagsValue    = matchingContent.Groups["Tags"].Value;

            return(TrimTagLabel(rawTagsValue));
        }
Exemple #4
0
 public void Do(StoryTestPage page)
 {
     if (!page.HasTestContent)
     {
         return;
     }
     reporter.WriteLine(page.Name.Name);
 }
Exemple #5
0
 public void Do(StoryTestPage page)
 {
     if (string.IsNullOrEmpty(page.TestContent))
     {
         return;
     }
     reporter.WriteLine(page.Name.Name);
 }
Exemple #6
0
 private void ExecuteStoryPage(StoryTestPage page)
 {
     try {
         page.ExecuteStoryPage(ExecutePage, resultWriter, HandleTestStatus);
     }
     catch (Exception e) {
         myReporter.Write(e.ToString());
     }
 }
        private void RunFolder(StoryTestSuite theSuite, bool dryRun)
        {
            var executor = SelectExecutor(dryRun);

            StoryTestPage suiteSetUp = theSuite.SuiteSetUp;

            if (suiteSetUp != null)
            {
                executor.Do(suiteSetUp);
            }
            foreach (StoryTestPage testPage in theSuite.Pages)
            {
                try {
                    TestStarted(testPage.Name.Name);
                    executor.Do(testPage);
                    TestEnded(testPage.Name.Name);
                }
                catch (System.Exception e) {
                    myReporter.Write(e.ToString());
                }
                if (executor.SuiteIsAbandoned)
                {
                    break;
                }
            }

            if (!executor.SuiteIsAbandoned)
            {
                foreach (StoryTestSuite childSuite in theSuite.Suites)
                {
                    RunFolder(childSuite, dryRun);
                }
                StoryTestPage suiteTearDown = theSuite.SuiteTearDown;
                if (suiteTearDown != null)
                {
                    executor.Do(suiteTearDown);
                }
            }

            if (!dryRun)
            {
                theSuite.Finish();
            }
        }
Exemple #8
0
            public void Do(StoryTestPage page)
            {
                var elapsedTime = new ElapsedTime();

                if (!page.HasTestContent)
                {
                    page.WriteNonTest();
                    DoNoTest();
                    return;
                }

                StoreCurrentlyExecutingPagePath(page.Name.Name);

                var service   = newService(memory);
                var writer    = new StoryTestStringWriter();
                var storyTest = new StoryTest(service, writer).WithInput(page.TestContent);

                if (!storyTest.IsExecutable)
                {
                    page.WriteNonTest();
                    DoNoTest();
                    return;
                }

                storyTest.OnAbandonSuite(() => { SuiteIsAbandoned = true; });

                if (page.Name.IsSuitePage)
                {
                    storyTest.Execute();
                }
                else
                {
                    storyTest.Execute(newService(service.Memory.Copy()));
                }

                var pageResult = new PageResult(page.Name.Name, writer.Tables, writer.Counts, elapsedTime);

                page.WriteTest(pageResult);
                report.ListFile(page.OutputFile, writer.Counts, elapsedTime);
                handleCounts(writer.Counts);
                resultWriter.WritePageResult(pageResult);
            }
Exemple #9
0
 public bool Matches(StoryTestPage page)
 {
     if (page.Name.IsSuiteSetUp)
     {
         return(false);
     }
     if (page.Name.IsSuiteTearDown)
     {
         return(false);
     }
     if (!string.IsNullOrEmpty(tagList) && !new TagFilter(tagList).Matches(page))
     {
         return(false);
     }
     if (!string.IsNullOrEmpty(selection) && !page.Name.Name.EndsWith(selection))
     {
         return(false);
     }
     return(!fileExclusions.IsExcluded(Path.GetFileName(page.Name.Name)));
 }
Exemple #10
0
            public void Do(StoryTestPage page)
            {
                var elapsedTime = new ElapsedTime();
                var input       = page.TestContent;

                if (string.IsNullOrEmpty(input))
                {
                    page.WriteNonTest();
                    DoNoTest();
                }

                StoreCurrentlyExecutingPagePath(page.Name.Name);

                var service   = new Service.Service(memory);
                var writer    = new StoryTestStringWriter(service);
                var storyTest = new StoryTest(service, writer).WithInput(input);

                if (!storyTest.IsExecutable)
                {
                    page.WriteNonTest();
                    DoNoTest();
                    return;
                }

                if (page.Name.IsSuitePage)
                {
                    storyTest.Execute();
                }
                else
                {
                    storyTest.Execute(new Service.Service(service));
                }

                var pageResult = new PageResult(page.Name.Name, writer.Tables, writer.Counts, elapsedTime);

                page.WriteTest(pageResult);
                handleCounts(writer.Counts);
                resultWriter.WritePageResult(pageResult);
            }
Exemple #11
0
            public void Do(StoryTestPage page)
            {
                var elapsedTime = new ElapsedTime();
                var input       = page.TestContent;

                if (string.IsNullOrEmpty(input))
                {
                    page.WriteNonTest();
                    DoNoTest();
                }
                var         service = new Service.Service(configuration);
                Tree <Cell> result  = service.Compose(new StoryTestString(input));

                if (result == null || result.Branches.Count == 0)
                {
                    page.WriteNonTest();
                    DoNoTest();
                    return;
                }
                var writer    = new StoryTestStringWriter(service);
                var storyTest = new StoryTest((Parse)result, writer);

                if (page.Name.IsSuitePage)
                {
                    storyTest.ExecuteOnConfiguration(configuration);
                }
                else
                {
                    storyTest.Execute(configuration);
                }
                var pageResult = new PageResult(page.Name.Name, writer.Tables, writer.Counts, elapsedTime);

                page.WriteTest(pageResult);
                handleCounts(writer.Counts);
                resultWriter.WritePageResult(pageResult);
            }
Exemple #12
0
 private bool SatisfiesFilters(StoryTestPage page) {
     return pageFilters.All(filter => filter.Matches(page));
 }
Exemple #13
0
            public void Do(StoryTestPage page) {
                var elapsedTime = new ElapsedTime();
                var input = page.TestContent;
                if (string.IsNullOrEmpty(input)) {
                    page.WriteNonTest();
                    DoNoTest();
                }

                StoreCurrentlyExecutingPagePath(page.Name.Name);

	            var service = new Service.Service(memory);
                var writer = new StoryTestStringWriter(service);
                var storyTest = new StoryTest(service, writer).WithInput(input);

                if (!storyTest.IsExecutable) {
                    page.WriteNonTest();
                    DoNoTest();
	                return;
	            }

                storyTest.OnAbandonSuite(() => { SuiteIsAbandoned = true; });

                if (page.Name.IsSuitePage) {
                    storyTest.Execute();
                }
                else {
                    storyTest.Execute(new Service.Service(service));
                }

                var pageResult = new PageResult(page.Name.Name, writer.Tables, writer.Counts, elapsedTime);
                page.WriteTest(pageResult);
                handleCounts(writer.Counts);
                resultWriter.WritePageResult(pageResult);
            }
Exemple #14
0
            public void Do(StoryTestPage page) {
                if (string.IsNullOrEmpty(page.TestContent)) return;
	            reporter.WriteLine(page.Name.Name);
            }
Exemple #15
0
 private void ExecuteStoryPage(StoryTestPage page)
 {
     try {
         page.ExecuteStoryPage(ExecutePage, resultWriter, HandleTestStatus);
     }
     catch (Exception e) {
         myReporter.Write(e.ToString());
     }
 }
Exemple #16
0
 public void Do(StoryTestPage page)
 {
     var elapsedTime = new ElapsedTime();
     var input = page.TestContent;
     if (string.IsNullOrEmpty(input)) {
         page.WriteNonTest();
         DoNoTest();
     }
     var service = new Service.Service(configuration);
     Tree<Cell> result = service.Compose(new StoryTestString(input));
     if (result == null || result.Branches.Count == 0) {
         page.WriteNonTest();
         DoNoTest();
         return;
     }
     var writer = new StoryTestStringWriter(service);
     var storyTest = new StoryTest((Parse) result, writer);
     if (page.Name.IsSuitePage) {
         storyTest.ExecuteOnConfiguration(configuration);
     }
     else {
         storyTest.Execute(configuration);
     }
     var pageResult = new PageResult(page.Name.Name, writer.Tables, writer.Counts, elapsedTime);
     page.WriteTest(pageResult);
     handleCounts(writer.Counts);
     resultWriter.WritePageResult(pageResult);
 }
Exemple #17
0
 private void DryRunStoryPage(StoryTestPage page)
 {
     page.ExecuteStoryPage(ReportPageName, new NullResultWriter(), ignore => {});
 }
Exemple #18
0
 private bool SatisfiesFilters(StoryTestPage page)
 {
     return(pageFilters.All(filter => filter.Matches(page)));
 }
Exemple #19
0
        private string ExtractPageTags(StoryTestPage page) {
            Match matchingContent = tagExpression.Match(page.Content);
            string rawTagsValue = matchingContent.Groups["Tags"].Value;

            return TrimTagLabel(rawTagsValue);
        }
Exemple #20
0
 public bool Matches(StoryTestPage page) {
     string pageTags = ExtractPageTags(page);
     return MatchesFilter(pageTags);
 }
        public bool Matches(StoryTestPage page)
        {
            string pageTags = ExtractPageTags(page);

            return(MatchesFilter(pageTags));
        }