private TestReportCollection GetTestReports(RunnerType runnerType) { var testReports = new TestReportCollection(); IEnumerable <StatLightConfiguration> statLightConfigurations = _currentStatLightConfiguration.ToList(); if (runnerType == RunnerType.ContinuousTest) { IRunner continuousTestRunner = _statLightRunnerFactory.CreateContinuousTestRunner(statLightConfigurations); continuousTestRunner.Run(); } else { Stopwatch totalTime = Stopwatch.StartNew(); do { using (IRunner runner = GetRunner( _logger, runnerType, _currentStatLightConfiguration.Current, _statLightRunnerFactory)) { _logger.Debug("IRunner typeof({0})".FormatWith(runner.GetType().Name)); Stopwatch stopwatch = Stopwatch.StartNew(); TestReport testReport = runner.Run(); stopwatch.Stop(); testReports.Add(testReport); _eventPublisher.SendMessage(new TestReportGeneratedServerEvent(testReport, stopwatch.Elapsed, statLightConfigurations.Count() > 1)); } } while (_currentStatLightConfiguration.MoveNext()); totalTime.Stop(); _eventPublisher.SendMessage(new TestReportCollectionGeneratedServerEvent(testReports, totalTime.Elapsed)); } return(testReports); }
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)); } }
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); } }