An important concept to understand is there is a difference between tags and profiles. I am also using Guard with Cucumber and was frustrated that the default profile continued to be used and none of my @wip (Work In Progress) tags were being picked up. It's obvious now why that was the case. As stated by some in other forums, my default profile filters out @wip.
<config/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 would include scenarios or features marked by '@wip'!
wip: --drb <%= wip_opts %> --tags @wip:3 --wip features" <= the number represents the max number of scenarios to run; '--wip' indicates that Cuc expects the test will fail (because we're working on it)
So the tags are already configured and I've included '@wip' in my *.feature file. What about the profiles? When using Guard (Spork), in order for the 'wip' profile to be used, it needs to be configured. It makes sense; the computer can't read my mind! Update the Guardfile 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 specify desired profile
And now my scenarios are successfully being filtered by 'wip'.