protected override void Before_all_tests() { base.Before_all_tests(); var mockCurrentStatLightConfiguration = new Mock <ICurrentStatLightConfiguration>(); var statlightConfiguration = new StatLightConfiguration( new ClientTestRunConfiguration( unitTestProviderType: UnitTestProviderType.MSTest, methodsToTest: new List <string>(), tagFilters: string.Empty, numberOfBrowserHosts: 1, webBrowserType: WebBrowserType.SelfHosted, entryPointAssembly: string.Empty, windowGeometry: new WindowGeometry(), testAssemblyFormalNames: new List <string>() ), new ServerTestRunConfiguration(xapHost: () => new byte[0], xapToTest: string.Empty, xapHostType: XapHostType.MSTest2008December, queryString: string.Empty, forceBrowserStart: true, windowGeometry: new WindowGeometry(), isPhoneRun: false ) ); mockCurrentStatLightConfiguration.Setup(s => s.Current).Returns(statlightConfiguration); var responseFactory = new ResponseFactory(mockCurrentStatLightConfiguration.Object); PostHandler = new PostHandler(TestLogger, TestEventPublisher, mockCurrentStatLightConfiguration.Object, responseFactory); }
public IRunner CreateRemotelyHostedRunner(StatLightConfiguration statLightConfiguration) { // if (statLightConfiguration == null) throw new ArgumentNullException("statLightConfiguration"); //ClientTestRunConfiguration clientTestRunConfiguration = statLightConfiguration.Client; //ServerTestRunConfiguration serverTestRunConfiguration = statLightConfiguration.Server; throw new NotImplementedException(); // //var urlToTestPage = statLightConfiguration.Client.XapToTestUrl.ToUri(); // //var location = new RemoteSiteOverriddenLocation(logger, urlToTestPage); // //var debugAssertMonitorTimer = new TimerWrapper(serverTestRunConfiguration.DialogSmackDownElapseMilliseconds); // //SetupDebugClientEventListener(logger); // //var webServer = CreateWebServer(logger, statLightConfiguration, location); // // // //var showTestingBrowserHost = serverTestRunConfiguration.ShowTestingBrowserHost; // // // //var querystring = "?{0}={1}".FormatWith(StatLightServiceRestApi.StatLightResultPostbackUrl, // // HttpUtility.UrlEncode(location.BaseUrl.ToString())); // //var testPageUrlAndPostbackQuerystring = new Uri(location.TestPageUrl + querystring); // //logger.Debug("testPageUrlAndPostbackQuerystring={0}".FormatWith(testPageUrlAndPostbackQuerystring.ToString())); // //var webBrowsers = GetWebBrowsers(logger, testPageUrlAndPostbackQuerystring, clientTestRunConfiguration, showTestingBrowserHost, serverTestRunConfiguration.QueryString, statLightConfiguration.Server.ForceBrowserStart); // // // //var dialogMonitorRunner = SetupDialogMonitorRunner(logger, webBrowsers, debugAssertMonitorTimer); // // // //StartupBrowserCommunicationTimeoutMonitor(); // //CreateAndAddConsoleResultHandlerToEventAggregator(logger); // // // //IRunner runner = new OnetimeRunner(logger, _eventSubscriptionManager, _eventPublisher, webServer, webBrowsers, statLightConfiguration.Server.XapToTestPath, dialogMonitorRunner); // //return runner; }
private IWebServer CreateWebServer(ILogger logger, StatLightConfiguration statLightConfiguration, WebServerLocation webServerLocation) { var responseFactory = new ResponseFactory(statLightConfiguration.Server.HostXap, statLightConfiguration.Client); var postHandler = new PostHandler(logger, _eventPublisher, statLightConfiguration.Client, responseFactory); return(new InMemoryWebServer(logger, webServerLocation, responseFactory, postHandler)); }
protected override void Before_all_tests() { base.Before_all_tests(); var webServerLocation = new WebServerLocation(TestLogger, 38881); var consoleLogger = new ConsoleLogger(LogChatterLevels.Full); _hostXap = new byte[] { 5, 4, 2, 1, 4 }; var clientConfig = new ClientTestRunConfiguration(UnitTestProviderType.MSTest, new List <string>(), "", 1, WebBrowserType.SelfHosted, string.Empty, new WindowGeometry(), new List <string>()); _serializedConfiguration = clientConfig.Serialize(); var dummyServerTestRunConfiguration = GetDummyServerTestRunConfiguration(); var statLightConfiguration = new StatLightConfiguration(clientConfig, dummyServerTestRunConfiguration); var currentStatLightConfiguration = new CurrentStatLightConfiguration(statLightConfiguration); _responseFactory = new ResponseFactory(currentStatLightConfiguration); _mockPostHandler = new Mock <IPostHandler>(); _inMemoryWebServer = new InMemoryWebServer(consoleLogger, webServerLocation, _responseFactory, _mockPostHandler.Object, base.TestEventPublisher); _webClient = new WebClient(); _baseUrl = webServerLocation.BaseUrl.ToString(); _inMemoryWebServer.Start(); }
protected override void Before_all_tests() { base.Before_all_tests(); System.Diagnostics.Debug.Assert(ClientTestRunConfiguration != null); var options = new InputOptions() .SetUnitTestProviderType(ClientTestRunConfiguration.UnitTestProviderType) .SetXapPaths(new[] { GetTestXapPathInternal() }) .SetMicrosoftTestingFrameworkVersion(MSTestVersion) .SetMethodsToTest(ClientTestRunConfiguration.MethodsToTest) .SetTagFilters(ClientTestRunConfiguration.TagFilter) ; _ioc = BootStrapper.Initialize(options, _testLogger); _eventSubscriptionManager = _ioc.Resolve <EventAggregator>(); _statLightRunnerFactory = new StatLightRunnerFactory(_testLogger, _ioc); var currentStatLightConfiguration = _ioc.Resolve <ICurrentStatLightConfiguration>(); StatLightConfiguration statLightConfiguration = currentStatLightConfiguration.Current; _testLogger.Debug("Setting up xaphost {0}".FormatWith(statLightConfiguration.Server.XapHostType)); Runner = _statLightRunnerFactory.CreateOnetimeConsoleRunner(statLightConfiguration); }
protected override void Because() { base.Because(); var clientTestRunConfiguration = base.CreateTestDefaultClinetTestRunConfiguraiton(); _statLightConfiguration = new StatLightConfiguration(clientTestRunConfiguration, MockServerTestRunConfiguration); }
internal CurrentStatLightConfiguration(StatLightConfiguration statLightConfiguration) { _configurations = new List <StatLightConfiguration> { statLightConfiguration }; Reset(); }
protected override void Because() { base.Because(); var clientTestRunConfiguration = base.CreateTestDefaultClinetTestRunConfiguraiton(); _statLightConfiguration = new StatLightConfiguration(clientTestRunConfiguration, MockServerTestRunConfiguration); var fakeCurrentStatLightConfiguration = new CurrentStatLightConfiguration(_statLightConfiguration); container.Register <ICurrentStatLightConfiguration>(fakeCurrentStatLightConfiguration); }
private TestReport DoTheRun(RunnerType runnerType, StatLightConfiguration statLightConfiguration) { using (IRunner runner = GetRunner( _logger, runnerType, statLightConfiguration, _statLightRunnerFactory)) { _logger.Debug("IRunner typeof({0})".FormatWith(runner.GetType().Name)); return(_runnerFunc(runner)); } }
public IRunner CreateWebServerOnlyRunner(StatLightConfiguration statLightConfiguration) { if (statLightConfiguration == null) { throw new ArgumentNullException("statLightConfiguration"); } var location = new WebServerLocation(_logger); var webServer = _ioc.Resolve <InMemoryWebServer>(); CreateAndAddConsoleResultHandlerToEventAggregator(); IRunner runner = new WebServerOnlyRunner(_logger, _eventSubscriptionManager, _eventPublisher, webServer, location.TestPageUrl, statLightConfiguration.Server.XapToTestPath); return(runner); }
private void BuildAndReturnWebServiceAndBrowser( ILogger logger, StatLightConfiguration statLightConfiguration, out IWebServer webServer, out List <IWebBrowser> webBrowsers, out IDialogMonitorRunner dialogMonitorRunner) { ClientTestRunConfiguration clientTestRunConfiguration = statLightConfiguration.Client; ServerTestRunConfiguration serverTestRunConfiguration = statLightConfiguration.Server; var location = new WebServerLocation(logger); var debugAssertMonitorTimer = new TimerWrapper(serverTestRunConfiguration.DialogSmackDownElapseMilliseconds); webServer = CreateWebServer(logger, statLightConfiguration, location); webBrowsers = GetWebBrowsers(logger, location.TestPageUrl, clientTestRunConfiguration, serverTestRunConfiguration.ShowTestingBrowserHost, serverTestRunConfiguration.QueryString, statLightConfiguration.Server.ForceBrowserStart); dialogMonitorRunner = SetupDialogMonitorRunner(logger, webBrowsers, debugAssertMonitorTimer); StartupBrowserCommunicationTimeoutMonitor(); }
public IRunner CreateOnetimeConsoleRunner(StatLightConfiguration statLightConfiguration) { if (statLightConfiguration == null) { throw new ArgumentNullException("statLightConfiguration"); } IWebServer webServer; IEnumerable <IWebBrowser> webBrowsers; IDialogMonitorRunner dialogMonitorRunner; BuildAndReturnWebServiceAndBrowser( _logger, out webServer, out webBrowsers, out dialogMonitorRunner); CreateAndAddConsoleResultHandlerToEventAggregator(); IRunner runner = new OnetimeRunner(_logger, _eventSubscriptionManager, _eventPublisher, webServer, webBrowsers, statLightConfiguration.Server.XapToTestPath, dialogMonitorRunner); return(runner); }
public IRunner CreateTeamCityRunner(StatLightConfiguration statLightConfiguration) { if (statLightConfiguration == null) { throw new ArgumentNullException("statLightConfiguration"); } ILogger logger = new NullLogger(); IWebServer webServer; IEnumerable <IWebBrowser> webBrowsers; IDialogMonitorRunner dialogMonitorRunner; BuildAndReturnWebServiceAndBrowser( logger, out webServer, out webBrowsers, out dialogMonitorRunner); var teamCityTestResultHandler = new TeamCityTestResultHandler(new ConsoleCommandWriter(), statLightConfiguration.Server.XapToTestPath); IRunner runner = new TeamCityRunner(logger, _eventSubscriptionManager, _eventPublisher, webServer, webBrowsers.ToList(), teamCityTestResultHandler, statLightConfiguration.Server.XapToTestPath, dialogMonitorRunner); return(runner); }
private static IRunner GetRunner(ILogger logger, RunnerType runnerType, StatLightConfiguration statLightConfiguration, IStatLightRunnerFactory statLightRunnerFactory) { switch (runnerType) { case RunnerType.TeamCity: logger.LogChatterLevel = LogChatterLevels.None; return(statLightRunnerFactory.CreateTeamCityRunner(statLightConfiguration)); case RunnerType.ContinuousTest: return(statLightRunnerFactory.CreateContinuousTestRunner(statLightConfiguration)); case RunnerType.WebServerOnly: return(statLightRunnerFactory.CreateWebServerOnlyRunner(statLightConfiguration)); case RunnerType.RemoteRun: return(statLightRunnerFactory.CreateRemotelyHostedRunner(statLightConfiguration)); default: return(statLightRunnerFactory.CreateOnetimeConsoleRunner(statLightConfiguration)); } }
public IRunner CreateContinuousTestRunner(StatLightConfiguration statLightConfiguration) { if (statLightConfiguration == null) { throw new ArgumentNullException("statLightConfiguration"); } IWebServer webServer; List <IWebBrowser> webBrowsers; IDialogMonitorRunner dialogMonitorRunner; BuildAndReturnWebServiceAndBrowser( _logger, statLightConfiguration, out webServer, out webBrowsers, out dialogMonitorRunner); CreateAndAddConsoleResultHandlerToEventAggregator(_logger); IRunner runner = new ContinuousConsoleRunner(_logger, _eventSubscriptionManager, _eventPublisher, statLightConfiguration.Server.XapToTestPath, statLightConfiguration.Client, webServer, webBrowsers.First()); return(runner); }
private static IRunner CreateStatLightRunner(StatLightConfiguration config, ILogger logger, EventAggregator eventAggregator) { var runnerFactory = new StatLightRunnerFactory(logger, eventAggregator, eventAggregator); return(runnerFactory.CreateOnetimeConsoleRunner(config)); }
public TestReportCollection Run() { bool showTestingBrowserHost = _options.ShowTestingBrowserHost; bool useRemoteTestPage = _options.UseRemoteTestPage; Collection <string> methodsToTest = _options.MethodsToTest; MicrosoftTestingFrameworkVersion?microsoftTestingFrameworkVersion = _options.MicrosoftTestingFrameworkVersion; string tagFilters = _options.TagFilters; UnitTestProviderType unitTestProviderType = _options.UnitTestProviderType; int numberOfBrowserHosts = _options.NumberOfBrowserHosts; string queryString = _options.QueryString; WebBrowserType webBrowserType = _options.WebBrowserType; bool forceBrowserStart = _options.ForceBrowserStart; IEnumerable <string> xapPaths = _options.XapPaths; IEnumerable <string> testDlls = _options.Dlls; _options.DumpValuesForDebug(_logger); var runnerType = GetRunnerType(); _logger.Debug("RunnerType = {0}".FormatWith(runnerType)); var testReports = new TestReportCollection(); foreach (var xapPath in xapPaths) { _logger.Debug("Starting configuration for: {0}".FormatWith(xapPath)); StatLightConfiguration statLightConfiguration = _statLightConfigurationFactory .GetStatLightConfigurationForXap( unitTestProviderType, xapPath, microsoftTestingFrameworkVersion, methodsToTest, tagFilters, numberOfBrowserHosts, useRemoteTestPage, queryString, webBrowserType, forceBrowserStart, showTestingBrowserHost); var testReport = DoTheRun(runnerType, statLightConfiguration); testReports.Add(testReport); } foreach (var dllPath in testDlls) { _logger.Debug("Starting configuration for: {0}".FormatWith(dllPath)); StatLightConfiguration statLightConfiguration = _statLightConfigurationFactory .GetStatLightConfigurationForDll( unitTestProviderType, dllPath, microsoftTestingFrameworkVersion, methodsToTest, tagFilters, numberOfBrowserHosts, useRemoteTestPage, queryString, webBrowserType, forceBrowserStart, showTestingBrowserHost); var testReport = DoTheRun(runnerType, statLightConfiguration); testReports.Add(testReport); } string xmlReportOutputPath = _options.XmlReportOutputPath; bool tfsGenericReport = _options.TFSGenericReport; XmlReportType xmlReportType = XmlReportType.StatLight; if (tfsGenericReport) { xmlReportType = XmlReportType.TFS; } WriteXmlReport(testReports, xmlReportOutputPath, xmlReportType); return(testReports); }