Sha256: 928f9a898ca38706eaac77a61443fd798983a0a3bcec71693f964e09031aa85a

Contents?: true

Size: 763 Bytes

Versions: 1

Compression:

Stored size: 763 Bytes

Contents

require_relative 'test_case'

module Korinthenkacker
  class TestReport
    attr_reader :jobname, :build

    def initialize(jobname, build, json)
      @jobname = jobname
      @build = build
      @json = json
    end

    def duration
      @json['duration']
    end

    def fail_count
      @json['failCount']
    end

    def pass_count
      @json['passCount']
    end

    def skip_count
      @json['skipCount']
    end

    def success?
      fail_count == 0 && skip_count == 0
    end

    def failed_cases
      all_cases.select { |test_case| !test_case.success? }
    end

    private

    def all_cases
      @json['suites']
        .map { |suite| suite['cases'] }
        .flatten
        .map { |my_case| TestCase.new(my_case) }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
korinthenkacker-0.0.1 lib/korinthenkacker/test_report.rb