Hi all.... I have just gotten started with Cucumber and excited about it. But am hitting a problem where I have scenarios failing but the output seems almost useless - all it does is tell me which scenarios failed but not where in the scenario it failed. How does one go about figuring out where things are going wrong? Is there a verbose option? For example on this failing (and very simple) scenario (which I can not remove enough steps to get it to pass): Feature: Login logout of system Scenario: Login When I am on the login page Then I should see "Lender Login" When I ''rake cucumber'' it fails, I have no idea if the problem is syntax, routes, something with capybara, data (well not in this case), or just that my app does not work. I know I can go to a browser and get this page to load so I know it is not the latter. I am not concerned with this specific example per se but to any hints as to a working strategy to troubleshoot scenarios under Cucumber and be able to move past failures. Thanks, David -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
David Kahn wrote:> Hi all.... I have just gotten started with Cucumber and excited about > it. > But am hitting a problem where I have scenarios failing but the output > seems > almost useless - all it does is tell me which scenarios failed but not > where > in the scenario it failed. How does one go about figuring out where > things > are going wrong? Is there a verbose option?You know, if you''re going to complain about the output, the least you could do is show us the output you''re getting... :)> > For example on this failing (and very simple) scenario (which I can not > remove enough steps to get it to pass):That suggests a Cucumber setup issue.> > Feature: Login logout of system > > Scenario: Login > When I am on the login page > Then I should see "Lender Login" > > When I ''rake cucumber'' it fails,Fails how? What do you see? Best, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org Sent from my iPhone -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
> You know, if you''re going to complain about the output, the least you > could do is show us the output you''re getting... :)Here goes: /Users/DK/.rvm/rubies/ruby-1.8.7-p174/bin/ruby -I "/Users/DK/.rvm/gems/ruby-1.8.7-p174/gems/cucumber-0.8.5/lib:lib" "/Users/DK/.rvm/gems/ruby-1.8.7-p174/gems/cucumber-0.8.5/bin/cucumber" --profile default Using the default profile... F-----F-- Failing Scenarios: cucumber features/create_comparison.feature:6 # Scenario: Comparisons List cucumber features/login_logout.feature:3 # Scenario: Login 2 scenarios (2 failed) 7 steps (7 skipped) 0m0.042s rake aborted! Command failed with status (1): [/Users/DK/.rvm/rubies/ruby-1.8.7-p174/bin/...] (See full trace by running task with --trace) DKMac:creditcompare DK$ On Wed, Sep 15, 2010 at 5:06 PM, Marnen Laibow-Koser <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org>wrote:> David Kahn wrote: > > Hi all.... I have just gotten started with Cucumber and excited about > > it. > > But am hitting a problem where I have scenarios failing but the output > > seems > > almost useless - all it does is tell me which scenarios failed but not > > where > > in the scenario it failed. How does one go about figuring out where > > things > > are going wrong? Is there a verbose option? > > You know, if you''re going to complain about the output, the least you > could do is show us the output you''re getting... :) > > > > > For example on this failing (and very simple) scenario (which I can not > > remove enough steps to get it to pass): > > That suggests a Cucumber setup issue. > > > > > Feature: Login logout of system > > > > Scenario: Login > > When I am on the login page > > Then I should see "Lender Login" > > > > When I ''rake cucumber'' it fails, > > Fails how? What do you see? > > Best, > -- > Marnen Laibow-Koser > http://www.marnen.org > marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org > > Sent from my iPhone > -- > Posted via http://www.ruby-forum.com/. > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Marnen Laibow-Koser
2010-Sep-16 00:11 UTC
Re: Re: Getting specific error info from Cucumber?
David Kahn wrote:>> You know, if you''re going to complain about the output, the least you >> could do is show us the output you''re getting... :) > > Here goes: > > /Users/DK/.rvm/rubies/ruby-1.8.7-p174/bin/ruby -I > "/Users/DK/.rvm/gems/ruby-1.8.7-p174/gems/cucumber-0.8.5/lib:lib" > "/Users/DK/.rvm/gems/ruby-1.8.7-p174/gems/cucumber-0.8.5/bin/cucumber" > --profile default > Using the default profile... > F-----F-- > > Failing Scenarios: > cucumber features/create_comparison.feature:6 # Scenario: Comparisons > List > cucumber features/login_logout.feature:3 # Scenario: Login > > 2 scenarios (2 failed) > 7 steps (7 skipped) > 0m0.042s > rake aborted! > Command failed with status (1): > [/Users/DK/.rvm/rubies/ruby-1.8.7-p174/bin/...]That does look rather terse -- but notice that all your steps are showing up as skipped. I''d say you''ve got a configuration issue. Check your cucumber setup.> > (See full trace by running task with --trace) > DKMac:creditcompare DK$ > > > On Wed, Sep 15, 2010 at 5:06 PM, Marnen Laibow-KoserBest, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org Sent from my iPhone -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
> That does look rather terse -- but notice that all your steps are > showing up as skipped. I''d say you''ve got a configuration issue. Check > your cucumber setup.So it was a configuration error, having to do with my discovery that the config/environment/cucumber.rb environment which was missing some app specific constants, which in turn was causing my loading of fixtures to fail (albeit unreported). Now another issue: I have my test::unit fixtures loading and confirmed (this is a legacy app). However they can not seem to be accessed from the code. This is what is in env.rb to load them: Before do Fixtures.reset_cache fixtures_folder = File.join(RAILS_ROOT, ''test'', ''fixtures'') fixtures = Dir[File.join(fixtures_folder, ''*.yml'')].map {|f| File.basename(f, ''.yml'') } Fixtures.create_fixtures(fixtures_folder, fixtures) end Then for example, in the cucumber step below, when I set the debugger, I can find, the specific users fixture through Fixtures.all_loaded_fixtures["users"]["sysadmin_user_one"] But I can not get at its data (maybe you can tell me how to get at a class attribute inside a fixture object): (rdb:1) Fixtures.all_loaded_fixtures["users"]["sysadmin_user_one"] #<Fixture:0x47776a4 @model_class=User(id: integer, login: string, first_name: string, last_name: string, email: string, role_id: integer, hashed_password: string, salt: string, created_at: datetime, updated_at: datetime, enabled: boolean, account_id: integer, email_upon_upload: boolean), *@fixture={"salt"=>987654, "created_at"=>"2010-09-16 18:13:09", "updated_at"=>"2010-09-16 18:13:09", "role_id"=>1033329129, "hashed_password"=>"501d40d3a18d954855335c06bd56d47f8f5d4adc", "id"=>1067249891, "enabled"=>true, "last_name"=>"One", "login"=>"sysadminone", "email"=>"sysadminone-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org", "first_name"=>"Sysadmin"},* And using "users(:user_name)" as I would in Test::Unit does not work - this is where the step is failing. I hope this is not as disgusting as I am making it... am I fighting the universe (or in this case Cucumber::Rails::World) on this? Given /^I am logged in as a sysadmin user$/ do user = users(:sysadmin_user_one) visit(''/login'') fill_in(''login'', user.login) fill_in(''password'', ''password1'') click_button(''Log in'') I should see ''Welcome Sysadmin One'' end Thanks, David On Wed, Sep 15, 2010 at 7:11 PM, Marnen Laibow-Koser <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org>wrote:> David Kahn wrote: > >> You know, if you''re going to complain about the output, the least you > >> could do is show us the output you''re getting... :) > > > > Here goes: > > > > /Users/DK/.rvm/rubies/ruby-1.8.7-p174/bin/ruby -I > > "/Users/DK/.rvm/gems/ruby-1.8.7-p174/gems/cucumber-0.8.5/lib:lib" > > "/Users/DK/.rvm/gems/ruby-1.8.7-p174/gems/cucumber-0.8.5/bin/cucumber" > > --profile default > > Using the default profile... > > F-----F-- > > > > Failing Scenarios: > > cucumber features/create_comparison.feature:6 # Scenario: Comparisons > > List > > cucumber features/login_logout.feature:3 # Scenario: Login > > > > 2 scenarios (2 failed) > > 7 steps (7 skipped) > > 0m0.042s > > rake aborted! > > Command failed with status (1): > > [/Users/DK/.rvm/rubies/ruby-1.8.7-p174/bin/...] > > That does look rather terse -- but notice that all your steps are > showing up as skipped. I''d say you''ve got a configuration issue. Check > your cucumber setup. > > > > > (See full trace by running task with --trace) > > DKMac:creditcompare DK$ > > > > > > On Wed, Sep 15, 2010 at 5:06 PM, Marnen Laibow-Koser > > Best, > -- > Marnen Laibow-Koser > http://www.marnen.org > marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org > > Sent from my iPhone > -- > Posted via http://www.ruby-forum.com/. > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Marnen Laibow-Koser
2010-Sep-16 19:23 UTC
Re: Re: Re: Getting specific error info from Cucumber?
David Kahn wrote:>> That does look rather terse -- but notice that all your steps are >> showing up as skipped. I''d say you''ve got a configuration issue. Check >> your cucumber setup. > > So it was a configuration error, having to do with my discovery that the > config/environment/cucumber.rb environment which was missing some app > specific constants, which in turn was causing my loading of fixtures to > fail > (albeit unreported). > > Now another issue: I have my test::unit fixtures loading and confirmed > (this > is a legacy app). However they can not seem to be accessed from the > code.Good. You shouldn''t be using fixtures in Cucumber -- or indeed at all. The feature, as implemented in Rails, is broken and should be avoided at all costs. Use factories instead (either Machinist or Factory Girl will work). For integration of factories and Cucumber, Pickle works well. [...]> > I hope this is not as disgusting as I am making it... am I fighting the > universe (or in this case Cucumber::Rails::World) on this? > > Given /^I am logged in as a sysadmin user$/ do > user = users(:sysadmin_user_one) > visit(''/login'') > fill_in(''login'', user.login) > fill_in(''password'', ''password1'') > click_button(''Log in'') > I should see ''Welcome Sysadmin One'' > end >That step looks good, except for the use of fixtures.> > Thanks, > > DavidBest, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Greg Donald
2010-Sep-16 19:26 UTC
Re: Re: Re: Re: Getting specific error info from Cucumber?
On Thu, Sep 16, 2010 at 2:23 PM, Marnen Laibow-Koser <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Good. You shouldn''t be using fixtures in Cucumber -- or indeed at all. > The feature, as implemented in Rails, is broken and should be avoided at > all costs.Fixtures work great for me. But if the sky is falling for you.. -- Greg Donald destiney.com | gregdonald.com -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
David Kahn
2010-Sep-16 20:00 UTC
Re: Re: Re: Re: Getting specific error info from Cucumber?
> On Thu, Sep 16, 2010 at 2:26 PM, Greg Donald <gdonald-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > Fixtures work great for me.Greg, so you are able to load and use fixtures on cucumber on Rails3/1.9.2? Would you mind sharing how you load them in config and access them? David On Thu, Sep 16, 2010 at 2:26 PM, Greg Donald <gdonald-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Thu, Sep 16, 2010 at 2:23 PM, Marnen Laibow-Koser > <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: > > Good. You shouldn''t be using fixtures in Cucumber -- or indeed at all. > > The feature, as implemented in Rails, is broken and should be avoided at > > all costs. > > Fixtures work great for me. > > But if the sky is falling for you.. > > > -- > Greg Donald > destiney.com | gregdonald.com > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
David Kahn
2010-Sep-16 20:05 UTC
Re: Re: Re: Re: Getting specific error info from Cucumber?
Never mind. I just found this: http://wiki.github.com/aslakhellesoy/cucumber/fixtures Which states: ...you can access your fixture data from the database using *Model.find*. Example to find the first User model you’d use User.find(:first). So I was just trying to use the Test::Unit way -- users{:sysadminone), vs User.find_by_login(''sysadminone'') -- and that was the problem. Works right on. On Thu, Sep 16, 2010 at 3:00 PM, David Kahn <dk-rfEMNHKVqOwNic7Bib+Ti1W1rNmOCjRP@public.gmane.org>wrote:> > On Thu, Sep 16, 2010 at 2:26 PM, Greg Donald <gdonald-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > Fixtures work great for me. > > Greg, so you are able to load and use fixtures on cucumber on Rails3/1.9.2? > Would you mind sharing how you load them in config and access them? > > David > > > On Thu, Sep 16, 2010 at 2:26 PM, Greg Donald <gdonald-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > >> On Thu, Sep 16, 2010 at 2:23 PM, Marnen Laibow-Koser >> <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: >> > Good. You shouldn''t be using fixtures in Cucumber -- or indeed at all. >> > The feature, as implemented in Rails, is broken and should be avoided at >> > all costs. >> >> Fixtures work great for me. >> >> But if the sky is falling for you.. >> >> >> -- >> Greg Donald >> destiney.com | gregdonald.com >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Ruby on Rails: Talk" group. >> To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> To unsubscribe from this group, send email to >> rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> >> . >> For more options, visit this group at >> http://groups.google.com/group/rubyonrails-talk?hl=en. >> >> >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Marnen Laibow-Koser
2010-Sep-16 20:09 UTC
Re: Re: Re: Re: Getting specific error info from Cucumber?
Greg Donald wrote:> On Thu, Sep 16, 2010 at 2:23 PM, Marnen Laibow-Koser > <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: >> Good. �You shouldn''t be using fixtures in Cucumber -- or indeed at all. >> The feature, as implemented in Rails, is broken and should be avoided at >> all costs. > > Fixtures work great for me.Have you tried factories? They work even better.> > But if the sky is falling for you.. >I guess ignorance is bliss.> > -- > Greg Donald > destiney.com | gregdonald.comBest, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org Sent from my iPhone -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.