Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 46 additions & 12 deletions src/vstest.console/Internal/ConsoleLogger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -366,9 +366,6 @@ private void TestMessageHandler(object sender, TestRunMessageEventArgs e)
ValidateArg.NotNull<object>(sender, "sender");
ValidateArg.NotNull<TestRunMessageEventArgs>(e, "e");

// Pause the progress indicator to print the message
this.progressIndicator?.Pause();

switch (e.Level)
{
case TestMessageLevel.Informational:
Expand All @@ -378,7 +375,14 @@ private void TestMessageHandler(object sender, TestRunMessageEventArgs e)
break;
}

// Pause the progress indicator to print the message
this.progressIndicator?.Pause();

Output.Information(AppendPrefix, e.Message);

// Resume the progress indicator after printing the message
this.progressIndicator?.Start();

break;
}

Expand All @@ -389,23 +393,34 @@ private void TestMessageHandler(object sender, TestRunMessageEventArgs e)
break;
}

// Pause the progress indicator to print the message
this.progressIndicator?.Pause();

Output.Warning(AppendPrefix, e.Message);

// Resume the progress indicator after printing the message
this.progressIndicator?.Start();

break;
}

case TestMessageLevel.Error:
{
// Pause the progress indicator to print the message
this.progressIndicator?.Pause();

this.testRunHasErrorMessages = true;
Output.Error(AppendPrefix, e.Message);

// Resume the progress indicator after printing the message
this.progressIndicator?.Start();

break;
}
default:
EqtTrace.Warning("ConsoleLogger.TestMessageHandler: The test message level is unrecognized: {0}", e.Level.ToString());
break;
}

// Resume the progress indicator after printing the message
this.progressIndicator?.Start();
}

/// <summary>
Expand All @@ -416,9 +431,6 @@ private void TestResultHandler(object sender, TestResultEventArgs e)
ValidateArg.NotNull<object>(sender, "sender");
ValidateArg.NotNull<TestResultEventArgs>(e, "e");

// Pause the progress indicator before displaying test result information
this.progressIndicator?.Pause();

// Update the test count statistics based on the result of the test.
this.testsTotal++;

Expand All @@ -445,13 +457,19 @@ private void TestResultHandler(object sender, TestResultEventArgs e)
break;
}

// Pause the progress indicator before displaying test result information
this.progressIndicator?.Pause();

Output.Write(string.Format("{0}{1} ", TestResultPrefix, SkippedTestIndicator), OutputLevel.Information, ConsoleColor.Yellow);
Output.WriteLine(testDisplayName, OutputLevel.Information);
if (this.verbosityLevel == Verbosity.Detailed)
{
DisplayFullInformation(e.Result);
}

// Resume the progress indicator after displaying the test result information
this.progressIndicator?.Start();

break;
}

Expand All @@ -463,9 +481,16 @@ private void TestResultHandler(object sender, TestResultEventArgs e)
break;
}

// Pause the progress indicator before displaying test result information
this.progressIndicator?.Pause();

Output.Write(string.Format("{0}{1} ", TestResultPrefix, FailedTestIndicator), OutputLevel.Information, ConsoleColor.Red);
Output.WriteLine(testDisplayName, OutputLevel.Information);
DisplayFullInformation(e.Result);

// Resume the progress indicator after displaying the test result information
this.progressIndicator?.Start();

break;
}

Expand All @@ -474,12 +499,18 @@ private void TestResultHandler(object sender, TestResultEventArgs e)
this.testsPassed++;
if (this.verbosityLevel == Verbosity.Normal || this.verbosityLevel == Verbosity.Detailed)
{
// Pause the progress indicator before displaying test result information
this.progressIndicator?.Pause();

Output.Write(string.Format("{0}{1} ", TestResultPrefix, PassedTestIndicator), OutputLevel.Information, ConsoleColor.Green);
Output.WriteLine(testDisplayName, OutputLevel.Information);
if (this.verbosityLevel == Verbosity.Detailed)
{
DisplayFullInformation(e.Result);
}

// Resume the progress indicator after displaying the test result information
this.progressIndicator?.Start();
}

break;
Expand All @@ -492,19 +523,22 @@ private void TestResultHandler(object sender, TestResultEventArgs e)
break;
}

// Pause the progress indicator before displaying test result information
this.progressIndicator?.Pause();

Output.Write(string.Format("{0}{1} ", TestResultPrefix, SkippedTestIndicator), OutputLevel.Information, ConsoleColor.Yellow);
Output.WriteLine(testDisplayName, OutputLevel.Information);
if (this.verbosityLevel == Verbosity.Detailed)
{
DisplayFullInformation(e.Result);
}

// Resume the progress indicator after displaying the test result information
this.progressIndicator?.Start();

break;
}
}

// Resume the progress indicator after displaying the test result information
this.progressIndicator?.Start();
}

private string GetFormattedDurationString(TimeSpan duration)
Expand Down