Search code examples
javacucumbercucumber-jvm

Global BeforeAll Hook for cucumber-jvm?


The ruby version of cucumber supports a global before hook. An *.rb file placed in the features/support directory gets apparently called only once, before any and all scenarios run. See https://github.com/cucumber/cucumber/wiki/Hooks#global-hooks

That seems to be a great way to make sure a database (used in read-only during tests) gets populated (and thus is in a known state) before any tests run.

Is there a similar feature available for the Java version of cucumber?


Solution

  • According to the most recent docs, Cucumber offers a BeforeAll and AfterAll hook which will run before the first scenario and after the last scenario, respectively.