Using MVS 2015/ Speckflow (2.4.1)/ xUnit (2.0.0) Please help to printout anything from static method with xUnit framework:
namespace UnitTestProject2
{
[Binding]
public class SpecFlowHooks
{
private readonly ITestOutputHelper output;
public SpecFlowHooks(ITestOutputHelper output)
{
this.output = output;
}
[BeforeFeature]
public static void BeforeFeature()
{
Console.WriteLine("~~~~~~~ calling BeforeFeature");
}
[AfterFeature]
public static void AfterFeature()
{
Debug.WriteLine("~~~~~~~ calling AfterFeature");
}
[BeforeScenario]
public void BeforeScenario()
{
output.WriteLine("~~~~~~~ calling BeforeScenario");
}
[AfterScenario]
public void AfterScenario()
{
output.WriteLine("~~~~~~~ calling AfterScenario");
}
}
}
Result StandardOutput:
calling BeforeScenario
entered number: 50
entered number: 70
Add button pressed
Test passed
calling AfterScenario
As you can see, there's no output from static methods.