An important concept to understand is the difference between tags and profiles . I also use Guard with Cucumber and was disappointed that the default profile continued to be used and none of my @Wip (Work In Progress) tags were selected. Now itβs obvious why this was so. As pointed out by some other forums, my profile filters @wip by default.
<configurations /cucumber.yml>
<% rerun = File.file?('rerun.txt') ? IO.read('rerun.txt') : "" rerun_opts = rerun.to_s.strip.empty? ? "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} features" : "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} #{rerun}" base_opts = "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'}" std_opts = "#{base_opts} --strict --tags ~@wip " wip_opts = base_opts %> default: --drb <%= std_opts %> features wip: --drb <%= wip_opts %> --tags @wip:3 --wip features rerun: --drb <%= rerun_opts %> --format rerun --out rerun.txt --strict --tags ~@wip
"std_opts =" # {base_opts} --strict - tags ~ @wip "<= wip is filtered out here in std_opts
I want to use the "wip" profile, which will include scripts or features marked with "@wip"!
wip: --drb <% = wip_opts%> - tags @wip: 3 --wip features "<= the number represents the maximum number of scripts to run; '--wip' indicates that Cuc expects the test to fail (because we are working on it)
So the tags are already set up, and I included "@wip" in my * .feature file. What about profiles? When using Guard (Spork), for the wip profile to be used, it must be configured. It makes sense; the computer cannot read my mind! Update the Guard file to use the wip profile.
<Guardfile>
guard 'cucumber', :cli => "--drb -p wip", :all_on_start => false, :all_after_pass => false 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
guard 'cucumber' ,: cli => "--drb -p wip " <= '- p' to indicate the desired profile
And now my scripts are successfully filtered using "wip".
source share