Sha256: 5b452afde2a991024163ed31e05d7e1f7b5c7dace4a8df6367b88d965d7017ad

Contents?: true

Size: 708 Bytes

Versions: 2

Compression:

Stored size: 708 Bytes

Contents

require_relative 'test_case'

module Korinthenkacker
  class TestReport
    attr_reader :jobname, :build, :json

    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 failure?
      !success?
    end

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
korinthenkacker-0.0.3 lib/korinthenkacker/test_report.rb
korinthenkacker-0.0.2 lib/korinthenkacker/test_report.rb