Cucumber: automatically create a file of steps?

When I start the cucumber, it displays the possible steps that I should determine, an example from the RSpec book:

1 scenario (1 undefined) 4 steps (4 undefined) 0m0.001s You can implement step definitions for undefined steps with these snippets: Given /^I am not yet playing$/ do pending end When /^I start a new game$/ do pending end Then /^the game should say "Welcome to CodeBreaker"$/ do pending end Then /^the game should say "Enter guess:"$/ do pending end 

Is there a way for it to automatically create a step description file, so I don’t need to rewrite or copy the paste manually, but can I just set them more general?

+4
source share
6 answers

Cucumber does not offer this feature. Probably because you will need to tell where to put the file of step descriptions and what to call it.

+3
source

As Kevin said, Cucumber will need to know the file name in order to insert it, and there are no good defaults, except for using the same file name as the properties file. And this is what I consider antipater: http://wiki.github.com/aslakhellesoy/cucumber/feature-coupled-steps-antipattern

+3
source

Intellij Idea or RubyIDE does exactly what you ask for:

  • Detecting missing step definitions
  • Creates missing step definitions in a new file (you select a file name) or in one of the existing step definition files
  • Key parameters of the agreed step

see http://i48.tinypic.com/10r63o4.gif for a step-by-step image

Enjoy

+2
source

There is such an opportunity that might be useful, but, as Kevin says, it does not currently exist. But it can also get pretty dirty, pretty fast.

You may have already done this, but there is nothing stopping you from cutting and pasting the result directly into the text editor, or even hiding the output directly into the text editor, if you are so inclined. Then at least you get most of the path by creating a file and naming convention.

+1
source

try https://github.com/unxusr/kiwi so that it automatically generates your properties file and makes a step definition file for you, and you just fill the steps with code. In a later version, the step code will be written and all tests will run automatically

0
source

You can use the way to create a file of steps; all you need to do is run Cucumber on a function, have no specific steps, identifying a specific function as the following command:

1) using the path

 bundle exec cucumber {PATH} note path would start with features/.... for example features/users/login.feature 

1) using tags

 bundle exec cucumber --tags=@ {TAG} note tag should be above your scenario in the steps file for example @TAG Scenario: 

And you will have suggested steps in the console with pending status

0
source

All Articles