On Tue, Feb 26, 2008 at 10:53 PM, Bei <[EMAIL PROTECTED]> wrote: > Hi > > I'm using story runner of RSpec now. What I'm trying to do is > initializing the @selenium before any steps of one story is executing, > and stop @selenium after any story is finished. just as @BeforeClass > and @AfterClass in jUnit > Any suggestions on this?
There is no way built in to handle this yet. Is anybody doing this yet? If not, you'll have to experiment. If you're interested, I think the way to handle it is to register a listener like this: Spec::Story::Runner.register_listener(listener) The listener object should receive messages like run_started, story_started, scenario_started and story_ended, run_ended and scenario_failed or scenario_pending. Be sure to implement method_missing to ignore everything else. Good luck, and let us know what works. Cheers, David > > Thanks!!! > > > Bei > > here is my code for > STEPS: > > steps_for(:search) do > > Given("user could access search page") do > @google_page = GooglePage.new(@selenium) > @google_page.open; > end > > Given("user enter search test: $search_text") do |$search_text| > @google_page.search_text=$search_text > end > > When("do search") do > @search_result_page = @google_page.search > end > > Then("show search result") do > @search_result_page.should_not == nil > end > end > > > STORY: > > Story: #000 > As A command human > I want to get information quickly > So that I could save me time on doing real things > > Scenario: could search > Given user could access search page > And user enter search test: asdfasdfasdfas > When do search > Then show search result > > > GLUE: > with_steps_for :search do > run 'stories/000.story' > end > > > _______________________________________________ > rspec-users mailing list > rspec-users@rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users > _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users