My use case is to reset a static count which is incremented in each scenario.
Is there any progress on this?
It's easy to implement with #984:
public class Hooks {
private Set<Feature> beforeFeatures = new HashSet<>();
private Set<Feature> afterFeatures = new HashSet<>();
@Before
public void beforeFeature(Scenario scenario) {
Feature feature = scenario.getFeature();
if (!beforeFeatures.contains(feature)) {
beforeFeatures.add(feature);
// code to execute before feature
}
}
@After
public void afterFeature(Scenario scenario) {
Feature feature = scenario.getFeature();
if (!afterFeatures.contains(feature)) {
afterFeatures.add(feature);
// code to execute after feature
}
}
}
Hi @timp21337 , is the workaround provided by @kirillzh sufficient to solve this problem, or is this still important to you? If so, please let us know. Otherwise, if we don't hear back from you in a week, I'll close this ticket.
Thanks for reaching out. I am not currently a Cucumberist so cannot say with any certainty. Reading #76 it still looks like nice syntactic sugar, but if the project does not feel the need then feel free to close.
Unfortunately we are not going to get this after or before feature hook. Ref: https://github.com/cucumber/cucumber-jvm/issues/902#issuecomment-309293480
Do you have any plans for after or before feature hook ?
Even I look for tag but I do not want to run tests after each tests. I want to run some clean up tests after group of tests.
Cleanup between (groups of) tests is error prone and will prevent parallel execution in the future. This makes it unlikely to be added.
Avoid the trouble and make sure each scenario is independent. This may require some engineering.
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.
Most helpful comment
It's easy to implement with #984: