Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scenario name in spec constructor #139

Open
alastair-todd opened this issue Nov 10, 2022 · 2 comments
Open

Scenario name in spec constructor #139

alastair-todd opened this issue Nov 10, 2022 · 2 comments

Comments

@alastair-todd
Copy link

alastair-todd commented Nov 10, 2022

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 ...
@alastair-todd alastair-todd changed the title Scenario name in spec contructor Scenario name in spec constructor Nov 10, 2022
@ttutisani
Copy link
Owner

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.

@ttutisani
Copy link
Owner

@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.

@ttutisani ttutisani reopened this Jan 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants