Closed suswariadla closed 5 months ago
@suswariadla would you mind elaborating on your use case a little? Interested to know the motivation and whether just attach
ing some text would be sufficient.
Hey @davidjgoss Thanks for Replying. You see in the image, that is a shot from jenkins cucumber html reporter, how the statement looks for the Before hook. After taking a look in to json file which is the source for jenkins cucumber html reporter we found that the json file does not capture the Before hook name and infact the cucumberJs does not provide an option to define the hook name in its syntax. So we request the flexibility to name the hooks in cucumberJs
I think this could be useful for reporting purposes. Would you be interested in helping us implement this @suswariadla?
Since the JSON format is now deprecated in favour of messages, this is something that would have to be added to the message protocol.
We probably wouldn't update the existing native JSON formatters, but we could update the standalone json formatter instead.
Cucumber implementations would have to extend the hook API. The syntax for various languages is already somewhat constrained because it's already used to pass tag expressions.
Proposed syntax:
Before({name: "Take out the rubbish"}, function () {
})
@Before(name = "Take out the rubbish")
public void doSomething(){
// Do something before each scenario
}
Before(name: 'Take out the rubbish') do
end
@aslakhellesoy Sure, I would be happy to implement it.
Thanks @suswariadla - much appreciated!
Here is a rough outline of the steps that should be taken:
string name = 4;
to https://github.com/cucumber/cucumber/blob/35c35561635555a0d098f2201d2806548dcfde47/messages/messages.proto#L632-L636cd messages
then make
cd javascript
then npm link
@cucumber/messages
- npm link @cucumber/messages
I think that's a good start. Eventually we'll also have to add an example to the compatibility kit's hook examples, and also improve fake-cucumber so it outputs hook
messages with names.
We'll also have to update @cucumber/react so it can render the names of hooks.
For now I'd suggest focusing on the numbered list above.
Happy to answer any questions - I realise this is a bit light on detail.
Hey @aslakhellesoy , I started working on this. I have a question from your instruction cucumber/common#4 When you referred Cucumber-JS does it exist as a folder in cucumber/ I tried to relate to other modules but I could not get a hint.
You can find the Cucumber JS implementation here:
https://github.com/cucumber/cucumber-js
Messages (the module aslak you suggested to update) is a library that is used by Cucumber JS.
https://github.com/cucumber/cucumber-js/blob/master/package.json#L162
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in a week if no further activity occurs.
This issue has been automatically closed because of inactivity. You can support the Cucumber core team on opencollective.
Any progress on this? I would like to see the description/name of the hook in reports, as now it only shows Before
, which isn't useful, especially when there are more before hooks.
@suswariadla was the last person who was mentioning they would look at this. So I'll tag them to see if they worked on it.
I know no-one from the core team has spent time working on this.
If you are wanting to work on it yourself, let us know and someone might be able to help.
Hey, nope. I did not finish it
If you are wanting to work on it yourself, let us know and someone might be able to help.
Well, I don't have sufficient time right now, and this change isn't a minor one from what I see. (minor in the sense that it needs lots of changes, not that it would be a hard one). When I get the time in the future, and this isn't yet implemented, I can take another look into implementing it.
I'm happy to pitch in on this. I think we can do it in a few stages:
name
parameter to the hook message schema (in messages 18.0.0)Closing this as completed. We have named hooks being tested in the cck fully for all cck conformant cucumbers.
Any new cucumber flavours that would need conformancy would need to pass this step in the CCK. I know the main ones are already working with it
Hi, I don't see there is an ability to add names to the Before and After hooks rightnow. Can the team consider adding the ability to name Before and After hooks so that they appear in the json reporter.