Reusing the Browser
Each of our scenarios is exercising our application through our web UI and so needs to use a browser. At the moment we start a new instance of Firefox for each scenario, which takes a fair amount of time. Is it really necessary, or could our scenarios all use the same instance of Firefox?
It’s important that each scenario is isolated from all other scenarios, but the browser itself holds very little context. In most situations it is quite safe to reuse the same browser instance for all your scenarios as long as you clear out any cookies. In this example it’s even simpler—we have no cookies.
Sharing a Browser Using Spring
We’re using a Spring configuration file, cucumber.xml, to define our EventFiringWebDriver. It just ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access