public override void RunTests(IEnumerable <ITestCase> testCases, IMessageSink executionMessageSink, ITestFrameworkExecutionOptions executionOptions) { executionOptions.SetValue(nameof(ElasticXunitRunOptions.Version), this.Options.Version); executionOptions.SetValue(nameof(ElasticXunitRunOptions.RunIntegrationTests), this.Options.RunIntegrationTests); executionOptions.SetValue(nameof(ElasticXunitRunOptions.RunUnitTests), this.Options.RunUnitTests); executionOptions.SetValue(nameof(ElasticXunitRunOptions.TestFilter), this.Options.TestFilter); executionOptions.SetValue(nameof(ElasticXunitRunOptions.ClusterFilter), this.Options.ClusterFilter); base.RunTests(testCases, executionMessageSink, executionOptions); }
public override void RunAll(IMessageSink executionMessageSink, ITestFrameworkDiscoveryOptions discoveryOptions, ITestFrameworkExecutionOptions executionOptions) { discoveryOptions.SetValue(nameof(ElasticXunitRunOptions.Version), this.Options.Version); discoveryOptions.SetValue(nameof(ElasticXunitRunOptions.RunIntegrationTests), this.Options.RunIntegrationTests); discoveryOptions.SetValue(nameof(ElasticXunitRunOptions.RunUnitTests), this.Options.RunUnitTests); discoveryOptions.SetValue(nameof(ElasticXunitRunOptions.TestFilter), this.Options.TestFilter); discoveryOptions.SetValue(nameof(ElasticXunitRunOptions.ClusterFilter), this.Options.ClusterFilter); executionOptions.SetValue(nameof(ElasticXunitRunOptions.Version), this.Options.Version); executionOptions.SetValue(nameof(ElasticXunitRunOptions.RunIntegrationTests), this.Options.RunIntegrationTests); executionOptions.SetValue(nameof(ElasticXunitRunOptions.RunUnitTests), this.Options.RunUnitTests); executionOptions.SetValue(nameof(ElasticXunitRunOptions.TestFilter), this.Options.TestFilter); executionOptions.SetValue(nameof(ElasticXunitRunOptions.ClusterFilter), this.Options.ClusterFilter); base.RunAll(executionMessageSink, discoveryOptions, executionOptions); }
protected override async void RunTestCases(IEnumerable <IXunitTestCase> testCases, IMessageSink executionMessageSink, ITestFrameworkExecutionOptions executionOptions) { executionOptions.SetValue("xunit.execution.DisableParallelization", false); using (var assemblyRunner = new Runner( TestAssembly, testCases, DiagnosticMessageSink, executionMessageSink, executionOptions)) await assemblyRunner.RunAsync(); }
protected override async void RunTestCases(IEnumerable <IXunitTestCase> testCases, IMessageSink sink, ITestFrameworkExecutionOptions options) { options.SetValue(nameof(ElasticXunitRunOptions.Version), Options.Version); options.SetValue(nameof(ElasticXunitRunOptions.RunIntegrationTests), Options.RunIntegrationTests); options.SetValue(nameof(ElasticXunitRunOptions.IntegrationTestsMayUseAlreadyRunningNode), Options.IntegrationTestsMayUseAlreadyRunningNode); options.SetValue(nameof(ElasticXunitRunOptions.RunUnitTests), Options.RunUnitTests); options.SetValue(nameof(ElasticXunitRunOptions.TestFilter), Options.TestFilter); options.SetValue(nameof(ElasticXunitRunOptions.ClusterFilter), Options.ClusterFilter); try { using (var runner = new TestAssemblyRunner(TestAssembly, testCases, DiagnosticMessageSink, sink, options)) { Options.OnBeforeTestsRun(); await runner.RunAsync().ConfigureAwait(false); Options.OnTestsFinished(runner.ClusterTotals, runner.FailedCollections); } } catch (Exception e) { if (e is ElasticsearchCleanExitException || e is AggregateException ae && ae.Flatten().InnerException is ElasticsearchCleanExitException) { sink.OnMessage(new TestAssemblyCleanupFailure(Enumerable.Empty <ITestCase>(), TestAssembly, new ElasticsearchCleanExitException("Node failed to start", e))); }
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(); }
/// <summary> /// Sets a flag that determines whether xUnit.net should report test results synchronously. /// </summary> public static void SetSynchronousMessageReporting(this ITestFrameworkExecutionOptions executionOptions, bool value) { executionOptions.SetValue(TestOptionsNames.Execution.SynchronousMessageReporting, value); }
/// <summary> /// Sets the maximum number of threads to use when running tests in parallel. /// If set to 0 (the default value), does not limit the number of threads. /// </summary> public static void SetMaxParallelThreads(this ITestFrameworkExecutionOptions executionOptions, int value) { executionOptions.SetValue(TestOptionsNames.Execution.MaxParallelThreads, value); }
/// <summary> /// Sets a flag to disable parallelization. /// </summary> public static void SetDisableParallelization(this ITestFrameworkExecutionOptions executionOptions, bool value) { executionOptions.SetValue(TestOptionsNames.Execution.DisableParallelization, value); }
/// <summary> /// Sets a flag that determines whether diagnostic messages will be emitted. /// </summary> public static void SetDiagnosticMessages(this ITestFrameworkExecutionOptions executionOptions, bool value) { executionOptions.SetValue(TestOptionsNames.Execution.DiagnosticMessages, value); }
/// <summary> /// Sets a flag that determines whether xUnit.net stop testing when a test fails. /// </summary> public static void SetStopOnTestFail(this ITestFrameworkExecutionOptions executionOptions, bool?value) { executionOptions.SetValue(TestOptionsNames.Execution.StopOnFail, value); }
protected override void RunTestCases(IEnumerable<IXunitTestCase> testCases, IMessageSink executionMessageSink, ITestFrameworkExecutionOptions executionOptions) { executionOptions.SetValue("xunit.execution.SynchronousMessageReporting", (bool?)true); executionOptions.SetValue("xunit.execution.DisableParallelization", (bool?)true); base.RunTestCases(testCases, executionMessageSink, executionOptions); }
protected override void RunTestCases(IEnumerable <IXunitTestCase> testCases, IMessageSink executionMessageSink, ITestFrameworkExecutionOptions executionOptions) { executionOptions.SetValue("xunit.execution.SynchronousMessageReporting", (bool?)true); executionOptions.SetValue("xunit.execution.DisableParallelization", (bool?)true); base.RunTestCases(testCases, executionMessageSink, executionOptions); }