-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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 result not passed to before/after hooks #891
Comments
Got bitten by this. Our upgrade to 3 on cucumber pro is on hold because of this. Is cucumber-js/src/runtime/test_case_runner.js Line 109 in fbff6b0
|
What part of this is needed exactly? Do you use just the status predicates? That appears to be the only thing used in the docs surrounding this |
We currently use |
@jbpros does your use case follow the examples we currently have surrounding this (saving a screenshot when a scenario fails)? I always thought it was really weird that the scenario was passed into hooks and would like to find a different way of handling this. Currently, I'm thinking we add a new support code function: |
As a tinker-user, I would want any such function / handler / object to have as much context as possible. Even without something grand as the entire past-and-future-run-tree (#875), it would be extremely useful to know what's the current step and scenario for each failure. I would urge you to consider passing these to |
The Hook Docs need to be updated as well - the first paragraph's link to |
Rather than |
@aslakhellesoy I want to focus on the use case and be sure we are solving it the right way. Consistency is important but that doesn't mean we should copy everything just because it exists elsewhere. We should be evolving as we determine better ways to handle things Can you or @mattwynne or someone from the ruby team shed some light on what AfterStep was built for and what it is used for? |
I'm not from the ruby team so I don't know what
For us, we will need the scenario and the result to be passed into This means if there were something like This can cause inconsistency within projects too depending on who implemented the hook; some may use I want to understand where you are coming from. Would you mind elaborating why you think the following?
|
I never really liked the mixing of the two paradigms. Before / After hooks are related to setup / teardown with actually running the tests. Using it for also reporting seems like something that should be taken care of separately
If you are doing this in AfterStep this is being done for failed steps, not failed scenarios. This is what all the examples in the repo are using the scenario object for and thats why I want to make a new hook for this specific use case. I haven't heard any other use compelling use case.
What type of additional logging do you do?
What is there to clean up after a step?
I am trying to collect those use cases. Sometimes people may be using it when there are other ways to do it or as a workaround for something that we could build in better support for.
Cucumber-js currently has no |
I'm in the process of trying to get cucumber 3 support in protractor-cucumber-framework and I could really use an |
Just to mention that all the discussed functionality (and much more) can be accomplished with So, for example, I use it to implement a "The next step should fail with error XYZ" step, which allows me to quickly implement deep negative checks and error simulations without implementing duplicate negative steps or special flippable error handling in each and every step. I think there's nothing an |
Any updates on this? Trying to upgrade from 2.0.0 to 3.0.0 at work and still getting undefined for scenarioResult |
@paul-phillips-ark yes, see #905. If you want to help move it forward you can branch off and submit a new pr that addresses @charlierudolph's comments. |
When I console.log(scenarioResult) I'm still getting undefined in both Before and After functions? Am I missing something? Apologies if above comment is dense sounding. |
My use cases currently are following: On before each scenario I request fixtures which fill my database for testing. Every feature has it's own set of fixtures needed for it. Fixture's path on server repeats feature's path, so I need Before({ timeout: 60 * 1000 }, scenarioResult => {
...
const file = scenarioResult.scenario.feature.uri;
...
}); On After(scenarioResult => {
if (scenarioResult.status === 'failed') {
driverUtils.takeScreenShot(scenarioResult.scenario.name);
}
}); |
@charlierudolph could you cut a release with pull request #905 as interim solution? it allows us to finish the transition from v2 to v3 - which is currently stuck due to this regression/change. your proposed refactoring could go into another pull request. |
There are some issues for #905 but I will try to get a fix in and do a release this weekend. |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
No description provided.
The text was updated successfully, but these errors were encountered: