Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 436
NullVoxPopuli Avatar asked Jun 22 '10 23:06

NullVoxPopuli


People also ask

How do I run a Rubymine feature file?

Press Ctrl+Shift+A and start typing edit configurations. Select Edit Configurations and press Enter . In the opened Run/Debug Configurations dialog, select the required configuration, and specify its settings. Choose whether to run all features in a directory or file.

How do you set up a cucumber in rails?

Let's create an empty directory cucumber-app for our application. cd cucumber-app In the directory we initiate bundler by calling bundle init . This will create a Gemfile for us. Let's add the Cucumber gem gem "cucumber" and install it by running bundle .


2 Answers

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.

like image 173
Ryan Bigg Avatar answered Oct 03 '22 07:10

Ryan Bigg


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 
like image 32
Bryan Ash Avatar answered Oct 03 '22 08:10

Bryan Ash