Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions src/Samples/TestStack.BDDfy.Samples/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,9 @@
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<AppendTargetFrameworkToOutputPath>true</AppendTargetFrameworkToOutputPath>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="../../TestStack.BDDfy/TestStack.BDDfy.csproj" />
<Compile Include="..\..\TestStack.BDDfy.Tests\XUnitOutputReporter.cs" Link="XUnitOutputReporter.cs" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="coverlet.collector" Version="10.0.1">
<PrivateAssets>all</PrivateAssets>
Expand All @@ -24,4 +22,8 @@
</PackageReference>
<PackageReference Include="xunit.v3" Version="3.2.2" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\TestStack.BDDfy\TestStack.BDDfy.csproj" />
</ItemGroup>
</Project>
28 changes: 28 additions & 0 deletions src/TestStack.BDDfy.Tests/XUnitOutputReporter.cs
Original file line number Diff line number Diff line change
@@ -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);
}
}
}
Loading