I am using Spec:UI to run my Selenium tests, and I want to start
Selenium only once, for many descriptions.
I''ve come quite far solving it by declaring a main ui spec like the
following:
require ''pathname''
require File.dirname(__FILE__) + ''/selenium''
$base_url="http://localhost:3000"
$browser = Selenium::SeleniumDriver.new("localhost", 4444,
"*firefox",
"http://localhost:3000", 10000)
$browser.start
Dir.glob(Pathname.new(__FILE__).parent.join("iteration*").join("*.rb")).each
do |file|
require file
end
$browser.kill! rescue nil
The problem is that the browser is killed before the specs are run.
Anyone has an idea why this is happening?
On a related sidenote, a listener interface in RSpec would be quite
nice, could the Spec::Runnner::Reporter be used for that?
/Marcus
Cheers /Marcus
--
http://marcus.ahnve.net
On 5/29/07, Marcus Ahnve <marcus at ahnve.com> wrote:> I am using Spec:UI to run my Selenium tests, and I want to start > Selenium only once, for many descriptions. > > I''ve come quite far solving it by declaring a main ui spec like the following: > > require ''pathname'' > require File.dirname(__FILE__) + ''/selenium'' > > $base_url="http://localhost:3000" > $browser = Selenium::SeleniumDriver.new("localhost", 4444, "*firefox", > "http://localhost:3000", 10000) > $browser.start > > Dir.glob(Pathname.new(__FILE__).parent.join("iteration*").join("*.rb")).each > do |file| > require file > end > > $browser.kill! rescue nil > > The problem is that the browser is killed before the specs are run. > Anyone has an idea why this is happening? >Yes, because requiring a spec file doesn''t automatically run it - it just queues it up for running. Try killing your $browser in an at_exit{} block instead Aslak> On a related sidenote, a listener interface in RSpec would be quite > nice, could the Spec::Runnner::Reporter be used for that? > > /Marcus > > Cheers /Marcus > -- > http://marcus.ahnve.net > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >
On 5/29/07, aslak hellesoy <aslak.hellesoy at gmail.com> wrote:> On 5/29/07, Marcus Ahnve <marcus at ahnve.com> wrote: > > I am using Spec:UI to run my Selenium tests, and I want to start > > Selenium only once, for many descriptions. > > The problem is that the browser is killed before the specs are run. > > Anyone has an idea why this is happening? > > > > Yes, because requiring a spec file doesn''t automatically run it - it > just queues it up for running. Try killing your $browser in an > at_exit{} block insteadBrilliant. Thanks. Cheers /Marcus -- http://marcus.ahnve.net