I've been using a monkey-patched version of Selenium Webdriver, which keeps PhantomJS browser open between test runs. See this blog post: http://blog.sharetribe.com/2014/04/07/faster-cucumber-startup-keep-phantomjs-browser-open-between-tests/
The trick is to stub the Selenium::WebDriver::PhantomJS::Service.create_process
method and tell the Selenium Driver to use the default port 8910 even though it is reserved.
You can add this piece of code to your config/test.rb file:
class Selenium::WebDriver::PortProber
def self.free?(port)
true
end
end
class Selenium::WebDriver::PhantomJS::Service
def create_process(args)
puts "Starting monkey-patched PhantomJS Selenium Webdriver"
Struct.new("ChildProcessFake") do
def start() end
def exited?() true end
end.new
end
end
Now you can start PhantomJS in a terminal tab:
phantomjs --webdriver=8910
And when you have PhantomJS running, you can start your Cucumber tests.
Obviously this works only for PhantomJS, but something similar could work with other browsers too.