Ruby on Rails: Cucumber: how do I Rake a single feature?

NullVoxPopuli picture NullVoxPopuli · Jun 23, 2010 · Viewed 37.1k times · Source

Reason why I want to run them individually, is because I need to have them individually set up in my Rake file, because, My Java Heap Space fills up when I run them all together

Answer

Ryan Bigg picture Ryan Bigg · Jun 23, 2010

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.