diff --git a/src/dotnet/Logger/Logger.cs b/src/dotnet/Logger/Logger.cs index c01c85c..2fc3616 100644 --- a/src/dotnet/Logger/Logger.cs +++ b/src/dotnet/Logger/Logger.cs @@ -256,14 +256,20 @@ async Task OnTestRunCompleteInternalAsync(TestRunCompleteEventArgs results) try { await Task.WhenAll(_testResults.Values.ToArray()).ConfigureAwait(false); + if (!results.TestRunStatistics.Stats.TryGetValue(TestOutcome.Passed, out var passed)) + passed = 0; + if (!results.TestRunStatistics.Stats.TryGetValue(TestOutcome.Failed, out var failed)) + failed = 0; + if (!results.TestRunStatistics.Stats.TryGetValue(TestOutcome.Skipped, out var skipped)) + skipped = 0; var summary = _summaryGenerator.Generate( name: _params.name, suite: _testRunName, framework: _testRunFramework, - passed: results.TestRunStatistics.Stats[TestOutcome.Passed], - failed: results.TestRunStatistics.Stats[TestOutcome.Failed], - skipped: results.TestRunStatistics.Stats[TestOutcome.Skipped], + passed, + failed, + skipped, total: results.TestRunStatistics.ExecutedTests, elapsed: results.ElapsedTimeInRunningTests, testResults: _testResults.Keys