forked from bladerunnerlabs/blade-test
-
Notifications
You must be signed in to change notification settings - Fork 0
/
btestlist.rb
executable file
·57 lines (47 loc) · 1.11 KB
/
btestlist.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/usr/bin/ruby
# frozen_string_literal: true
require 'yaml'
require 'colorize'
require_relative 'config.rb'
# BladeTestList - run list of tests with btest framework
class BladeTestList
BTESTLIST_CONFIG_FILE_MSG = %(
Configuration file not found.
Please provide configuration file as a parameter to btestlist.
)
def initialize(config_file)
@config_file = config_file
@config = YAML.load_file(@config_file)
end
def run
print_description
run_list
true
end
private
def run_list
tests = @config['Tests']
puts tests
tests.each do |test|
command = './btest.rb ' + test
puts "Executing: #{command.yellow}"
system(command)
end
end
def print_description
test_name = @config['Name']
test_description = @config['Description']
puts 'Running test list ' + test_name.yellow
puts 'The tests will ' + test_description
puts
end
end
begin
test_list = BladeTestList.new(
BTestConfig.config_file(BladeTestList::BTESTLIST_CONFIG_FILE_MSG)
)
exit(test_list.run)
rescue ConfigFileException => e
puts e.to_s.red
exit(false)
end