Skip to content

Commit

Permalink
#110: Visual Studio test explorer cannot filter skipped tests by message
Browse files Browse the repository at this point in the history
  • Loading branch information
bradwilson committed Jul 1, 2023
1 parent 5e96160 commit c29a760
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/xunit.runner.visualstudio/Sinks/VsExecutionSink.cs
Expand Up @@ -264,14 +264,15 @@ void HandleTestMethodCleanupFailure(MessageHandlerArgs<ITestMethodCleanupFailure
VsTestResult? MakeVsTestResult(
TestOutcome outcome,
ITestSkipped skippedResult) =>
MakeVsTestResult(outcome, skippedResult.TestCase, skippedResult.Test.DisplayName, (double)skippedResult.ExecutionTime, skippedResult.Reason);
MakeVsTestResult(outcome, skippedResult.TestCase, skippedResult.Test.DisplayName, (double)skippedResult.ExecutionTime, errorMessage: skippedResult.Reason);

VsTestResult? MakeVsTestResult(
TestOutcome outcome,
ITestCase testCase,
string displayName,
double executionTime = 0.0,
string? output = null)
string? output = null,
string? errorMessage = null)
{
var vsTestCase = FindTestCase(testCase);
if (vsTestCase == null)
Expand All @@ -292,6 +293,9 @@ void HandleTestMethodCleanupFailure(MessageHandlerArgs<ITestMethodCleanupFailure
if (!string.IsNullOrEmpty(output))
result.Messages.Add(new VsTestResultMessage(VsTestResultMessage.StandardOutCategory, output));

if (!string.IsNullOrEmpty(errorMessage))
result.ErrorMessage = errorMessage;

return result;
}

Expand Down

0 comments on commit c29a760

Please sign in to comment.