I have two specs in BDD. There's samples how to manage a single selenium driver using a central static variable (example) in a "DriverFactory".
That's nice as long as you don't run more than one spec in parallel. If you do, then the different specs will get confused because they are using the same driver.
This is really because the spec needs to be mapped to the driver, Java code is not tied to a spec. In other words, any spec can call any Java code. So you can't instantiate a class that's fully mapped to a spec and have a local driver.
Anyone came across this?
One idea to overcome is to have a "DriverFactory" with array of drivers, mapped to specs. But this means that Java step using the driver would need to know the context of the spec in which it's being executed..