Global BeforeAll Hook for cucumber-jvm?

2019-06-19 08:29发布

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?

2条回答
甜甜的少女心
2楼-- · 2019-06-19 09:08

As far as I know global hooks are not supported by Cucumber-JVM. However, you could try (tagged) hooks, @Before annotations and as a work-around static fields. Have a look here for an example.

查看更多
我欲成王,谁敢阻挡
3楼-- · 2019-06-19 09:10

Please follow this link. this a workaround for @BeforeAll and @AfterAll

https://github.com/cucumber/cucumber-jvm/issues/515

查看更多
登录 后发表回答