Class: Bucky::Core::TestCore::TestCaseLoader

Inherits:
Object
  • Object
show all
Extended by:
Utils::YamlLoad
Defined in:
lib/bucky/core/test_core/test_case_loader.rb

Class Method Summary collapse

Methods included from Utils::YamlLoad

file_sort_hierarchy, load_yaml

Class Method Details

.load_testcode(test_cond) ⇒ Array

Load test code files and return test suite data.

Returns:

  • (Array)

    test suite



31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/bucky/core/test_core/test_case_loader.rb', line 31

def load_testcode(test_cond)
  return load_re_test_testcode(test_cond[:re_test_cond]) if test_cond.key? :re_test_cond

  testcodes = []
  service = (test_cond[:service] || ['*']).first
  device = (test_cond[:device] || ['*']).first

  Dir.glob("#{$bucky_home_dir}/services/#{service}/#{device}/scenarios/#{test_cond[:test_category]}/*.yml").each do |testcode_file|
    testcodes << load_testcode_in_file(testcode_file, test_cond)
  end
  # Delete nil element
  testcodes.compact
end