-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtestcases.rb
46 lines (39 loc) · 985 Bytes
/
testcases.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
require 'yaml'
require_relative 'testcase'
class Testcases
def initialize(filename, verbose)
@verbose = verbose
@filename = filename
@testcase_list = Array.new
first = true
File.open(filename) do |yf|
YAML.each_document( yf ) do |ydoc|
if first
@globalparamhash = ydoc
first = false
else
@testcase_list << Testcase.new(ydoc, verbose)
end
end
end
end
def runtests
# validate that a host has been specified
raise ArgumentError.new("Unable to continue tests due to missing host") unless @globalparamhash['host']
testnum = 1
@testcase_list.each do |tc|
begin
puts "Test case: " + testnum.to_s
if tc.runtest(@globalparamhash['host'])
puts "Test passed"
else
puts "Test failed"
end
testnum = testnum+1
puts "----------"
rescue Exception => e
puts e.message
end
end
end
end