Beispiel #1
0
        internal WebServerOnlyRunner(
            ILogger logger,
            IEventSubscriptionManager eventSubscriptionManager,
            IEventPublisher eventPublisher,
            IWebServer webServer,
            Uri testHtmlPageUrl,
            string xapPath)
        {
            _logger = logger;
            _eventSubscriptionManager = eventSubscriptionManager;
            _webServer       = webServer;
            _testHtmlPageUrl = testHtmlPageUrl;
            _xapPath         = xapPath;

            _testResultAggregator = new TestResultAggregator(logger, eventPublisher, _xapPath);
            _eventSubscriptionManager.AddListener(_testResultAggregator);
            _continuousRunnerThread = new Thread(() =>
            {
                string line;
                do
                {
                    line = Console.ReadLine();
                } while (line.ToLower(CultureInfo.CurrentCulture) != "exit");
                //string line;
                //while ((line = System.Console.ReadLine())
                //        .ToLower(CultureInfo.CurrentCulture) != "exit")
                //{
                //    ;
                //}
            });
        }
        internal WebServerOnlyRunner(
            ILogger logger,
            IEventSubscriptionManager eventSubscriptionManager,
            IEventPublisher eventPublisher,
            IWebServer webServer,
            Uri testHtmlPageUrl,
            string xapPath)
        {
            _logger = logger;
            _eventSubscriptionManager = eventSubscriptionManager;
            _webServer = webServer;
            _testHtmlPageUrl = testHtmlPageUrl;
            _xapPath = xapPath;

            _testResultAggregator = new TestResultAggregator(logger, eventPublisher, _xapPath);
            _eventSubscriptionManager.AddListener(_testResultAggregator);
            _continuousRunnerThread = new Thread(() =>
            {
                string line;
                do
                {
                    line = Console.ReadLine();
                } while (line.ToLower(CultureInfo.CurrentCulture) != "exit");
                //string line;
                //while ((line = System.Console.ReadLine())
                //        .ToLower(CultureInfo.CurrentCulture) != "exit")
                //{
                //    ;
                //}
            });
        }
Beispiel #3
0
        private void Stop()
        {
            _logger.Debug("ContinuousTestRunner.Stop()");
            ConsoleTestCompleteMessage.WriteOutCompletionStatement(_testResultAggregator.CurrentReport, _startOfRun);
            _webBrowser.Stop();
            IsCurrentlyRunningTest = false;

            _eventSubscriptionManager.RemoveListener(_testResultAggregator);
            _testResultAggregator.Dispose();
            _testResultAggregator = null;
        }
Beispiel #4
0
        private void Start()
        {
            _testResultAggregator = new TestResultAggregator(_logger, _eventPublisher, _xapPath);
            _eventSubscriptionManager.AddListener(_testResultAggregator);

            _logger.Information("{1}{1}Starting Test Run: {0}{1}{1}"
                                .FormatWith(DateTime.Now, Environment.NewLine));
            _startOfRun = DateTime.Now;
            _webBrowser.Start();
            IsCurrentlyRunningTest = true;
        }
Beispiel #5
0
 public void Should_not_complete_a_Failed_event_until_the_begin_event_arrives()
 {
     TestResultAggregator.Handle(new TestExecutionMethodFailedClientEvent {
         NamespaceName = "n", ClassName = "c", MethodName = "m1"
     });
     TestResultAggregator.CurrentReport.TotalPassed.ShouldEqual(0);
     TestResultAggregator.Handle(new TestExecutionMethodBeginClientEvent {
         NamespaceName = "n", ClassName = "c", MethodName = "m1"
     });
     TestResultAggregator.CurrentReport.TotalFailed.ShouldEqual(1);
 }
Beispiel #6
0
            protected override void Because()
            {
                base.Because();
                TestResultAggregator.Handle(new TestExecutionMethodBeginClientEvent
                {
                    ClassName     = "Class name test",
                    MethodName    = "method name test",
                    NamespaceName = "namespace test",
                });
                TestResultAggregator.Handle(_testExecutionMethodPassedClientEvent);

                _passedResultServerEvent =
                    TestResultAggregator
                    .CurrentReport
                    .TestResults.Where(w => w.ResultType == ResultType.Passed)
                    .Cast <TestCaseResultServerEvent>()
                    .FirstOrDefault();
            }
Beispiel #7
0
            protected override void Because()
            {
                base.Because();

                TestResultAggregator.Handle(new TestExecutionMethodBeginClientEvent {
                    NamespaceName = "n", ClassName = "c", MethodName = "m0"
                });
                TestResultAggregator.Handle(new TestExecutionMethodPassedClientEvent {
                    NamespaceName = "n", ClassName = "c", MethodName = "m0"
                });

                TestResultAggregator.Handle(new DialogAssertionServerEvent(DialogType.MessageBox)
                {
                    Message = "some message here"
                });

                _manufacturedFailedEvent = _manufacturedFailedEvents.FirstOrDefault();
            }
Beispiel #8
0
            public void Should_have_attached_testContext_metadata_after_a_passed_event_has_gone_through()
            {
                TestResultAggregator.Handle(new TestContextMessageClientEvent {
                    FullTestName = "n.c.m0", Message = "Sample WriteLine"
                });
                TestResultAggregator.Handle(new TestExecutionMethodPassedClientEvent {
                    NamespaceName = "n", ClassName = "c", MethodName = "m0"
                });
                TestResultAggregator.CurrentReport.TotalPassed.ShouldEqual(0);
                TestResultAggregator.Handle(new TestExecutionMethodBeginClientEvent {
                    NamespaceName = "n", ClassName = "c", MethodName = "m0"
                });
                TestResultAggregator.CurrentReport.TotalPassed.ShouldEqual(1);

                TestResultAggregator.CurrentReport.TestResults.First().Metadata.Count().ShouldEqual(1, "Should have placed an item into the metadata collection");
                TestResultAggregator.CurrentReport.TestResults.First().Metadata.First().Classification.ShouldEqual("TestContextWriteMethod");
                TestResultAggregator.CurrentReport.TestResults.First().Metadata.First().Name.ShouldEqual("TestContextWriteMethod");
                TestResultAggregator.CurrentReport.TestResults.First().Metadata.First().Value.ShouldEqual("Sample WriteLine");
            }
Beispiel #9
0
        internal OnetimeRunner(
            ILogger logger,
            IEventSubscriptionManager eventSubscriptionManager,
            IEventPublisher eventPublisher,
            IWebServer webServer,
            List <IWebBrowser> webBrowsers,
            string xapPath,
            IDialogMonitorRunner dialogMonitorRunner)
        {
            _logger = logger;
            _eventSubscriptionManager = eventSubscriptionManager;
            _webServer           = webServer;
            _webBrowsers         = webBrowsers;
            _xapPath             = xapPath;
            _dialogMonitorRunner = dialogMonitorRunner;

            _testResultAggregator = new TestResultAggregator(logger, eventPublisher, _xapPath);
            _eventSubscriptionManager.AddListener(_testResultAggregator);
            _eventSubscriptionManager.AddListener(this);
        }
Beispiel #10
0
            protected override void Because()
            {
                base.Because();

                TestResultAggregator.Handle(_browserHostCommunicationTimeoutServerEvent);
            }
Beispiel #11
0
            protected override void Before_all_tests()
            {
                base.Before_all_tests();

                TestResultAggregator = new TestResultAggregator(TestLogger, base.TestEventPublisher, "test");
            }
            protected override void Before_all_tests()
            {
                base.Before_all_tests();

                TestResultAggregator = new TestResultAggregator(TestLogger, base.TestEventPublisher, "test");
            }