@@ -6,7 +6,6 @@ namespace FSharp.Test
66
77open System
88open Xunit.Sdk
9- open Xunit.Abstractions
109
1110open TestFramework
1211
@@ -32,31 +31,10 @@ type StressAttribute([<ParamArray>] data: obj array) =
3231
3332#if XUNIT_ EXTRAS
3433
35- // To use xUnit means to customize it. The following abomination adds 2 features:
36- // - Capturing full console output individually for each test case, viewable in Test Explorer as test stdout.
34+ // To use xUnit means to customize it. The following features are added:
3735// - Internally parallelize test classes and theories. Test cases and theory cases included in a single class or F# module can execute simultaneously
38-
39- /// Passes captured console output to xUnit.
40- type ConsoleCapturingTestRunner ( test , messageBus , testClass , constructorArguments , testMethod , testMethodArguments , skipReason , beforeAfterAttributes , aggregator , cancellationTokenSource ) =
41- inherit XunitTestRunner( test, messageBus, testClass, constructorArguments, testMethod, testMethodArguments, skipReason, beforeAfterAttributes, aggregator, cancellationTokenSource)
42-
43- member _.BaseInvokeTestMethodAsync aggregator = base .InvokeTestMethodAsync aggregator
44- override this.InvokeTestAsync ( aggregator : ExceptionAggregator ) =
45- task {
46- use capture = new TestConsole.ExecutionCapture()
47- use _ = Activity.startNoTags test.DisplayName
48- let! executionTime = this.BaseInvokeTestMethodAsync aggregator
49- let output =
50- seq {
51- capture.OutText
52- if not ( String.IsNullOrEmpty capture.ErrorText) then
53- " "
54- " =========== Standard Error ==========="
55- " "
56- capture.ErrorText
57- } |> String.concat Environment.NewLine
58- return executionTime, output
59- }
36+ // - Add batch traits for CI multi-agent testing support
37+ // Note: Console output capturing is now handled by xUnit3's built-in [<assembly: CaptureTrace>] attribute
6038
6139module TestCaseCustomizations =
6240 // Internally parallelize test classes and theories.
@@ -110,19 +88,11 @@ module TestCaseCustomizations =
11088
11189type CustomTestCase =
11290 inherit XunitTestCase
113- // xUinit demands this constructor for deserialization.
91+ // xUnit demands this constructor for deserialization.
11492 new () = { inherit XunitTestCase() }
11593
11694 new ( sink: IMessageSink, md, mdo, testMethod, testMethodArgs) = { inherit XunitTestCase( sink, md, mdo, testMethod, testMethodArgs) }
11795
118- override testCase.RunAsync ( _ , bus , args , aggregator , cts ) =
119- let runner : XunitTestCaseRunner =
120- { new XunitTestCaseRunner( testCase, testCase.DisplayName, testCase.SkipReason, args, testCase.TestMethodArguments, bus, aggregator, cts) with
121- override this.CreateTestRunner ( test , bus , testCase , args , testMethod , methodArgs , skipReason , attrs , aggregator , cts ) =
122- ConsoleCapturingTestRunner( test, bus, testCase, args, testMethod, methodArgs, skipReason, attrs, aggregator, cts)
123- }
124- runner.RunAsync()
125-
12696 // Initialize is ensured by xUnit to run once before any property access.
12797 override testCase.Initialize () =
12898 base .Initialize()
@@ -135,14 +105,6 @@ type CustomTheoryTestCase =
135105
136106 new ( sink: IMessageSink, md, mdo, testMethod) = { inherit XunitTheoryTestCase( sink, md, mdo, testMethod) }
137107
138- override testCase.RunAsync ( sink , bus , args , aggregator , cts ) =
139- let runner : XunitTestCaseRunner =
140- { new XunitTheoryTestCaseRunner( testCase, testCase.DisplayName, testCase.SkipReason, args, sink, bus, aggregator, cts) with
141- override this.CreateTestRunner ( test , bus , testCase , args , testMethod , methodArgs , skipReason , attrs , aggregator , cts ) =
142- ConsoleCapturingTestRunner( test, bus, testCase, args, testMethod, methodArgs, skipReason, attrs, aggregator, cts)
143- }
144- runner.RunAsync()
145-
146108 override testCase.Initialize () =
147109 base .Initialize()
148110 testCase.TestMethod <- TestCaseCustomizations.rewriteTestMethod testCase
@@ -239,7 +201,7 @@ type FSharpXunitFramework(sink: IMessageSink) =
239201 }
240202
241203#if XUNIT_ EXTRAS
242- // Rewrites discovered test cases to support extra parallelization and capturing console as test output .
204+ // Rewrites discovered test cases to support extra parallelization and batch trait injection .
243205 override this.CreateDiscoverer ( assemblyInfo ) =
244206 { new XunitTestFrameworkDiscoverer( assemblyInfo, this.SourceInformationProvider, this.DiagnosticMessageSink) with
245207 override _.FindTestsForType ( testClass , includeSourceInformation , messageBus , options ) =
0 commit comments