Sha256: a5a5a39bbbc3ca3843bb3f3657ae436e5bd9c03ff3f2ef228d1b391871a626c9

Contents?: true

Size: 1.59 KB

Versions: 14

Compression:

Stored size: 1.59 KB

Contents

# encoding: utf-8
# This file is distributed under New Relic's license terms.
# See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details.

module Performance
  class ConsoleReporter
    def initialize(results, elapsed, options={})
      @results = results
      @elapsed = elapsed
      @options = options
    end

    def report
      failures = @results.select { |result| result.failure? }
      successes = @results - failures
      puts "#{@results.size} tests, #{failures.size} failures, #{@elapsed} s total"
      report_successful_results(successes) if successes.any?
      report_failed_results(failures) if failures.any?
    end

    def report_successful_results(results)
      puts ''
      results.each do |result|
        puts "#{result.identifier}: #{result.elapsed} s"
        unless @options[:brief]
          result.measurements.each do |key, value|
            puts "  %s: %g" % [key, value]
          end
        end
        unless result.artifacts.empty?
          puts "  artifacts:"
          result.artifacts.each do |artifact|
            puts "    #{artifact}"
          end
        end
        puts '' if !@options[:brief] || !result.artifacts.empty?
      end
    end

    def report_failed_results(results)
      puts ''
      results.each do |failure|
        puts "FAILED: #{failure.identifier}"
        e = failure.exception
        if e
          puts "#{e['class']}: #{e['message']}"
          puts failure.exception['backtrace'].map { |l| "    #{l}" }.join("\n")
        else
          puts "<No exception recorded>"
        end
      end
      puts ''
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
newrelic_rpm-3.9.3.241 test/performance/lib/performance/console_reporter.rb
newrelic_rpm-3.9.2.239 test/performance/lib/performance/console_reporter.rb
newrelic_rpm-3.9.1.236 test/performance/lib/performance/console_reporter.rb
newrelic_rpm-3.9.0.229 test/performance/lib/performance/console_reporter.rb
newrelic_rpm-3.8.1.221 test/performance/lib/performance/console_reporter.rb
newrelic_rpm-3.8.0.218 test/performance/lib/performance/console_reporter.rb
newrelic_rpm-3.7.3.204 test/performance/lib/performance/console_reporter.rb
newrelic_rpm-3.7.3.199 test/performance/lib/performance/console_reporter.rb
newrelic_rpm-3.7.2.195 test/performance/lib/performance/console_reporter.rb
newrelic_rpm-3.7.2.192 test/performance/lib/performance/console_reporter.rb
newrelic_rpm-3.7.2.190.beta test/performance/lib/performance/console_reporter.rb
newrelic_rpm-3.7.1.188 test/performance/lib/performance/console_reporter.rb
newrelic_rpm-3.7.1.182 test/performance/lib/performance/console_reporter.rb
newrelic_rpm-3.7.1.180 test/performance/lib/performance/console_reporter.rb