netzpirat / guard-cucumber

Guard::Cucumber automatically runs your features (much like autotest)

Home Page:https://rubygems.org/gems/guard-cucumber

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

stop running feature

zoras opened this issue · comments

When I press Ctrl-C then guard-cucumber is turned off as specified in https://github.com/guard/guard#readme

Is there any way to stop running feature(s) in guard-cucumber ?

The problem is that guard-cucumber autofires cucumber tests with autosave, but I don't want it in cukes having 10's of feautes.

Another solution might be to make guard-cucumber run only the specific feature which has been modified and not the whole cuke.

There is no such feature to stop running cucumber scenario(s) and I guess it'll never be, because it's against the continuous testing philosophy: Whenever a file change is detected, the test suite is running against the changes to ensure its behavior. This is exactly what we want.

If you want to have autosave enabled and don't want the features running every time the file is changed, then Guard is not for you. Instead start the tests every time you feel you want to test your changes.

But as you suggest, the Guardfile can be configured to just run the modified feature. When you look at the latest template from guard-cucumber, it's the default behavior:

guard 'cucumber' do
  watch(%r{features/.+\.feature})
  watch(%r{features/support/.+})          { 'features' }
  watch(%r{features/step_definitions/(.+)_steps\.rb}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'features' }
end

When a file within the features directory that ends in feature is modified modified, just run that single feature.

When any file within features/support directory is modified, run all features.

When a file within the features/step_definitions directory that ends in _steps.rb is modified modified, run the first feature that matches the name (_steps.rb replaced by .feature) and when no feature is found, then run all features.

I suggest to update your Guardfile according to the latest template and modify it to match your project structure.

If you think there is a bug in guard-cucumber, so that always all features are run instead of just a single, please feel free to open a new issue with more details about your environment and your Guardfile.

I implemented the updated Guardfile which seems to do the trick.
I overlooked the whole continuous testing part, sry for that.
Keep up the good work!! :)

You're always welcome. Glad I could help.