Jim Morris
2009-Apr-24 22:22 UTC
[rspec-users] Background and scenario outline interaction
Hi, I was surprised by this so I suspect it may be a bug. I have a Scenario Outline, and a Background in my Feature and nothing else, The Background got executed 1 more time than expected. Details are the Scenario Outline had 4 entries in the table, so I expected 4 scenarios to get executed, and the Background to get executed before each Scenario. What happened was the Background got executed once initially, then once for each entry on the outline table, the After scenario hook got correctly executed after each of the 4 scenarios, but not after the first Background (understandably as there was no scenario executed). Is this a bug or feature ;)
Aslak Hellesøy
2009-Apr-25 08:05 UTC
[rspec-users] Background and scenario outline interaction
Den 25. april. 2009 kl. 00.22 skrev Jim Morris <wolfmanjm at gmail.com>:> Hi, > > I was surprised by this so I suspect it may be a bug. > > I have a Scenario Outline, and a Background in my Feature and nothing > else, > > The Background got executed 1 more time than expected. > > Details are the Scenario Outline had 4 entries in the table, so I > expected 4 scenarios to get executed, and the Background to get > executed before each Scenario. > > What happened was the Background got executed once initially, then > once for each entry on the outline table, the After scenario hook got > correctly executed after each of the 4 scenarios, but not after the > first Background (understandably as there was no scenario executed). >Gist.github.com feature, output and expected output please Aslak> Is this a bug or feature ;) > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users
Ahh no I''m still using 0.2.0 I was going to write up a gist as an example, I actually just stopped using background and put it in the scenario outline, but I''ll try it on 0.3.0 Thanks On Apr 27, 5:11?am, Andrew Premdas <aprem... at gmail.com> wrote:> Is this with 0.3.0? If not this might have been recently fixed as I reported > a similar bug recently > > 2009/4/24 Jim Morris <wolfma... at gmail.com> > > > Hi, > > > I was surprised by this so I suspect it may be a bug. > > > I have a Scenario Outline, and a Background in my Feature and nothing > > else, > > > The Background got executed 1 more time than expected. > > > Details are the Scenario Outline had 4 entries in the table, so I > > expected 4 scenarios to get executed, and the Background to get > > executed before each Scenario. > > > What happened was the Background got executed once initially, then > > once for each entry on the outline table, the After scenario hook got > > correctly executed after each of the 4 scenarios, but not after the > > first Background (understandably as there was no scenario executed). > > > Is this a bug or feature ;) > > _______________________________________________ > > rspec-users mailing list > > rspec-us... at rubyforge.org > >http://rubyforge.org/mailman/listinfo/rspec-users > > > > _______________________________________________ > rspec-users mailing list > rspec-us... at rubyforge.orghttp://rubyforge.org/mailman/listinfo/rspec-users
Ok there is a different bug with 0.3.0, I''ll work up a gist, but it seems that background with scenario outline now has background run before the Before hook, or maybe the before hook is not being run. The docs say background runs after the before hook. I need to debug further to see what is actually happening On Apr 27, 5:11?am, Andrew Premdas <aprem... at gmail.com> wrote:> Is this with 0.3.0? If not this might have been recently fixed as I reported > a similar bug recently > > 2009/4/24 Jim Morris <wolfma... at gmail.com> > > > Hi, > > > I was surprised by this so I suspect it may be a bug. > > > I have a Scenario Outline, and a Background in my Feature and nothing > > else, > > > The Background got executed 1 more time than expected. > > > Details are the Scenario Outline had 4 entries in the table, so I > > expected 4 scenarios to get executed, and the Background to get > > executed before each Scenario. > > > What happened was the Background got executed once initially, then > > once for each entry on the outline table, the After scenario hook got > > correctly executed after each of the 4 scenarios, but not after the > > first Background (understandably as there was no scenario executed). > > > Is this a bug or feature ;) > > _______________________________________________ > > rspec-users mailing list > > rspec-us... at rubyforge.org > >http://rubyforge.org/mailman/listinfo/rspec-users > > > > _______________________________________________ > rspec-users mailing list > rspec-us... at rubyforge.orghttp://rubyforge.org/mailman/listinfo/rspec-users
Ok I confirmed that the Before hook is not run the first time through when scenario outline and Background is used. The After hook is run though. In subsequent outlines before and after run as expected. gist is here... git clone git://gist.github.com/102789.git gist-102789 http://gist.github.com/gists/102789/download I am using cucumber (0.3.1) jruby 1.1.6 also same results with ruby 1.8.6 (2008-08-11 patchlevel 287) [i686- linux] On Apr 27, 2:47?pm, wolfmanjm <wolfma... at gmail.com> wrote:> Ok there is a different bug with 0.3.0, I''ll work up a gist, but it > seems that background with scenario outline now has background ?run > before the Before hook, or maybe the before hook is not being run. The > docs say background runs after the before hook. > > I need to debug further to see what is actually happening > > On Apr 27, 5:11?am, Andrew Premdas <aprem... at gmail.com> wrote: > > > Is this with 0.3.0? If not this might have been recently fixed as I reported > > a similar bug recently > > > 2009/4/24 Jim Morris <wolfma... at gmail.com> > > > > Hi, > > > > I was surprised by this so I suspect it may be a bug. > > > > I have a Scenario Outline, and a Background in my Feature and nothing > > > else, > > > > The Background got executed 1 more time than expected. > > > > Details are the Scenario Outline had 4 entries in the table, so I > > > expected 4 scenarios to get executed, and the Background to get > > > executed before each Scenario. > > > > What happened was the Background got executed once initially, then > > > once for each entry on the outline table, the After scenario hook got > > > correctly executed after each of the 4 scenarios, but not after the > > > first Background (understandably as there was no scenario executed). > > > > Is this a bug or feature ;) > > > _______________________________________________ > > > rspec-users mailing list > > > rspec-us... at rubyforge.org > > >http://rubyforge.org/mailman/listinfo/rspec-users > > > _______________________________________________ > > rspec-users mailing list > > rspec-us... at rubyforge.orghttp://rubyforge.org/mailman/listinfo/rspec-users > > _______________________________________________ > rspec-users mailing list > rspec-us... at rubyforge.orghttp://rubyforge.org/mailman/listinfo/rspec-users