varun
varun

Reputation: 231

How to execute .feature file in cucumber

I am a beginner to Cucumber. I have installed cucumber by the help of internet. I have written a .feature file. But I don`t know where to place this file and how to execute it.

Upvotes: 1

Views: 4562

Answers (1)

orde
orde

Reputation: 5273

Because it wants you to succeed in BDD, cucumber will guide you through the process. From the project directory, type cucumber in the cmd prompt or terminal, which returns:

You don't have a 'features' directory.  Please create one to get started.

Create a features directory, and put your .feature file in it. Again, run cucumber, which returns pending step definitions that map to your feature file. As an example:

You can implement step definitions for undefined steps with these snippets:

Given /^I want to use cucumber$/ do
  pending # express the regexp above with the code you wish you had
end

Now--as @siekfried indicates--create a directory called features/step_definitions for your step definition files, which should end with _steps (e.g. example_steps.rb). Then, edit your step definition file with the appropriate code to execute the step.

Upvotes: 1

Related Questions