class QuokkADB

Attributes

ADBRunner[RW]
parser[RW]

Public Class Methods

new(runner:, package:, annotation: nil, shards: nil, index: nil, serial: nil, background_black: false, debug_mode: false) click to toggle source
# File lib/quokkadb.rb, line 12
def initialize(runner:, package:, annotation: nil, shards: nil, index: nil, serial: nil, background_black: false, debug_mode: false)
  @runner = runner
  @package = package
  @annotation = annotation
  @shards = shards
  @index = index
  @serial = serial
  @background_black = background_black
  @debug_mode = debug_mode

  @ADBRunner = ADBRunner.new()
  @parser = ADBTestParser.new()
end

Public Instance Methods

parse_results(full_log) click to toggle source
# File lib/quokkadb.rb, line 44
def parse_results(full_log)
  full_log.each_line do |log|
    if @debug_mode
      puts(log)
    end

    if (log.include?("FAILURES!!!") or log.include?("Process crashed while executing") or log.include?('Process crashed.') or log.include?("INSTRUMENTATION_FAILED"))
      puts("Log has failures")
      raise 'Log has failures'
    end
  end

  @parser.test_results.each do |result|
    if @debug_mode
      puts result
    end

    if (!result.passed)
      puts("Failed test")
      raise 'Test did not pass'
    end
  end
  puts("All tests successful")
end
run() click to toggle source
# File lib/quokkadb.rb, line 26
def run()
  full_log = ""
  @ADBRunner.callback = lambda { |line|
    full_log += line
    @parser.parse_line(line: line, background_black: @background_black)
  }
  @ADBRunner.run_tests(
    runner: @runner,
    package: @package,
    annotation: @annotation,
    shards: @shards,
    index: @index,
    serial: @serial
  )

  parse_results(full_log)
end