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

Add Name() string to StepTest interface #117

Closed
jirikuncar opened this issue Jun 30, 2020 · 6 comments
Closed

Add Name() string to StepTest interface #117

jirikuncar opened this issue Jun 30, 2020 · 6 comments
Labels
enhancement New feature or request

Comments

@jirikuncar
Copy link
Collaborator

Is your feature request related to a problem? Please describe.
I would like to be able to use the step name for logging and tracing.

Describe the solution you'd like
Add Name() string to StepTest.

Describe alternatives you've considered
t.(*testing.T))

Additional context
TBD

@jirikuncar jirikuncar added the enhancement New feature or request label Jun 30, 2020
@github-actions
Copy link

Thanks for creating your first issue! We are thankful for your help

@sagikazarmark
Copy link
Collaborator

If you use t.Log functions, it should already group the output under the right test.

What's your use case?

@jirikuncar
Copy link
Collaborator Author

@sagikazarmark tracing and VCR recording. The work around with t.(*testing.T)) is working but it's not really nice.

@bkielbasa
Copy link
Collaborator

exposing the t to the context comes back. Again. But, it will break the backwards compatibility because we'll have to pass the t to the NewContext() function https://github.com/go-bdd/gobdd/blob/master/context.go#L13.

What I can suggest is to add a new function to the context and call it ctx.T() or ctx.Logger() that will return an interface with logging capabilities.

Are there any other use cases where the testing.T will be useful?

@jirikuncar
Copy link
Collaborator Author

@bkielbasa maybe t.Cleanup() in Go 1.14?

@bkielbasa
Copy link
Collaborator

you have Before and AfterSuite functions. Do you need more than that?

What's more, doesn't the standard output fit your need? Could you provide an example?

This task is quite old now. I think I'll close it for now but don't hesitate to reopen it if needed :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants