Ejemplo n.º 1
0
            protected override async void RunTestCases(IEnumerable <IXunitTestCase> testCases, IMessageSink executionMessageSink, ITestFrameworkExecutionOptions executionOptions)
            {
                SetupTracing(TestAssembly.Assembly);

                // Always run at least with one thread per VS version.
                if (executionOptions.MaxParallelThreadsOrDefault() < VsVersions.InstalledVersions.Length && !Debugger.IsAttached)
                {
                    executionOptions.SetValue("xunit.execution.MaxParallelThreads", VsVersions.InstalledVersions.Length);
                    Constants.Tracer.TraceEvent(TraceEventType.Verbose, 0, Strings.VsixTestFramework.SettingMaxThreads(VsVersions.InstalledVersions.Length));
                }
                // If debugger is attached, don't run multiple instances simultaneously since that makes debugging much harder.
                if (Debugger.IsAttached)
                {
                    executionOptions.SetValue("xunit.execution.MaxParallelThreads", 1);
                    Constants.Tracer.TraceEvent(TraceEventType.Verbose, 0, Strings.VsixTestFramework.DebugMaxThreads);
                }

                // This is the implementation of the base XunitTestFrameworkExecutor
                using (var assemblyRunner = new VsixTestAssemblyRunner(TestAssembly, testCases, DiagnosticMessageSink, new TracingMessageSink(executionMessageSink, Constants.Tracer), executionOptions))
                    await assemblyRunner.RunAsync();

                s_tracer.Flush();
            }