public IEnumerable <TContext> Run(RunSettings settings) { var builder = new RunDescriptorsBuilder(); runDescriptorsBuilderAction(builder); var runDescriptors = builder.Build(); if (!runDescriptors.Any()) { Console.Out.WriteLine("No active rundescriptors was found for this test, test will not be executed"); return(new List <TContext>()); } foreach (var runDescriptor in runDescriptors) { runDescriptor.ScenarioContext = contextFactory(); runDescriptor.TestExecutionTimeout = settings.TestExecutionTimeout ?? TimeSpan.FromSeconds(90); runDescriptor.UseSeparateAppdomains = settings.UseSeparateAppDomains; } var sw = new Stopwatch(); sw.Start(); ScenarioRunner.Run(runDescriptors, behaviors, shoulds, done, limitTestParallelismTo, reports, allowedExceptions); sw.Stop(); Console.Out.WriteLine("Total time for testrun: {0}", sw.Elapsed); return(runDescriptors.Select(r => (TContext)r.ScenarioContext)); }
public async Task <TContext> Run(RunSettings settings) { var scenarioContext = new TContext(); contextInitializer(scenarioContext); var runDescriptor = new RunDescriptor(scenarioContext); runDescriptor.Settings.Merge(settings); ScenarioContext.Current = scenarioContext; LogManager.UseFactory(Scenario.GetLoggerFactory(scenarioContext)); var sw = new Stopwatch(); sw.Start(); var runSummary = await ScenarioRunner.Run(runDescriptor, behaviors, done).ConfigureAwait(false); sw.Stop(); await runDescriptor.RaiseOnTestCompleted(runSummary); DisplayRunResult(runSummary); TestContext.WriteLine("Total time for testrun: {0}", sw.Elapsed); if (runSummary.Result.Failed) { PrintLog(scenarioContext); runSummary.Result.Exception.Throw(); } return((TContext)runDescriptor.ScenarioContext); }
public async Task <IEnumerable <TContext> > Run(RunSettings settings) { var builder = new RunDescriptorsBuilder(); runDescriptorsBuilderAction(builder); var runDescriptors = builder.Build(); if (!runDescriptors.Any()) { Console.WriteLine("No active rundescriptors were found for this test, test will not be executed"); return(new List <TContext>()); } foreach (var runDescriptor in runDescriptors) { var scenarioContext = new TContext(); contextInitializer(scenarioContext); runDescriptor.ScenarioContext = scenarioContext; runDescriptor.Settings.Merge(settings); } LogManager.UseFactory(new ContextAppenderFactory()); var sw = new Stopwatch(); sw.Start(); await ScenarioRunner.Run(runDescriptors, behaviors, shoulds, done, reports).ConfigureAwait(false); sw.Stop(); Console.WriteLine("Total time for testrun: {0}", sw.Elapsed); return(runDescriptors.Select(r => (TContext)r.ScenarioContext)); }
public async Task <TContext> Run(RunSettings settings) { var scenarioContext = new TContext(); contextInitializer(scenarioContext); var runDescriptor = new RunDescriptor { ScenarioContext = scenarioContext }; runDescriptor.Settings.Merge(settings); LogManager.UseFactory(new ContextAppenderFactory()); var sw = new Stopwatch(); sw.Start(); await ScenarioRunner.Run(runDescriptor, behaviors, done).ConfigureAwait(false); sw.Stop(); Console.WriteLine("Total time for testrun: {0}", sw.Elapsed); return((TContext)runDescriptor.ScenarioContext); }
public void RunTests() { _cancelationToken = new CancellationTokenSource(); Task.Factory.StartNew(() => { _allRunResults = new List <ScenarioInRunResult>(); _sender.Send(new TestStarted()); for (int i = 0; i < _config.NumberOfRuns; i++) { _sender.Send(new IterationChanged()); _allRunResults.AddRange(_runner.Run(_config.MaximumSampleSize, _cancelationToken.Token) .Select(r => new ScenarioInRunResult { ApplicationTime = r.ApplicationTime, CommitTime = r.CommitTime, ConfigurationName = r.ConfigurationName, MemoryUsage = r.MemoryUsage, SampleSize = r.SampleSize, ScenarioName = r.ScenarioName, SetupTime = r.SetupTime, Status = r.Status, Technology = r.Technology, RunNumber = i + 1 })); } foreach (var formatter in _formatters) { formatter.FormatResults(_allRunResults); } _sender.Send(new TestStopped()); }, _cancelationToken.Token); }
static int Main() { var scenarioRunner = new ScenarioRunner(); scenarioRunner.Initialize(); var success = scenarioRunner.Run().Result; return(success ? 0 : 1); }
public virtual void RunScenario() { try { Before(); _scenarioRunner.Run(); } finally { After(); } }
static void Main(string[] args) { var options = Args.Parse<TestRunnerOptions>(args); if (options.Help || String.IsNullOrEmpty(options.Assembly)) { Console.WriteLine(ArgUsage.GetUsage<TestRunnerOptions>(options: new ArgUsageOptions { ShowType = false, ShowPosition = false, ShowPossibleValues = false, AppendDefaultValueToDescription = true })); return; } var runner = new ScenarioRunner(options); runner.Run().Wait(); }
public async Task <TContext> Run(TimeSpan?testExecutionTimeout = null) { var runDescriptor = new RunDescriptor { Key = "Default", ScenarioContext = contextFactory(), TestExecutionTimeout = testExecutionTimeout ?? TimeSpan.FromSeconds(90) }; var sw = new Stopwatch(); sw.Start(); await ScenarioRunner.Run(runDescriptor, behaviors, done).ConfigureAwait(false); sw.Stop(); Console.Out.WriteLine("Total time for testrun: {0}", sw.Elapsed); return((TContext)runDescriptor.ScenarioContext); }
private void RunScenario(bool debug) { string tempFileName = GherkinText.AsString.ToTempFile(); ScenarioRunner.Run(tempFileName, debug); }
public void Run_WhenContextIsNull_ShouldThrowArgumentNullException() { Assert.Throws <ArgumentNullException>(() => _underTest.Run(null, 0, 0, false)); }