Hi, Is there a hook or a method to execute some code after a whole feature has run or will I need to embed that in a ''Then''? Regards Aidy
On Mon, Jan 5, 2009 at 2:33 PM, aidy lewis <aidy.lewis at googlemail.com>wrote:> Hi, > > Is there a hook or a method to execute some code after a whole feature > has run or will I need to embed that in a ''Then''? >May I ask what you''re planning to use it for? Aslak> > Regards > > Aidy > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20090105/4386faf5/attachment.html>
aidy lewis wrote:> Hi, > > Is there a hook or a method to execute some code after a whole feature > has run or will I need to embed that in a ''Then''? > >There are currently no before/after feature hooks. http://github.com/aslakhellesoy/cucumber/wikis/hooks Also if you want something to happen before/after everything you can use World and at_exit respectively. -- Joseph Wilk http://blog.josephwilk.net> Regards > > Aidy > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users > >
Hi Alsak, I am finding it difficult to separate my Acceptance Tests unless I have lengthy scenarios. One scenario would be one sequence of action etc - until a goal is reached. At the end of the feature, I would like the browser to close: If the browser closes on each scenario - they I have to get back to the previous state. This is expensive with browser based tests. Aidy On 05/01/2009, aslak hellesoy <aslak.hellesoy at gmail.com> wrote:> > > > On Mon, Jan 5, 2009 at 2:33 PM, aidy lewis <aidy.lewis at googlemail.com> > wrote: > > Hi, > > > > Is there a hook or a method to execute some code after a whole feature > > has run or will I need to embed that in a ''Then''? > > > > May I ask what you''re planning to use it for? > > Aslak > > > > Regards > > > > Aidy > > _______________________________________________ > > rspec-users mailing list > > rspec-users at rubyforge.org > > http://rubyforge.org/mailman/listinfo/rspec-users > > > > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >
aidy lewis wrote:> Hi, > > Is there a hook or a method to execute some code after a whole feature > has run or will I need to embed that in a ''Then''? > >There are currently no before/after feature hooks. http://github.com/aslakhellesoy/cucumber/wikis/hooks Also if you want something to happen before/after everything you can use World and at_exit respectively. -- Joseph Wilk http://blog.josephwilk.net> Regards > > Aidy > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users > >
On Mon, Jan 5, 2009 at 3:12 PM, aidy lewis <aidy.lewis at googlemail.com>wrote:> Hi Alsak, > > I am finding it difficult to separate my Acceptance Tests unless I > have lengthy scenarios. > > One scenario would be one sequence of action etc - until a goal is reached. > > At the end of the feature, I would like the browser to close: If the > browser closes on each scenario - they I have to get back to the > previous state. This is expensive with browser based tests. >And only closing the browser after all the features (at_exit) does not work? Aslak> > Aidy > > > > On 05/01/2009, aslak hellesoy <aslak.hellesoy at gmail.com> wrote: > > > > > > > > On Mon, Jan 5, 2009 at 2:33 PM, aidy lewis <aidy.lewis at googlemail.com> > > wrote: > > > Hi, > > > > > > Is there a hook or a method to execute some code after a whole feature > > > has run or will I need to embed that in a ''Then''? > > > > > > > May I ask what you''re planning to use it for? > > > > Aslak > > > > > > Regards > > > > > > Aidy > > > _______________________________________________ > > > rspec-users mailing list > > > rspec-users at rubyforge.org > > > http://rubyforge.org/mailman/listinfo/rspec-users > > > > > > > > > _______________________________________________ > > rspec-users mailing list > > rspec-users at rubyforge.org > > http://rubyforge.org/mailman/listinfo/rspec-users > > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20090105/af137901/attachment-0001.html>
aidy lewis wrote:> Hi Alsak, > > I am finding it difficult to separate my Acceptance Tests unless I > have lengthy scenarios. > > One scenario would be one sequence of action etc - until a goal is reached. > > At the end of the feature, I would like the browser to close:So you are using scenarios to get the browser into a certain state and then the next scenario relies on continuing work on that state? I guess this must mean one scenario failing breaks all following scenarios in the feature?> If the > browser closes on each scenario - they I have to get back to the > previous state. This is expensive with browser based tests. > > Aidy > >A bit of a side note but can I ask why you need the browser to close after a scenario or feature? In Selenium (not sure if Watir is the same) the time expense of starting a new browser instances per scenario or per feature is too high (It can take 7/8 seconds for selenium to start a browser). So rather than closing and opening new browsers we use a single browser instance open throughout the test run. We terminate the session before each scenario (By accessing logout). @@@ruby World do ... browser.open ''/logout'' ... end @@@ -- Joseph Wilk http://blog.josephwilk.net> > On 05/01/2009, aslak hellesoy <aslak.hellesoy at gmail.com> wrote: > >> >> On Mon, Jan 5, 2009 at 2:33 PM, aidy lewis <aidy.lewis at googlemail.com> >> wrote: >> >>> Hi, >>> >>> Is there a hook or a method to execute some code after a whole feature >>> has run or will I need to embed that in a ''Then''? >>> >>> >> May I ask what you''re planning to use it for? >> >> Aslak >> >>> Regards >>> >>> Aidy >>> _______________________________________________ >>> rspec-users mailing list >>> rspec-users at rubyforge.org >>> http://rubyforge.org/mailman/listinfo/rspec-users >>> >>> >> _______________________________________________ >> rspec-users mailing list >> rspec-users at rubyforge.org >> http://rubyforge.org/mailman/listinfo/rspec-users >> >> > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users > >
Hi Joe, Aslak 2009/1/5 Joseph Wilk <joe at josephwilk.net>:> aidy lewis wrote: >> >> Hi Alsak, >> >> I am finding it difficult to separate my Acceptance Tests unless I >> have lengthy scenarios. >> >> One scenario would be one sequence of action etc - until a goal is >> reached. >> >> At the end of the feature, I would like the browser to close: > > So you are using scenarios to get the browser into a certain state and then > the next scenario relies on continuing work on that state? > I guess this must mean one scenario failing breaks all following scenarios > in the feature? >> >> If the >> browser closes on each scenario - they I have to get back to the >> previous state. This is expensive with browser based tests. >> >> Aidy >> >> > > A bit of a side note but can I ask why you need the browser to close after a > scenario or feature? > > In Selenium (not sure if Watir is the same) the time expense of starting a > new browser instances per scenario or per feature is too high (It can take > 7/8 seconds for selenium to start a browser). So rather than closing and > opening new browsers we use a single browser instance open throughout the > test run. We terminate the session before each scenario (By accessing > logout). > > @@@ruby > World do > ... > browser.open ''/logout'' > ... > end > @@@ >at_exit {browser.close} works fine and I should have thought of that. Thanks Maybe Selenium RC is slow on starting the browser by going through the HTTP proxy - but I am not sure. Watir\Firewatir does not take that long. I am closing the browser because if the test or A-U-T totally bombs; I can get rid of that session and run the next test. So if one test fails, all my tests don''t. Aidy