Discussion:
[Cucumber] Need help to write pending scenarios in rerun file
(too old to reply)
Shyam Jakkampudi
2017-09-12 16:00:03 UTC
Permalink
Raw Message
Hi,
The earlier versions of cucumber used to write both failure and pending
scenarios in to rerun file but not anymore. Our tests mostly rely on the
test data (program information) that changes every 30 mins and we have a
shell script in place to rerun both failure and pending scenarios twice,
which would eventually pass in the second or third attempt. Since, the
rerun file is not writing any pending scenarios anymore, we have to
manually identify those pending scenarios from 300-400 feature files and
run them again, which is time consuming.

Can you please help me out with the changes that I need to make in the
following file to make it work as per our project needs. Thanks much for
your help in advance!

https://github.com/cucumber/cucumber-ruby/blob/master/lib/cucumber/formatter/rerun.rb

frozen_string_literal: true

require 'cucumber/formatter/io'

module Cucumber
module Formatter
class Rerun
include Formatter::Io

def initialize(config)
@io = ensure_io(config.out_stream)
@config = config
@failures = {}
config.on_event :test_case_finished do |event|
puts event
test_case, result = *event.attributes
puts result
next if result.ok?(@config.strict?)
@failures[test_case.location.file] ||= []
@failures[test_case.location.file] << test_case.location.line
end
config.on_event :test_run_finished do
next if @failures.empty?
@io.print file_failures.join(' ')
end
end

private

def file_failures
@failures.map { |file, lines| [file, lines].join(':') }
end
end
end
end
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Björn Rasmusson
2017-09-13 09:28:48 UTC
Permalink
Raw Message
Post by Shyam Jakkampudi
Hi,
The earlier versions of cucumber used to write both failure and pending
scenarios in to rerun file but not anymore.
The scenarios written to the rerun file are the scenarios that each would
make the exit code non-zero. Failed scenarios are alway changing the exit
code to non-zero, that they are therefore always entered in the rerun file.
Pending, Undefined, and Flaky scenarios are changing the exit code to
non-zero depending on the --strict setting, which means that the --strict
setting also controls whether these scenarios are written into the rerun
file.


If you run Cucumber with the --strict option, then Pending, Undefined, and
Flaky scenarios will be entered into the rerun file

/Björn
Post by Shyam Jakkampudi
Our tests mostly rely on the test data (program information) that changes
every 30 mins and we have a shell script in place to rerun both failure and
pending scenarios twice, which would eventually pass in the second or third
attempt. Since, the rerun file is not writing any pending scenarios
anymore, we have to manually identify those pending scenarios from 300-400
feature files and run them again, which is time consuming.
Can you please help me out with the changes that I need to make in the
following file to make it work as per our project needs. Thanks much for
your help in advance!
https://github.com/cucumber/cucumber-ruby/blob/master/lib/cucumber/formatter/rerun.rb
frozen_string_literal: true
require 'cucumber/formatter/io'
module Cucumber
module Formatter
class Rerun
include Formatter::Io
def initialize(config)
@io = ensure_io(config.out_stream)
@config = config
@failures = {}
config.on_event :test_case_finished do |event|
puts event
test_case, result = *event.attributes
puts result
@failures[test_case.location.file] ||= []
@failures[test_case.location.file] << test_case.location.line
end
config.on_event :test_run_finished do
@io.print file_failures.join(' ')
end
end
private
def file_failures
@failures.map { |file, lines| [file, lines].join(':') }
end
end
end
end
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...