/// <summary> /// Starts the process of running selected tests in the assembly. /// </summary> /// <param name="executor">The executor.</param> /// <param name="testCases">The test cases to run.</param> /// <param name="executionMessageSink">The message sink to report results back to.</param> /// <param name="executionOptions">The options to be used during test execution.</param> public static void RunTests(this ITestFrameworkExecutor executor, IEnumerable<ITestCase> testCases, IMessageSinkWithTypes executionMessageSink, ITestFrameworkExecutionOptions executionOptions) { executor.RunTests(testCases, MessageSinkAdapter.Wrap(executionMessageSink), executionOptions); }
public XunitTestAssemblyRunnerWithAssemblyFixture(ITestAssembly testAssembly, IEnumerable<IXunitTestCase> testCases, IMessageSink diagnosticMessageSink, IMessageSink executionMessageSink, ITestFrameworkExecutionOptions executionOptions) : base(testAssembly, testCases, diagnosticMessageSink, executionMessageSink, executionOptions) { }
/// <summary> /// Starts the process of running all the tests in the assembly. /// </summary> /// <param name="executor">The executor.</param> /// <param name="executionMessageSink">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 static void RunAll(this ITestFrameworkExecutor executor, IMessageSinkWithTypes executionMessageSink, ITestFrameworkDiscoveryOptions discoveryOptions, ITestFrameworkExecutionOptions executionOptions) { executor.RunAll(MessageSinkAdapter.Wrap(executionMessageSink), discoveryOptions, executionOptions); }
/// <summary> /// Initializes a new instance of the <see cref="TestAssemblyDiscoveryStarting"/> class. /// </summary> /// <param name="assembly">Information about the assembly that is being discovered</param> /// <param name="discoveryOptions">The discovery options</param> /// <param name="executionOptions">The execution options</param> public TestAssemblyDiscoveryStarting(XunitProjectAssembly assembly, ITestFrameworkDiscoveryOptions discoveryOptions, ITestFrameworkExecutionOptions executionOptions) { Assembly = assembly; DiscoveryOptions = discoveryOptions; ExecutionOptions = executionOptions; }
/// <summary> /// Initializes a new instance of the <see cref="TestAssemblyExecutionFinished"/> class. /// </summary> /// <param name="assembly">Information about the assembly that is being discovered</param> /// <param name="executionOptions">The execution options</param> /// <param name="executionSummary">The execution summary</param> public TestAssemblyExecutionFinished(XunitProjectAssembly assembly, ITestFrameworkExecutionOptions executionOptions, ExecutionSummary executionSummary) { Assembly = assembly; ExecutionOptions = executionOptions; ExecutionSummary = executionSummary; }
/// <inheritdoc/> protected override async void RunTestCases( IEnumerable<IXunitTestCase> testCases, IMessageSink executionMessageSink, ITestFrameworkExecutionOptions executionOptions) { using (var assemblyRunner = CreateTestAssemblyRunner(testCases, executionMessageSink, executionOptions)) await assemblyRunner.RunAsync(); }
protected override async void RunTestCases(IEnumerable<IXunitTestCase> testCases, IMessageSink executionMessageSink, ITestFrameworkExecutionOptions executionOptions) { using ( var assemblyRunner = new XunitTestAssemblyRunnerWithAssemblyFixture(TestAssembly, testCases, DiagnosticMessageSink, executionMessageSink, executionOptions)) await assemblyRunner.RunAsync(); }
/// <summary> /// Initializes a new instance of the <see cref="T:Xunit.Sdk.XunitTestAssemblyRunner"/> class. /// </summary> /// <param name="testAssembly">The assembly that contains the tests to be run.</param><param name="testCases">The test cases to be run.</param><param name="diagnosticMessageSink">The message sink to report diagnostic messages to.</param><param name="executionMessageSink">The message sink to report run status to.</param><param name="executionOptions">The user's requested execution options.</param> public BrowserTestAssemblyRunner(ITestAssembly testAssembly, IEnumerable<IXunitTestCase> testCases, IMessageSink diagnosticMessageSink, IMessageSink executionMessageSink, ITestFrameworkExecutionOptions executionOptions) : base(testAssembly, testCases.Cast<BrowserTestCase>().ToList(), diagnosticMessageSink, executionMessageSink, executionOptions) { BeforeAfterHandlers = testAssembly.Assembly.GetCustomAttributes(typeof(BeforeAfterAssemblyTestsAttribute)) .Select(attributeInfo => attributeInfo.GetNamedArgument<Type>("HandlerType")) .Select(handlerType => ExtensibilityPointFactory.Get<IBeforeAfterAssemblyTests>(diagnosticMessageSink, handlerType)) .ToList(); }
private IMessageBus CreateMessageBus(IMessageSink messageSink, ITestFrameworkExecutionOptions executionOptions) { if (executionOptions.SynchronousMessageReportingOrDefault()) { return new SynchronousMessageBus(messageSink); } return new MessageBus(messageSink); }
private static void LogExecutionOptions(ITestFrameworkExecutionOptions options) { if (!Logger.IsEnabled) return; Logger.LogVerbose(" Diagnostic messages: {0}", options.GetDiagnosticMessagesOrDefault()); Logger.LogVerbose(" Disable parallelization: {0}", options.GetDisableParallelizationOrDefault()); Logger.LogVerbose(" Max parallel threads: {0}", options.GetMaxParallelThreadsOrDefault()); Logger.LogVerbose(" Synchronous message reporting: {0}", options.GetSynchronousMessageReportingOrDefault()); }
public ObservationAssemblyRunner(ITestAssembly testAssembly, IEnumerable<IXunitTestCase> testCases, IMessageSink diagnosticMessageSink, IMessageSink executionMessageSink, ITestFrameworkExecutionOptions executionOptions) : base(testAssembly, testCases, diagnosticMessageSink, executionMessageSink, executionOptions) { TestCaseOrderer = new ObservationTestCaseOrderer(); }
protected override async void RunTestCases(IEnumerable<IXunitTestCase> testCases, IMessageSink executionMessageSink, ITestFrameworkExecutionOptions executionOptions) { var testAssembly = new TestAssembly(AssemblyInfo, AppDomain.CurrentDomain.SetupInformation.ConfigurationFile); //executionOptions.SetValue("xunit.execution.DisableParallelization", true); using (var assemblyRunner = new ObservationAssemblyRunner(testAssembly, testCases, DiagnosticMessageSink, executionMessageSink, executionOptions)) await assemblyRunner.RunAsync(); }
protected virtual TestAssemblyRunner<IXunitTestCase> CreateTestAssemblyRunner( IEnumerable<IXunitTestCase> testCases, IMessageSink executionMessageSink, ITestFrameworkExecutionOptions executionOptions) => new BrowserTestAssemblyRunner( TestAssembly, testCases, DiagnosticMessageSink, executionMessageSink, executionOptions);
/// <summary> /// Initializes a new instance of the <see cref="TestAssemblyDiscoveryFinished"/> class. /// </summary> /// <param name="assembly">Information about the assembly that is being discovered</param> /// <param name="discoveryOptions">The discovery options</param> /// <param name="executionOptions">The execution options</param> /// <param name="testCasesDiscovered">The number of test cases discovered</param> /// <param name="testCasesToRun">The number of test cases to be run</param> public TestAssemblyDiscoveryFinished(XunitProjectAssembly assembly, ITestFrameworkDiscoveryOptions discoveryOptions, ITestFrameworkExecutionOptions executionOptions, int testCasesDiscovered, int testCasesToRun) { Assembly = assembly; DiscoveryOptions = discoveryOptions; ExecutionOptions = executionOptions; TestCasesDiscovered = testCasesDiscovered; TestCasesToRun = testCasesToRun; }
protected override async void RunTestCases(IEnumerable<IXunitTestCase> testCases, IMessageSink executionMessageSink, ITestFrameworkExecutionOptions executionOptions) { TestInitalization.Initialize(); try { using (XunitTestAssemblyRunner testAssemblyRunner = new XunitTestAssemblyRunner(TestAssembly, testCases, DiagnosticMessageSink, executionMessageSink, executionOptions)) { RunSummary runSummary = await testAssemblyRunner.RunAsync(); } } finally { TestInitalization.Terminate(); } }
protected override void RunTestCases(IEnumerable<IXunitTestCase> testCases, IMessageSink executionMessageSink, ITestFrameworkExecutionOptions executionOptions) { var skipReason = EvaluateSkipConditions(AssemblyInfo); if (string.IsNullOrEmpty(skipReason)) { base.RunTestCases(testCases, executionMessageSink, executionOptions); } else { skipReason = "Unmet assembly test condition(s): " + skipReason; var testCaseCount = testCases.Count(); using (var messageBus = CreateMessageBus(executionMessageSink, executionOptions)) { foreach (var test in testCases.Select(testCase => new XunitTest(testCase, testCase.DisplayName))) { messageBus.QueueMessage(new TestStarting(test)); messageBus.QueueMessage(new TestSkipped(test, skipReason)); messageBus.QueueMessage(new TestFinished(test, 0, null)); } messageBus.QueueMessage(new TestAssemblyFinished(testCases, TestAssembly, 0, testCaseCount, 0, testCaseCount)); } } }
public VsInstanceTestAssemblyRunner(ITestAssembly testAssembly, IEnumerable <VsTestCaseBase> testCases, VsInstanceTestCase instanceTestCase, IMessageSink diagnosticMessageSink, IMessageSink executionMessageSink, ITestFrameworkExecutionOptions executionOptions, Func <IMessageBus> mesageBusCreator, ExceptionAggregator aggregator) { this.testCases = testCases; this.testAssembly = testAssembly; this.instanceTestCase = instanceTestCase; this.diagnosticMessageSink = diagnosticMessageSink; this.executionMessageSink = executionMessageSink; this.executionOptions = executionOptions; this.messageBus = mesageBusCreator(); this.aggregator = aggregator; InstanceId = testCases.First().InstanceId; var vsTestCases = testCases.OfType <VsTestCase>(); Settings = vsTestCases.First().Settings; Settings.VsResetSettings = vsTestCases.Any(c => c.Settings.VsResetSettings); Settings.VsDebugMixedMode = vsTestCases.Any(c => c.Settings.VsDebugMixedMode); InstancePath = vsTestCases.First().InstancePath; }
void ITestFrameworkExecutor.RunTests(IEnumerable <ITestCase> testCases, IMessageSink messageSink, ITestFrameworkExecutionOptions executionOptions) { Run(testCases, messageSink); }
protected override async void RunTestCases (IEnumerable<IXunitTestCase> testCases, IMessageSink executionMessageSink, ITestFrameworkExecutionOptions executionOptions) { // This is the implementation of the base XunitTestFrameworkExecutor using (var assemblyRunner = new VsixTestAssemblyRunner (TestAssembly, testCases, DiagnosticMessageSink, executionMessageSink, executionOptions)) await assemblyRunner.RunAsync (); }
/// <inheritdoc/> public virtual void RunTests(IEnumerable <ITestCase> testMethods, IMessageSink messageSink, ITestFrameworkExecutionOptions executionOptions) { InnerController.RunTests(testMethods, messageSink, executionOptions); }
public VsTestAssemblyRunner(ITestAssembly testAssembly, IEnumerable <IXunitTestCase> testCases, IMessageSink diagnosticMessageSink, IMessageSink executionMessageSink, ITestFrameworkExecutionOptions executionOptions) : base(testAssembly, testCases, diagnosticMessageSink, executionMessageSink, executionOptions) { }
private XunitTestAssemblyRunner CreateAssemblyRunner(IEnumerable <IXunitTestCase> testCases, IMessageSink executionMessageSink, ITestFrameworkExecutionOptions executionOptions, bool enableInterClassParallelization) { return(enableInterClassParallelization ? new TestFrameworkAssemblyRunner(TestAssembly, testCases, DiagnosticMessageSink, executionMessageSink, executionOptions) : new XunitTestAssemblyRunner(TestAssembly, testCases, DiagnosticMessageSink, executionMessageSink, executionOptions)); }
/// <summary> /// Gets a flag that determines whether xUnit.net should report test results synchronously. /// If the flag is not set, returns the default value (<c>false</c>). /// </summary> public static bool SynchronousMessageReportingOrDefault(this ITestFrameworkExecutionOptions executionOptions) { return(executionOptions.SynchronousMessageReporting() ?? false); }
/// <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 RunAll(IMessageSink messageSink, ITestFrameworkDiscoveryOptions discoveryOptions, ITestFrameworkExecutionOptions executionOptions) { executor.RunAll(messageSink, discoveryOptions, executionOptions); }
/// <summary> /// Initializes a new instance of the <see cref="TestAssemblyExecutionStarting"/> class. /// </summary> /// <param name="assembly">Information about the assembly that is being discovered</param> /// <param name="executionOptions">The execution options</param> public TestAssemblyExecutionStarting(XunitProjectAssembly assembly, ITestFrameworkExecutionOptions executionOptions) { Assembly = assembly; ExecutionOptions = executionOptions; }
/// <summary> /// Initializes a new instance of the <see cref="T:Xunit.Sdk.XunitTestAssemblyRunner"/> class. /// </summary> /// <param name="testAssembly">The assembly that contains the tests to be run.</param><param name="testCases">The test cases to be run.</param><param name="diagnosticMessageSink">The message sink to report diagnostic messages to.</param><param name="executionMessageSink">The message sink to report run status to.</param><param name="executionOptions">The user's requested execution options.</param> public BrowserTestAssemblyRunner(ITestAssembly testAssembly, IEnumerable <IXunitTestCase> testCases, IMessageSink diagnosticMessageSink, IMessageSink executionMessageSink, ITestFrameworkExecutionOptions executionOptions) : base(testAssembly, testCases.Cast <BrowserTestCase>().ToList(), diagnosticMessageSink, executionMessageSink, executionOptions) { BeforeAfterHandlers = testAssembly.Assembly.GetCustomAttributes(typeof(BeforeAfterAssemblyTestsAttribute)) .Select(attributeInfo => attributeInfo.GetNamedArgument <Type>("HandlerType")) .Select(handlerType => ExtensibilityPointFactory.Get <IBeforeAfterAssemblyTests>(diagnosticMessageSink, handlerType)) .ToList(); }
/// <inheritdoc/> protected override void RunTestCases(IEnumerable <IXunitTestCase> testCases, IMessageSink executionMessageSink, ITestFrameworkExecutionOptions executionOptions) { using (var assemblyRunner = new PlaywrightXunitTestAssemblyRunner(TestAssembly, testCases, DiagnosticMessageSink, executionMessageSink, executionOptions)) { assemblyRunner.RunAsync(); } }
protected override async void RunTestCases(IEnumerable <IXunitTestCase> testCases, IMessageSink executionMessageSink, ITestFrameworkExecutionOptions executionOptions) { var resourceSnapshotEnabled = bool.TryParse(Environment.GetEnvironmentVariable("TEST_RESOURCE_ANALYZER_ENABLE"), out var value) && value; using (var testResourceSnapshotWriter = new TestResourceSnapshotWriter()) { if (resourceSnapshotEnabled) { testResourceSnapshotWriter.WriteResourceSnapshot(TestStage.TestAssemblyStarted, TestAssembly); } try { using var assemblyRunner = new PerformanceTestAssemblyRunner( TestAssembly, testCases, DiagnosticMessageSink, executionMessageSink, executionOptions, testResourceSnapshotWriter, resourceSnapshotEnabled); await assemblyRunner.RunAsync(); } finally { if (resourceSnapshotEnabled) { testResourceSnapshotWriter.WriteResourceSnapshot(TestStage.TestAssemblyEnded, TestAssembly); } } } }
protected override async void RunTestCases(IEnumerable <IXunitTestCase> testCases, IMessageSink executionMessageSink, ITestFrameworkExecutionOptions executionOptions) { TestInitalization.Initialize(TestAssembly.Assembly.AssemblyPath); try { using (XunitTestAssemblyRunner testAssemblyRunner = new XunitTestAssemblyRunner(TestAssembly, testCases, DiagnosticMessageSink, executionMessageSink, executionOptions)) { RunSummary runSummary = await testAssemblyRunner.RunAsync(); } } finally { TestInitalization.Terminate(); } }
/// <summary> /// Gets a flag to disable parallelization. If the flag is not present, returns the /// default value (<c>false</c>). /// </summary> public static bool DisableParallelizationOrDefault(this ITestFrameworkExecutionOptions executionOptions) { return(executionOptions.DisableParallelization() ?? false); }
/// <summary> /// Gets the maximum number of threads to use when running tests in parallel. If set to 0, does not /// limit the number of threads. If the value is not set, returns the default value /// (<see cref="Environment.ProcessorCount"/>). /// </summary> public static int MaxParallelThreadsOrDefault(this ITestFrameworkExecutionOptions executionOptions) { return(executionOptions.MaxParallelThreads() ?? Environment.ProcessorCount); }
/// <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 RunTests(IEnumerable<ITestCase> testCases, IMessageSink messageSink, ITestFrameworkExecutionOptions executionOptions) { executor.RunTests(testCases, messageSink, executionOptions); }
void AddExecutionOptions(string assemblyFilename, ITestFrameworkExecutionOptions executionOptions) { using (ReaderWriterLockWrapper.WriteLock()) executionOptionsByAssembly[assemblyFilename] = executionOptions; }
public void RunAll(IMessageSink executionMessageSink, ITestFrameworkDiscoveryOptions discoveryOptions, ITestFrameworkExecutionOptions executionOptions) { var testCases = GetTestCasesFromDiscoverer(_xunitTestFrameworkExecutor.GetDiscoverer(), discoveryOptions) .Concat(GetTestCasesFromDiscoverer(_integrationTestFrameworkExector.GetDiscoverer(), discoveryOptions)) .ToArray(); RunTests(testCases, executionMessageSink, executionOptions); }
/// <inheritdoc/> protected override async void RunTestCases(IEnumerable <IXunitTestCase> testCases, IMessageSink executionMessageSink, ITestFrameworkExecutionOptions executionOptions) { Console.WriteLine("Run Test Cases called"); using (var assemblyRunner = new MettleTestAssemblyRunner(TestAssembly, testCases, DiagnosticMessageSink, executionMessageSink, executionOptions)) await assemblyRunner.RunAsync().ConfigureAwait(false); }
public void RunTests(IEnumerable <ITestCase> testCases, IMessageSink executionMessageSink, ITestFrameworkExecutionOptions executionOptions) { using (var messageBus = new SynchronousMessageBus(executionMessageSink)) messageBus.QueueMessage(new TestAssemblyStarting(testCases, _xunitTestFrameworkExecutor.TestAssembly, DateTime.Now, $"{ IntPtr.Size * 8 } - bit.NET", XunitTestFrameworkDiscoverer.DisplayName)); _xunitTestFrameworkExecutor .RunTests ( testCases.Where(testCase => !(testCase is IntegrationTestCase)), new FilterableMessageSink ( executionMessageSink, message => { if (message is TestAssemblyStarting) { return(null); } if (message is TestAssemblyFinished) { _integrationTestFrameworkExector .RunTests ( testCases.OfType <IntegrationTestCase>(), new FilterableMessageSink ( executionMessageSink, m => { if (m is TestAssemblyStarting) { return(null); } if (m is TestAssemblyFinished) { return(new TestAssemblyFinished(testCases, _xunitTestFrameworkExecutor.TestAssembly, 1.0m, 2, 0, 0)); } return(m); }), executionOptions ); return(null); } return(message); } ), executionOptions ); }
/// <inheritdoc/> public virtual void RunAll(IMessageSink messageSink, ITestFrameworkDiscoveryOptions discoveryOptions, ITestFrameworkExecutionOptions executionOptions) { InnerController.RunAll(messageSink, discoveryOptions, 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); }
/// <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 RunAll(IMessageSink messageSink, ITestFrameworkDiscoveryOptions discoveryOptions, ITestFrameworkExecutionOptions executionOptions) { executor.RunAll(CreateOptimizedRemoteMessageSink(messageSink), discoveryOptions, executionOptions); }
void ITestFrameworkExecutor.RunAll(IMessageSink messageSink, ITestFrameworkDiscoveryOptions discoveryOptions, ITestFrameworkExecutionOptions executionOptions) { Run(messageSink); }
/// <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 RunAll(IMessageSink messageSink, ITestFrameworkDiscoveryOptions discoveryOptions, ITestFrameworkExecutionOptions executionOptions) { remoteExecutor.RunAll(CreateOptimizedRemoteMessageSink(messageSink), discoveryOptions, executionOptions); }
public RemoteTestAssemblyRunner CreateTestAssemblyRunner(string testAssemblyPath, string testAssemblyConfigurationFile, VsTestCaseBase[] testCases, IMessageSink diagnosticMessageSink, IMessageSink executionMessageSink, ITestFrameworkExecutionOptions executionOptions, IMessageBus messageBus) { var testAssembly = new TestAssembly(new ReflectionAssemblyInfo(Assembly.LoadFrom(testAssemblyPath)), testAssemblyConfigurationFile); return(new RemoteTestAssemblyRunner(testAssembly, testCases, diagnosticMessageSink, executionMessageSink, executionOptions, messageBus)); }
/// <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 RunTests(IEnumerable <ITestCase> testCases, IMessageSink messageSink, ITestFrameworkExecutionOptions executionOptions) { remoteExecutor.RunTests(testCases, CreateOptimizedRemoteMessageSink(messageSink), executionOptions); }
/// <summary> /// Gets a flag to disable parallelization. /// </summary> public static bool?DisableParallelization(this ITestFrameworkExecutionOptions executionOptions) { return(executionOptions.GetValue <bool?>(TestOptionsNames.Execution.DisableParallelization)); }
/// <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 RunTests(IEnumerable<ITestCase> testCases, IMessageSink messageSink, ITestFrameworkExecutionOptions executionOptions) { executor.RunTests(testCases, CreateOptimizedRemoteMessageSink(messageSink), executionOptions); }
/// <summary> /// Gets the maximum number of threads to use when running tests in parallel. If set to 0, does not /// limit the number of threads. /// </summary> public static int?MaxParallelThreads(this ITestFrameworkExecutionOptions executionOptions) { return(executionOptions.GetValue <int?>(TestOptionsNames.Execution.MaxParallelThreads)); }
public TestAssemblyRunner(ITestAssembly testAssembly, IEnumerable <IXunitTestCase> testCases, IMessageSink diagnosticMessageSink, IMessageSink executionMessageSink, ITestFrameworkExecutionOptions executionOptions, TestCaseDeserializerArgs testCaseDeserializerArgs) : base(testAssembly, testCases, diagnosticMessageSink, executionMessageSink, executionOptions) { _testCaseDeserializerArgs = testCaseDeserializerArgs; _messageSyncWithEvents = new MessageSinkWithEvents(executionMessageSink, diagnosticMessageSink); ExecutionMessageSink = _messageSyncWithEvents; // the ExecutionMessageSink is used to create the base message bus }
/// <summary> /// Gets a flag that determines whether xUnit.net should report test results synchronously. /// </summary> public static bool?SynchronousMessageReporting(this ITestFrameworkExecutionOptions executionOptions) { return(executionOptions.GetValue <bool?>(TestOptionsNames.Execution.SynchronousMessageReporting)); }
protected override void RunTestCases(IEnumerable <IXunitTestCase> testCases, IMessageSink executionMessageSink, ITestFrameworkExecutionOptions executionOptions) { var skipReason = EvaluateSkipConditions(AssemblyInfo); if (string.IsNullOrEmpty(skipReason)) { base.RunTestCases(testCases, executionMessageSink, executionOptions); } else { skipReason = "Unmet assembly test condition(s): " + skipReason; var testCaseCount = testCases.Count(); using (var messageBus = CreateMessageBus(executionMessageSink, executionOptions)) { foreach (var test in testCases.Select(testCase => new XunitTest(testCase, testCase.DisplayName))) { messageBus.QueueMessage(new TestStarting(test)); messageBus.QueueMessage(new TestSkipped(test, skipReason)); messageBus.QueueMessage(new TestFinished(test, 0, null)); } messageBus.QueueMessage(new TestAssemblyFinished(testCases, TestAssembly, 0, testCaseCount, 0, testCaseCount)); } } }
// Read methods for ITestFrameworkExecutionOptions /// <summary> /// Gets a flag that determines whether diagnostic messages will be emitted. /// </summary> public static bool?DiagnosticMessages(this ITestFrameworkExecutionOptions executionOptions) { return(executionOptions.GetValue <bool?>(TestOptionsNames.Execution.DiagnosticMessages)); }
protected override async void RunTestCases(IEnumerable <IXunitTestCase> testCases, IMessageSink executionMessageSink, ITestFrameworkExecutionOptions executionOptions) { using (var assemblyRunner = new ScenarioReportingXunitTestAssemblyRunner(TestAssembly, testCases, DiagnosticMessageSink, executionMessageSink, executionOptions)) await assemblyRunner.RunAsync(); }
protected override void RunTestCases(IEnumerable <IXunitTestCase> testCases, IMessageSink executionMessageSink, ITestFrameworkExecutionOptions executionOptions) { var assembly = GetAssembly(); var bddScopeAttribute = GetLightBddScopeAttribute(assembly); var enableInterClassParallelization = ShallEnableInterClassParallelization(assembly, executionOptions); AssemblySettings.SetSettings(new AssemblySettings { EnableInterClassParallelization = enableInterClassParallelization, UseXUnitSkipBehavior = ShallUseXUnitSkipBehavior(assembly) }); bddScopeAttribute?.SetUp(DiagnosticMessageSink); try { using (var assemblyRunner = CreateAssemblyRunner(testCases, executionMessageSink, executionOptions, enableInterClassParallelization)) assemblyRunner.RunAsync().Wait(); } finally { bddScopeAttribute?.TearDown(); } }
/// <inheritdoc/> public virtual void RunTests(IEnumerable<ITestCase> testMethods, IMessageSink messageSink, ITestFrameworkExecutionOptions executionOptions) { InnerController.RunTests(testMethods, messageSink, executionOptions); }