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 description/name option for global hooks #1079

Closed
dietergeerts opened this issue Apr 27, 2018 · 5 comments
Closed

Add description/name option for global hooks #1079

dietergeerts opened this issue Apr 27, 2018 · 5 comments
Assignees
Labels
🙏 help wanted Help wanted - not prioritized by core team ⚡ enhancement Request for new functionality

Comments

@dietergeerts
Copy link

I searched for it, but couldn't find out how to do this, even from the source code.
So basically, we now have this kind of output:

1) Scenario: Create meeting # features\MI0465-203-create-meeting.feature:10
   √ Before # features\step_definitions\hooks.js:31
   √ Before # features\step_definitions\hooks.js:43
   √ Given Actor Manager # features\step_definitions\actor.js:10
   √ When I wish to create a Meeting # features\step_definitions\meetings.js:13
...
   × Then The Meeting has the type Express # features\step_definitions\meeting-form.js:52
       NoSuchElementError: No element found using locator: By(css selector, *[id="meeting-type-name"])
...

As there can be more than 1 global (before) hook ran during a scenario, it would be handy to know which ones where run. Especially because we use tagged global hooks, so depending on the tags, some will run, others won't. If a test fails, we would like to see what has been run.

Is this available right now? And if not, can this be added?

@charlierudolph
Copy link
Member

You can see which hooks ran based on there location of definition.

√ Before # features\step_definitions\hooks.js:31
√ Before # features\step_definitions\hooks.js:43

Both hooks are defined in features\step_definitions\hooks.js with one on line 31 and the other on line 43.

@dietergeerts
Copy link
Author

I know you can see that, but for users that didn't wrote the test, and for those that did too, it's far easier to have some name for the before step printed after the Before keyword while reading the output of a test, otherwise, you'll always have to look what the before steps do. With a name/description, you will not need to check each time you read the output.

@charlierudolph
Copy link
Member

Okay. This isn't currently available but we could add it as an option alongside the timeout for all hooks

@aslakhellesoy aslakhellesoy added 🙏 help wanted Help wanted - not prioritized by core team ⚡ enhancement Request for new functionality labels Feb 2, 2021
@davidjgoss davidjgoss self-assigned this Mar 3, 2022
@davidjgoss
Copy link
Contributor

davidjgoss commented Mar 3, 2022

Just calling out that this is underway via cucumber/messages#73.

@davidjgoss
Copy link
Contributor

This has now been released in v8.1.0 on npm

https://www.npmjs.com/package/@cucumber/cucumber

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🙏 help wanted Help wanted - not prioritized by core team ⚡ enhancement Request for new functionality
Projects
None yet
Development

No branches or pull requests

4 participants