Ruby on Rails: Cucumber: how do I Rake a single feature?
The correct way is to run it using the cucumber
executable if you're using Rails 2, or bundle exec cucumber
if you're using Rails 3 (and thus Bundler).
To run a specific feature:
[command] features/signing_in.feature
To run a specific scenario from that feature:
[command] features/signing_in.feature:6
The line number can be any line inside that feature, but is usually the first line.
If you run rake cucumber:ok
and some scenarios fail, at the bottom of the output you will see something like this:
cucumber features/sigining_in.feature:6 # Signing in via form
You can triple-click this line and paste it into your terminal to just run that scenario.
To answer the Rake question directly, you can use:
rake FEATURE=features/adding_products.feature cucumber
but the Using Rake wiki page advises against using rake for anything but on a CI server because it's slower to start. Just use the cucumber command line instead, i.e.:
cucumber features/adding_products.feature
or, if you must:
bundle exec cucumber features/adding_products.feature
The rake did not worked for me.Just replaced the rake with bundle exec, and it worked.below is a sample.
bundle exec cucumber features/users/signup.feature --require features