-
-
Notifications
You must be signed in to change notification settings - Fork 21
Emit appropriate messages on @BeforeAll and @AfterAll hooks #66
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
Comments
@aslakhellesoy I don't think Cucumber currently has a message type suitable for before all/after all hooks. Using |
From the perspective of cucumber-ruby, as documented here: https://github.com/cucumber/cucumber-ruby/tree/main/features/docs/writing_support_code/hooks#beforeall-and-afterall, BeforeAll and AfterAll hooks are not part of the execution of the tests. There are suppose to setup and clean-up things that are not related to cucumber. As @mpkorstanje said, I am not sure there would be an appropriate event for those. We could maybe add new ones dedicated to such hooks? |
I think we would need new message types in https://github.com/cucumber/common/tree/main/messages/jsonschema - maybe |
That would mean adding four messages |
What kind of reporting do you want to be able to do @HardNorth? |
@mattwynne I'm not really sure what you asking. I am a developer of Report Portal. It collects all test information (structure, hooks, logs, etc.) And analyse it with a taste of AI. I implemented numerous of test framework integrations for our project. Without these hooks reporting we won't be able to reflect them properly in our application, hence if such hook failed it won't be counted which cause statistics issues. And these hooks are also invisible for our analyser as for now |
Good point. Perhaps it would be better to simply have |
In my mind, the original I'm curious how you were thinking about reporting on it @HardNorth. Would a failure of a |
The equivalent of a special test step for before hooks would be a special test case for before all hooks. And a failure of a before all hook would be equivalent to failing the test run (same as with failure of a test case, worst result wins). |
@mattwynne We don't report all tests as failed usually, just a single Item which failed. But for those who want to be extremely accurate I leave a public empty method, which can be overridden. |
+1
+1 keeping in mind to add a proper deprecation notice before totally replacing those |
@aurelien-reeves I am not suggesting we deprecate I am suggesting we use those messages only for Gherkin steps, and not for hooks. |
Yes, I understood 👌 Still, not using |
Yes it would be a breaking change, but there isn't anything to deprecate. |
This came up recently when looking at I tend to agree with @mattwynne's earlier comment that these global hooks are a different beast then scenario-level ones. It would be good to have the different types of hooks represented in a consistent way in the schema, but I don't think it's worth making a breaking change for (especially now the community is building tools around this stuff). I'd vote for new |
Sounds good to me. |
I have only just parsed, and do like @mpkorstanje's suggestion earlier that:
We could model a |
I don't see that as being backwards-compatible, because |
True, I didn't spot that. |
Is your feature request related to a problem? Please describe.
It look like
@BeforeAll
and@AfterAll
hooks do not fire any events, at least I don't see it in the code explicitly.This makes impossible to report them in third-party report systems. At least in a straightforward way, without hacking that with AspectJ.
Describe the solution you'd like
Fire
TestStepStarted
event as you do for all other hooks.The text was updated successfully, but these errors were encountered: