Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Specflow Add new step to existing feature file

Tags:

specflow

I am new to SpecFlow and I've hit a strange issue.

I have an existing SpecFlow feature and step file. I want to add a new step and when I do this it shows the new step as unbound (purple). Then within Visual Studio 2015 I chose the option 'Generate Step Definitions', it selected the existing step file but then overwrote the file and I lost all the existing steps but my new one was added, how do I just append this new step without losing the existing steps?

Thank you

like image 200
Buddy Love Avatar asked Oct 25 '25 14:10

Buddy Love


1 Answers

There are a couple of other alternatives to the one you outlined

One is to go to the 'Generate Step Definitions' dialogue on on there you can select the steps you want to generate the definitions for then click the 'Copy methods to clipboard' button rather than 'Generate', and then paste the methods into the existing step file. IMHO this should be the default option.

The other is to run the tests and check the output, where a the definition required will be part of the failing test output. This option is more viable if you are using a continuous test runner like NCrunch.

like image 99
Sam Holder Avatar answered Oct 28 '25 04:10

Sam Holder



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!