Skip to content

Instantly share code, notes, and snippets.

@ColinDKelley
Last active December 15, 2015 17:49
Show Gist options
  • Save ColinDKelley/5298850 to your computer and use it in GitHub Desktop.
Save ColinDKelley/5298850 to your computer and use it in GitHub Desktop.
Script to compare failing Rails 3 tests cases across builds
build_numbers = [4036, 4037, 4041, 4044, 4045, 4048]
build_stats = build_numbers.map { |i| YAML.load_file("../shared/builds/#{i}/test_stats.yml") }
failing = build_stats.map do |run|
run.reduce([]) do |a, t|
t.last.each { |test_case, attrs| a << [t.first, test_case] if attrs.is_a?(Hash) && attrs['last_result'] != 'success' }
a
end
end
all_failing = failing.inject(&:|).sort
sometimes_failing = all_failing - failing.inject(&:&)
puts sometimes_failing.map do |test_pair|
(test_pair + failing.map { |build| build.include?(test_pair) ? 'F' : '' }).to_csv
end.join
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment