public void BeforeEach()
 {
     ResultsAggregator.Execute(Path.Combine(Environment.CurrentDirectory, Destination), _result1, _result2);
     _document        = XDocument.Load(Destination);
     _resultDocument1 = XDocument.Load(_result1.ResultsFilepath);
     _resultDocument2 = XDocument.Load(_result2.ResultsFilepath);
 }
Example #2
0
        public void Run()
        {
            // TODO: Check mode
            // Right now environment-level parallelization is only supported,
            // though with the process starter we could do more granular assembly-level parallelization as well
            var tasks   = new List <Task>();
            var results = new List <TestRunResult>();
            var runs    = GetRuns();

            if (runs.Count() < 1)
            {
                Console.WriteLine("No tests were found using the provided options!");
            }

            foreach (var run in GetRuns())
            {
                // Start the process
                var starter = new NUnitProcessStarter(
                    Path.Combine(Path.GetFullPath(run.Environment.Path),
                                 Options.AssemblyFileName),
                    run.Environment.Name);
                _processes.Add(starter);

                // Get the full type name (including namespace) for each type, join into comma-separated string
                var testNames = run.Tests.Select(x => string.Format("{0}.{1}", x.ReflectedType, x.Name));
                tasks.Add(Task.Run(
                              async() => results.Add(
                                  new TestRunResult
                {
                    ResultsFilepath = "nunit-runner\\" + await starter.RunAsync(testNames),
                    Environment     = run.Environment
                }
                                  )
                              ));
            }

            Task.WaitAll(tasks.ToArray());

            if (Options.AggregateResults)
            {
                ResultsAggregator.Execute(Options.ResultsFilepath, results.ToArray());
            }
        }