diff --git a/src/Samples/TestStack.BDDfy.Samples/Startup.cs b/src/Samples/TestStack.BDDfy.Samples/Startup.cs index b1868502..c70060ea 100644 --- a/src/Samples/TestStack.BDDfy.Samples/Startup.cs +++ b/src/Samples/TestStack.BDDfy.Samples/Startup.cs @@ -2,6 +2,7 @@ using TestStack.BDDfy.Configuration; using TestStack.BDDfy.Reporters.Html; using TestStack.BDDfy.Samples.Atm; +using TestStack.BDDfy.Tests; namespace TestStack.BDDfy.Samples { @@ -11,6 +12,7 @@ public class Startup public static void Initialize() { Configurator.Processors.Add(() => new CustomTextReporter()); + Configurator.Processors.Add(() => new XUnitOutputReporter()); Configurator.Processors.ConsoleReport.Enable(); Configurator.BatchProcessors.MarkDownReport.Enable(); Configurator.BatchProcessors.DiagnosticsReport.Enable(); diff --git a/src/Samples/TestStack.BDDfy.Samples/TestStack.BDDfy.Samples.csproj b/src/Samples/TestStack.BDDfy.Samples/TestStack.BDDfy.Samples.csproj index c837c3c4..803424c9 100644 --- a/src/Samples/TestStack.BDDfy.Samples/TestStack.BDDfy.Samples.csproj +++ b/src/Samples/TestStack.BDDfy.Samples/TestStack.BDDfy.Samples.csproj @@ -6,11 +6,9 @@ true true - - + - all @@ -24,4 +22,8 @@ + + + + diff --git a/src/TestStack.BDDfy.Tests/XUnitOutputReporter.cs b/src/TestStack.BDDfy.Tests/XUnitOutputReporter.cs new file mode 100644 index 00000000..4e02a043 --- /dev/null +++ b/src/TestStack.BDDfy.Tests/XUnitOutputReporter.cs @@ -0,0 +1,28 @@ +using TestStack.BDDfy.Reporters; +using Xunit; + +namespace TestStack.BDDfy.Tests +{ + public class XUnitOutputReporter(ITestOutputHelper testOutputHelper = null): TextReporter + { + private ITestOutputHelper _outputHelper = testOutputHelper ?? Xunit.TestContext.Current.TestOutputHelper; + + protected override void WriteLine(string text = null) + { + if (text is not null) _outputHelper.WriteLine(text); + base.WriteLine(text); + } + + protected override void Write(string text, params object[] args) + { + _outputHelper.Write(text, args); + base.Write(text, args); + } + + protected override void WriteLine(string text, params object[] args) + { + _outputHelper.WriteLine(text, args); + base.WriteLine(text, args); + } + } +} \ No newline at end of file