ttutisani/Xunit.Gherkin.Quick

Scenario name in spec constructor

Opened this issue · 2 comments

Hey

Is there a way to infer the current scenario in the Test class constructor?

I'd like to log this to console so it can be sent to our central logs.

protected AbstractSpecification(SpecificationFixture fixture, ITestOutputHelper testOutput)
        {
            Fixture = fixture;
            
            LogInformation("Starting..."); // << Scenario title here

Thanks

p.s. Being able to redirect the built-in step logging would also be awesome

I am trying hard to diagnose a stalling in test circleci ...

No, the framework currently does not support detecting which scenario is running.

Theoretically, you can write code inside your test methods to determine the scenario name, but you will have to do it in every test method.

@alastair-todd did you find a solution to this question? If not, I'll keep this open until you respond or until it's implemented.