Has anyone figured out a way to run the same cucumber scenario on multiple browsers/web drivers?

后端 未结 4 1040
死守一世寂寞
死守一世寂寞 2021-02-04 13:01

I\'m using cucumber + capybara for some web automation testing. I\'d love to be able to wire up my own tag (something like @all_browsers before the scenario) and have it run aga

4条回答
  •  北恋
    北恋 (楼主)
    2021-02-04 13:06

    I do it the way that 'watir' project recommends. I use require parallel_cucumber in my Rakefile and then each Cucumber scenario gets its own parallel thread (up to 20 in this case):

    task :run_cucumber do
      FileUtils.mkpath(ENV['OUT_DIR'])
      begin
        # cannot format report as HTML because of parallel forking
        threads = 20
        @result = system "parallel_cucumber features -o \"--format junit --out #{ENV['OUT_DIR']} --format pretty --tag @sauce\" -n #{threads}"
      ensure
        @success &= @result
      end
    end
    

    Then, the remaining part of your Cucumber project can be written as usual!! So simple! My full example here: https://github.com/djangofan/cuke-parallel-starter

提交回复
热议问题