Not in Cucumber-JVM, but in Java itself.
Use a static field.
You can kill it before the JVM exits in a shutDownHook that you set up
in a static initializer.
http://download.oracle.com/javase/1,5.0/docs/guide/lang/hook-design.html
Aslak
> I'm aware
> of the @Before annotation, but that seems to work before each scenario. I'm
> looking for something at a higher level -- possbily, something like
> @BeforeAll. I understand that Cucumber (Ruby version) has at its disposal
> an env.rb file, which bootstraps and configures the Cucumber runner
> environment. What I'm after is a way I might be able to create a WebDriver
> object just once and then share it among the different step definition
> classes. Currently, we are using something like
>
> @Before
> public void startBrowser() {
> driver = new FirefoxDriver();
> }
>
> @After
> public void quitBrowser() {
> driver.quit();
> }
>
> for each of our step definitions. However, this results in Selenium opening
> a new web brower window for each scenario. Is this even possible? If so,
> please provide some examples of how I may implement it. Thanks.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Cukes" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/cukes/-/C_8Wu6FDWzUJ.
> To post to this group, send email to cu...@googlegroups.com.
> To unsubscribe from this group, send email to
> cukes+un...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/cukes?hl=en.
>