开发者

Cucumber Scenarios Failing Without Error Message

开发者 https://www.devze.com 2023-01-05 10:33 出处:网络
I\'m getting Rails and Cucumber going on my Mac OS X box. When I try to run the following scenario: Feature: ActorDetail

I'm getting Rails and Cucumber going on my Mac OS X box. When I try to run the following scenario:

Feature: ActorDetail
  In order to learn about an actor
  As a costumer 
  I want to see their details

Scenario: Actors page should exist
Given I am on actor page
Then I should see "Actors"

When I attempt to run the tests I get the following:

kevin:11:17 PM:~/Documents/Rails/testApp: cucumber
Using the default profile...
/usr/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/rails/gem_dependency.rb:119:Warning:     Gem::Dependency#version_requirements is deprecated and will be removed on or after August     2010.  Use #requirement
F--F

Failing Scenarios:
cucumber features/ActorDetail.feature:6 # Scenario: Actors page should exist

1 scenario (1 failed)
2 steps (2 skipped)
0m0.138s

Which is a failing test, but not the way I would like it to fail, if you know what I mean. I was expecting a m开发者_如何转开发essage telling me that there wasn't a path defined for "Actors"

Interestingly, if I change from double to single quotes around "Actors", this is what I get:

kevin:11:09 PM:~/Documents/Rails/testApp: cucumber
Using the default profile...
/usr/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/rails/gem_dependency.rb:119:Warning: Gem::Dependency#version_requirements is deprecated and will be removed on or after August 2010.  Use #requirement
F-UF

Failing Scenarios:
cucumber features/ActorDetail.feature:6 # Scenario: Actors page should exist

1 scenario (1 failed)
2 steps (1 skipped, 1 undefined)
0m0.144s

I apologize if I am providing insufficient information on what gems I have installed, config, etc. I've been developing in Rails for about three hours so far.

Many thanks,

KevDog

Update I did a gem update, and now things seem to have gotten worse. This is the current error:

kevin:12:29 AM:~/Documents/Rails/testApp: cucumber
Using the default profile...
/usr/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/rails/gem_dependency.rb:119:Warning: Gem::Dependency#version_requirements is deprecated and will be removed on or after August 2010.  Use #requirement
/Users/kevin/.gem/ruby/1.8/gems/nokogiri-1.4.2/lib/nokogiri/nokogiri.bundle: [BUG] Bus Error
ruby 1.8.7 (2008-05-31 patchlevel 0) [i686-darwin9.4.0]

Abort trap

That doesn't sound good at all.


use below command to run your cucumber features this will give verbose output.

cucumber --format pretty


For the Gem::Dependency#version_requirements is deprecated warning, it looks like you need to upgrade Rails (to at least 2.3.6). Both Rails 2.3.6 and 2.3.7 include a commit that fixes the warning you are seeing. I am not sure why your gem update would not have addressed this unless it is because it is only trying to update the gems in your home directory (I have not tried using a per-user GEM_HOME, so I am not sure how it would interact with needing to install newer versions of gems that are included in the system gem directory). Maybe you need to do sudo /usr/local/bin/gem update instead of whatever update you previously ran (be sure to move aside or delete the broken nokogiri installation in your home gems directory, too).

The difference in the results when using single and double quotes in your Then I should see step is probably due to the fact that there is no step definition that matches the single quoted version. Check your features/step_definitions/web_steps.rb file to verify this (my version from Cucumber 0.8.0 includes a a JSON variant, a double quote delimited variant (literal string), and a slash delimited variant (regexp match) but no single quoted variant).

Also, you may need to use the actor page instead of actor page, or define a path mapping for actor page in features/support/paths.rb.


Have you tried doing:

rake gems:install RAILS_ENV=test

This should install all the gems the test environment required. Also, depending on whether you have any models defined yet, you may also need to prepare the test database with

rake db:test:prepare


Check the whitespace. In your posted example it is not properly indented.

Feature: ActorDetail
 In order to learn about an actor
 As a costumer 
 I want to see their details

 Scenario: Actors page should exist
   Given I am on actor page
   Then I should see "Actors"
0

精彩评论

暂无评论...
验证码 换一张
取 消