/// <summary> /// Starts the process of running the selected xUnit.net v2 tests. /// </summary> /// <param name="testCases">The test cases to run; if null, all tests in the assembly are run.</param> /// <param name="messageSink">The message sink to report results back to.</param> /// <param name="executionOptions">The options to be used during test execution.</param> public void Run(IEnumerable <ITestCase> testCases, IMessageSink messageSink, XunitExecutionOptions executionOptions) { executor.RunTests(testCases, messageSink, executionOptions); }
public static async void NonParallel() { var passing = Mocks.XunitTestCase<ClassUnderTest>("Passing"); var other = Mocks.XunitTestCase<ClassUnderTest>("Other"); var options = new XunitExecutionOptions { DisableParallelization = true }; var runner = TestableXunitTestAssemblyRunner.Create(testCases: new[] { passing, other }, options: options); await runner.RunAsync(); var threadIDs = runner.TestCasesRun.Select(x => x.Item1).ToList(); Assert.Equal(threadIDs[0], threadIDs[1]); }
/// <summary> /// Starts the process of running all the xUnit.net v2 tests in the assembly. /// </summary> /// <param name="messageSink">The message sink to report results back to.</param> /// <param name="discoveryOptions">The options to be used during test discovery.</param> /// <param name="executionOptions">The options to be used during test execution.</param> public void Run(IMessageSink messageSink, XunitDiscoveryOptions discoveryOptions, XunitExecutionOptions executionOptions) { executor.RunAll(messageSink, discoveryOptions, executionOptions); }
public static void TestOptionsOverrideAttribute() { var attribute = Mocks.CollectionBehaviorAttribute(disableTestParallelization: true, maxParallelThreads: 127); var options = new XunitExecutionOptions { DisableParallelization = false, MaxParallelThreads = 255 }; var assembly = Mocks.TestAssembly(attributes: new[] { attribute }); var runner = TestableXunitTestAssemblyRunner.Create(assembly: assembly, options: options); var result = runner.GetTestFrameworkEnvironment(); Assert.EndsWith("[collection-per-class, parallel (255 threads)]", result); }
public static void TestOptions_MaxThreads() { var options = new XunitExecutionOptions { MaxParallelThreads = 255 }; var runner = TestableXunitTestAssemblyRunner.Create(options: options); var result = runner.GetTestFrameworkEnvironment(); Assert.EndsWith("[collection-per-class, parallel (255 threads)]", result); }
public static void TestOptions_NonParallel() { var options = new XunitExecutionOptions { DisableParallelization = true }; var runner = TestableXunitTestAssemblyRunner.Create(options: options); var result = runner.GetTestFrameworkEnvironment(); Assert.EndsWith("[collection-per-class, non-parallel]", result); }
/// <summary> /// Starts the process of running the selected xUnit.net v2 tests. /// </summary> /// <param name="testCases">The test cases to run; if null, all tests in the assembly are run.</param> /// <param name="messageSink">The message sink to report results back to.</param> /// <param name="executionOptions">The options to be used during test execution.</param> public void Run(IEnumerable<ITestCase> testCases, IMessageSink messageSink, XunitExecutionOptions executionOptions) { executor.RunTests(testCases, messageSink, executionOptions); }