diff --git a/Versions.props b/Versions.props
index 0127713..ee4d2dc 100644
--- a/Versions.props
+++ b/Versions.props
@@ -8,8 +8,8 @@
3.6.133
5.1.0
1.0.0-alpha.160
- 1.13.0
- 2.8.0
+ 1.14.0-pre.3
+ 2.8.1-pre.10
diff --git a/src/xunit.runner.visualstudio/Sinks/VsExecutionSink.cs b/src/xunit.runner.visualstudio/Sinks/VsExecutionSink.cs
index 0732495..62460a0 100644
--- a/src/xunit.runner.visualstudio/Sinks/VsExecutionSink.cs
+++ b/src/xunit.runner.visualstudio/Sinks/VsExecutionSink.cs
@@ -22,7 +22,8 @@ public VsExecutionSink(
ITestExecutionRecorder recorder,
LoggerHelper logger,
Dictionary testCasesMap,
- Func cancelledThunk)
+ Func cancelledThunk,
+ bool showLiveOutput)
{
this.innerSink = innerSink;
this.recorder = recorder;
@@ -45,6 +46,9 @@ public VsExecutionSink(
Execution.TestMethodCleanupFailureEvent += HandleTestMethodCleanupFailure;
Execution.TestPassedEvent += HandleTestPassed;
Execution.TestSkippedEvent += HandleTestSkipped;
+
+ if (showLiveOutput)
+ Execution.TestOutputEvent += HandleTestOutput;
}
public ExecutionSummary ExecutionSummary { get; private set; }
@@ -127,6 +131,12 @@ void HandleTestFailed(MessageHandlerArgs args)
HandleCancellation(args);
}
+ void HandleTestOutput(MessageHandlerArgs args)
+ {
+ var testOutput = args.Message;
+ logger.Log(" {0} [OUTPUT] {1}", testOutput.Test.DisplayName, testOutput.Output.TrimEnd());
+ }
+
void HandleTestPassed(MessageHandlerArgs args)
{
var testPassed = args.Message;
diff --git a/src/xunit.runner.visualstudio/Utility/RunSettings.cs b/src/xunit.runner.visualstudio/Utility/RunSettings.cs
index 611de93..604fcaf 100644
--- a/src/xunit.runner.visualstudio/Utility/RunSettings.cs
+++ b/src/xunit.runner.visualstudio/Utility/RunSettings.cs
@@ -23,6 +23,7 @@ public class RunSettings
public bool? PreEnumerateTheories { get; set; }
public string? ReporterSwitch { get; set; }
public bool? ShadowCopy { get; set; }
+ public bool? ShowLiveOutput { get; set; }
public bool? StopOnFail { get; set; }
public string? TargetFrameworkVersion { get; set; }
@@ -54,6 +55,8 @@ public void CopyTo(TestAssemblyConfiguration configuration)
configuration.PreEnumerateTheories = PreEnumerateTheories;
if (ShadowCopy.HasValue)
configuration.ShadowCopy = ShadowCopy;
+ if (ShowLiveOutput.HasValue)
+ configuration.ShowLiveOutput = ShowLiveOutput;
if (StopOnFail.HasValue)
configuration.StopOnFail = StopOnFail;
}
@@ -154,6 +157,10 @@ public static RunSettings Parse(string? settingsXml)
if (bool.TryParse(shadowCopyString, out var shadowCopy))
result.ShadowCopy = shadowCopy;
+ var showLiveOutputString = xunitElement.Element(Constants.Xunit.ShowLiveOutput)?.Value;
+ if (bool.TryParse(showLiveOutputString, out var showLiveOutput))
+ result.ShowLiveOutput = showLiveOutput;
+
var stopOnFailString = xunitElement.Element(Constants.Xunit.StopOnFail)?.Value;
if (bool.TryParse(stopOnFailString, out var stopOnFail))
result.StopOnFail = stopOnFail;
@@ -243,6 +250,7 @@ public static class Xunit
public const string PreEnumerateTheories = "PreEnumerateTheories";
public const string ReporterSwitch = "ReporterSwitch";
public const string ShadowCopy = "ShadowCopy";
+ public const string ShowLiveOutput = "ShowLiveOutput";
public const string StopOnFail = "StopOnFail";
}
}
diff --git a/src/xunit.runner.visualstudio/VsTestRunner.cs b/src/xunit.runner.visualstudio/VsTestRunner.cs
index 79bf42d..903f966 100644
--- a/src/xunit.runner.visualstudio/VsTestRunner.cs
+++ b/src/xunit.runner.visualstudio/VsTestRunner.cs
@@ -543,7 +543,7 @@ void RunTestsInAssembly(
reporterMessageHandler.OnMessage(new TestAssemblyExecutionStarting(runInfo.Assembly, executionOptions));
- using var vsExecutionSink = new VsExecutionSink(reporterMessageHandler, frameworkHandle, logger, testCasesMap, () => cancelled);
+ using var vsExecutionSink = new VsExecutionSink(reporterMessageHandler, frameworkHandle, logger, testCasesMap, () => cancelled, executionOptions.GetShowLiveOutputOrDefault());
var executionSinkOptions = new ExecutionSinkOptions
{
DiagnosticMessageSink = diagnosticsSinkRemote,
diff --git a/test/test.xunit.runner.visualstudio/RunSettingsTests.cs b/test/test.xunit.runner.visualstudio/RunSettingsTests.cs
index 60126e0..7041f9e 100644
--- a/test/test.xunit.runner.visualstudio/RunSettingsTests.cs
+++ b/test/test.xunit.runner.visualstudio/RunSettingsTests.cs
@@ -1,5 +1,6 @@
using System;
using Xunit;
+using Xunit.Abstractions;
using Xunit.Runner.VisualStudio;
public class RunSettingsTests
@@ -23,6 +24,7 @@ void AssertDefaultValues(RunSettings runSettings)
Assert.Null(runSettings.PreEnumerateTheories);
Assert.Null(runSettings.ReporterSwitch);
Assert.Null(runSettings.ShadowCopy);
+ Assert.Null(runSettings.ShowLiveOutput);
Assert.Null(runSettings.StopOnFail);
Assert.Null(runSettings.TargetFrameworkVersion);
}
@@ -123,6 +125,7 @@ public void RunSettingsHelperShouldReadBooleanValuesCorrectly(bool testValue)
{testValueString}
{testValueString}
{testValueString}
+ {testValueString}
{testValueString}
";
@@ -140,6 +143,7 @@ public void RunSettingsHelperShouldReadBooleanValuesCorrectly(bool testValue)
Assert.Equal(testValue, runSettings.ParallelizeTestCollections);
Assert.Equal(testValue, runSettings.PreEnumerateTheories);
Assert.Equal(testValue, runSettings.ShadowCopy);
+ Assert.Equal(testValue, runSettings.ShowLiveOutput);
Assert.Equal(testValue, runSettings.StopOnFail);
}