0

I have a Rakefile (below) with a task which run some Cucumber scenarios.

task :feature, [:name, :times] do |task,args|
  puts "Executing feature: #{args[:name]} #{args[:times]} times"

  @errors = 0
  @processes = 0

  # cuke_task.cucumber_opts = "-p #{args[:name]}"

  args[:times].to_i.times do 
    begin
      @processes += 1
      puts "Running #{args[:name]} -- #{@processes}"

        # Rake::Task[:features].execute

      Cucumber::Rake::Task.new(:run) do |t|
        t.cucumber_opts = "--format pretty -p #{args[:name]}"
      end

      Rake::Task[:run].invoke

    rescue Exception => e
        @errors += 1
      puts "Task #{args[:name]} failed!"
      puts "#{e.class}: #{e.message}"
    end
  end

  puts "Errors: #{@errors}"
  puts "Processes: #{@processes}"
end

This another code is my cucumber.yml

demo_upload_manual_cip: --tags @demo_upload_manual_cip
demo_treat_complaint: --tags @demo_treat_complaint
demo_follow_complaint: --tags @demo_follow_complaint

demo_upload_manual_fa: --tags @demo_upload_manual_fa
demo_contact_consumer: --tags @demo_contact_consumer ##
demo_send_defense: --tags @demo_send_defense ##
demo_briefing: --tags @demo_briefing

demo_insert_ata: --tags @demo_insert_ata ##
demo_audience: --tags @demo_audience

demo_send_late_defense: --tags @demo_send_late_defense ##

For tags with ## the rake task is ignoring (not invoked). The other tasks are OK. This is how I call them: "rake feature['tag_name',3]".

Why Rake ignore some of these tags?? What is the problem?

Thanks!

  • Your task definition looks a bit off, in terms of the argument definition. It should be `task :feature, [:name, :times] do |task,args|` Take a look at this post http://stackoverflow.com/questions/825748/how-to-pass-command-line-arguments-to-a-rake-task for reference. – Máté Mar 20 '17 at 20:58
  • Thanks for the tip! – V. Pereira Mar 20 '17 at 21:03

0 Answers0