Global BeforeAll Hook for cucumber-jvm?

天涯浪子 提交于 2019-12-12 10:44:08

问题


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?


回答1:


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

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




回答2:


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.



来源:https://stackoverflow.com/questions/19770103/global-beforeall-hook-for-cucumber-jvm

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!