Sha256: 55a576913cdaffce6bf0614577f6ea1fde378fd7ec5eb0af445cb3fa9b522c21
Contents?: true
Size: 1.23 KB
Versions: 2
Compression:
Stored size: 1.23 KB
Contents
module RspecLogFormatter module Analysis class Analyzer def initialize(history_provider, options={}) @builds_to_analyze = options[:builds_to_analyze] @max_reruns = options[:max_reruns] @limit_history = options[:limit_history] @history_provider = history_provider end def analyze build_numbers = @history_provider.builds results = @history_provider.results.reject do |res| @builds_to_analyze && !build_numbers.last(@builds_to_analyze).include?(res.build_number.to_i) end scores = [] results.group_by(&:description).each do |description, results| score = Score.new(description, max_reruns: @max_reruns) results.group_by(&:build_number).each do |build_number, results| next if results.all?(&:failure?) #not flaky results.each{|r| score.absorb(r) } score.runs += results.count score.failures += results.count(&:failure?) score.failure_messages += results.select(&:failure?).map { |r| "#{r.klass}\n #{r.message}" } end scores << score if score.runs > 0 end scores.select(&:flaky?).sort.map(&:as_hash) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rspec_log_formatter-0.2.1 | lib/rspec_log_formatter/analysis/analyzer.rb |
rspec_log_formatter-0.2.0 | lib/rspec_log_formatter/analysis/analyzer.rb |