xsbt-cucumber-plugin icon indicating copy to clipboard operation
xsbt-cucumber-plugin copied to clipboard

BeforeAll and AfterAll hooks

Open manuelbernhardt opened this issue 11 years ago • 2 comments

It would be great to have those hooks in order to allow usage in environments that require global set-up & shut down, such as the Play framework. Using the SBT setting hooks cucumberBefore and cucumberAfter does not seem to be easily possible in this case because running the Play testing environment (which also launches database plugins, etc.) is only available in Play code, and the SBT build itself won't have those in scope.

Strangely enough I was able to initialize the Play environment in the previous version of the plugin (0.7.2) by calling the Play.start() method directly in the test class, however this no longer seems to work now.

manuelbernhardt avatar Sep 17 '13 14:09 manuelbernhardt

Unfortunately that's not something I have control over really. In fact, when running the cucumber task, the plugin forks a new JVM and executes the cucumber-jvm main method. So, there's really no scope for supporting BarofeAll/AfterAll hooks at this level. This feels like something that should be handled by cucumber-jvm itself. In fact, there's an issue specifically related to this: https://github.com/cucumber/cucumber-jvm/issues/515

There may be some possibility to support this within the test task integration model and I'm planning on revisiting this implementation in the near future, so I'll see what might be possible.

skipoleschris avatar Sep 18 '13 08:09 skipoleschris

Thanks! In the meantime I found out that the problem I'm facing is more likely due to a regression with Play 2.2, so I'm looking into this now. The hooks would still be convenient but there should be a way to work without them.

manuelbernhardt avatar Sep 24 '13 07:09 manuelbernhardt