@@ -12,36 +12,36 @@ module VSTestWrapper =
1212
1313 type TestProjectDll = string
1414
15- type private TestDiscoveryHandler ( notifyIncrementalUpdate : TestCase list -> unit ) =
15+ type private TestDiscoveryHandler ( notifyDiscoveryProgress : TestCase list -> unit ) =
1616
1717 member val DiscoveredTests : TestCase ResizeArray = ResizeArray() with get, set
1818
1919 interface ITestDiscoveryEventsHandler with
2020 member this.HandleDiscoveredTests ( discoveredTestCases : System.Collections.Generic.IEnumerable < TestCase >) : unit =
2121 if ( not << isNull) discoveredTestCases then
2222 this.DiscoveredTests.AddRange( discoveredTestCases)
23- notifyIncrementalUpdate ( discoveredTestCases |> List.ofSeq)
23+ notifyDiscoveryProgress ( discoveredTestCases |> List.ofSeq)
2424
2525 member this.HandleDiscoveryComplete
2626 ( _totalTests : int64 , lastChunk : System.Collections.Generic.IEnumerable < TestCase >, _isAborted : bool )
2727 : unit =
2828 if ( not << isNull) lastChunk then
2929 this.DiscoveredTests.AddRange( lastChunk)
30- notifyIncrementalUpdate ( lastChunk |> List.ofSeq)
30+ notifyDiscoveryProgress ( lastChunk |> List.ofSeq)
3131
3232 member this.HandleLogMessage ( _level : TestMessageLevel , _message : string ) : unit = ()
3333
3434 member this.HandleRawMessage ( _rawMessage : string ) : unit = ()
3535
3636 let discoverTestsAsync
3737 ( vstestPath : string )
38- ( incrementalUpdateHandler : TestCase list -> unit )
38+ ( onDiscoveryProgress : TestCase list -> unit )
3939 ( sources : TestProjectDll list )
4040 : Async < TestCase list > =
4141 async {
4242 let consoleParams = ConsoleParameters()
4343 let vstest = new VsTestConsoleWrapper( vstestPath, consoleParams)
44- let discoveryHandler = TestDiscoveryHandler( incrementalUpdateHandler )
44+ let discoveryHandler = TestDiscoveryHandler( onDiscoveryProgress )
4545
4646 use! _onCancel = Async.OnCancel( fun () -> vstest.CancelDiscovery())
4747
@@ -52,14 +52,17 @@ module VSTestWrapper =
5252 type ProcessId = int
5353 type DidDebuggerAttach = bool
5454
55- type TestRunUpdate = Progress of TestRunChangedEventArgs
55+ type TestRunUpdate =
56+ | Progress of TestRunChangedEventArgs
57+ | LogMessage of string
5658
57- type TestRunHandler ( notifyIncrementalUpdate : TestRunUpdate -> unit ) =
59+ type TestRunHandler ( notifyTestRunProgress : TestRunUpdate -> unit ) =
5860
5961 member val TestResults : TestResult ResizeArray = ResizeArray() with get, set
6062
6163 interface ITestRunEventsHandler with
62- member _.HandleLogMessage ( _level : TestMessageLevel , _message : string ) : unit = ()
64+ member _.HandleLogMessage ( level : TestMessageLevel , message : string ) : unit =
65+ notifyTestRunProgress ( LogMessage $" [{level}] {message}" )
6366
6467 member _.HandleRawMessage ( _rawMessage : string ) : unit = ()
6568
@@ -72,15 +75,15 @@ module VSTestWrapper =
7275 ) : unit =
7376 if (( not << isNull) lastChunkArgs && ( not << isNull) lastChunkArgs.NewTestResults) then
7477 this.TestResults.AddRange( lastChunkArgs.NewTestResults)
75- notifyIncrementalUpdate ( Progress lastChunkArgs)
78+ notifyTestRunProgress ( Progress lastChunkArgs)
7679
7780 member this.HandleTestRunStatsChange ( testRunChangedArgs : TestRunChangedEventArgs ) : unit =
7881 if
7982 (( not << isNull) testRunChangedArgs
8083 && ( not << isNull) testRunChangedArgs.NewTestResults)
8184 then
8285 this.TestResults.AddRange( testRunChangedArgs.NewTestResults)
83- notifyIncrementalUpdate ( Progress testRunChangedArgs)
86+ notifyTestRunProgress ( Progress testRunChangedArgs)
8487
8588 member _.LaunchProcessWithDebuggerAttached ( _testProcessStartInfo : TestProcessStartInfo ) : int =
8689 raise ( System.NotImplementedException())
@@ -116,7 +119,7 @@ module VSTestWrapper =
116119 /// attachDebugger assumes that the debugger is attached when the method returns. The test project will continue execution as soon as attachDebugger returns
117120 let runTestsAsync
118121 ( vstestPath : string )
119- ( incrementalUpdateHandler : TestRunUpdate -> unit )
122+ ( onTestRunProgress : TestRunUpdate -> unit )
120123 ( onAttachDebugger : ProcessId -> DidDebuggerAttach )
121124 ( sources : TestProjectDll list )
122125 ( testCaseFilter : string option )
@@ -125,7 +128,7 @@ module VSTestWrapper =
125128 async {
126129 let consoleParams = ConsoleParameters()
127130 let vstest = new VsTestConsoleWrapper( vstestPath, consoleParams)
128- let runHandler = TestRunHandler( incrementalUpdateHandler )
131+ let runHandler = TestRunHandler( onTestRunProgress )
129132
130133 let options = new TestPlatformOptions()
131134 testCaseFilter |> Option.iter ( TestPlatformOptions.withTestCaseFilter options)
0 commit comments