public void Start(List <BenchmarkInstance> benchmarks) { if (benchmarks.Count == 0) { throw new ArgumentException("There are no benchmarks to execute"); } if (_running) { Stop(); } _running = true; _results.Clear(); NotifyUpdated(ExecutionState.Running); // Create requested test strategy if (_configuration.ExecutionType == ExecutionType.Sequential) { _strategy = new SequencialExecutionStrategy(_configuration, _results, this, benchmarks); } else { _strategy = new ProportionalExecutionStrategy(_configuration, _results, this, benchmarks); } _strategy.Start(); }
public void Start(IEnumerable <BenchmarkSuiteInstance> suites) { if (_strategy != null) { Stop(); } // Identify active tests _suites = new List <BenchmarkSuiteInstance>(suites); List <BenchmarkInstance> selectedBenchmarks = new List <BenchmarkInstance>(); foreach (BenchmarkSuiteInstance suite in _suites) { foreach (BenchmarkInstance benchmark in suite.Benchmarks) { if (benchmark.IsSelected) { selectedBenchmarks.Add(benchmark); } } } // Check if there is at least one test defined if (selectedBenchmarks.Count == 0) { throw new BenchmarkException("There are no benchmarks to execute"); } // Create requested test strategy if (_executionType == ExecutionType.Sequential) { _strategy = new SequencialExecutionStrategy(this, selectedBenchmarks); } else { _strategy = new ProportionalExecutionStrategy(this, selectedBenchmarks); } // Initialize parameters and start _results.Clear(); try { _strategy.Start(); } catch { Stop(); throw; } }