class Crucible::Tests::Executor

Public Class Methods

list_all(multiserver=false, metadata=false) click to toggle source
# File lib/executor.rb, line 26
def self.list_all(multiserver=false, metadata=false)
  list = SuiteEngine.list_all(metadata).merge TestScriptEngine.list_all(metadata)
  list.select {|key,value| value['multiserver'] == multiserver}
end
new(client, client2=nil) click to toggle source
# File lib/executor.rb, line 5
def initialize(client, client2=nil)
  @client = client
  @client2 = client2
  @suite_engine = SuiteEngine.new(@client, @client2)
  @testscript_engine = TestScriptEngine.new(@client, @client2)
end

Public Instance Methods

execute(test) click to toggle source
# File lib/executor.rb, line 12
def execute(test)
  test.execute
end
execute_all() click to toggle source
# File lib/executor.rb, line 16
def execute_all
  results = {}
  self.tests.each do |test|
    # TODO: Do we want to separate out multiserver tests?
    next if test.multiserver
    results.merge! execute(test)
  end
  results
end
extract_metadata_from_test(key) click to toggle source

finds a test from the given key and extracts only metadata into a hash

# File lib/executor.rb, line 42
def extract_metadata_from_test(key)
  test = find_test(key)
  test_metadata = test.collect_metadata(true)
  extracted_metadata = {}
  BaseTest::METADATA_FIELDS.each do |field|
    field_hash = {}
    test_metadata.each { |tm| field_hash[tm[:test_method]] = tm[field] }
    extracted_metadata[field] = field_hash
  end
  extracted_metadata
end
find_test(key) click to toggle source

finds a test by class name for suites, and by filename for testscript

# File lib/executor.rb, line 37
def find_test(key)
  @suite_engine.find_test(key) || @testscript_engine.find_test(key)
end
tests() click to toggle source
# File lib/executor.rb, line 31
def tests
  tests = @suite_engine.tests.concat @testscript_engine.tests
  tests.sort{|t1,t2| t1.id <=> t2.id }
end