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
|
# File 'lib/test_case/ci_test.rb', line 3
def run
ci_actions = Hash[test_data.fetch(:_ci_actions, {})].fetch(id, [])
ci_actions = [ci_actions] unless ci_actions.is_a?(Array)
logger.info("CI Actions: #{ci_actions.inspect}")
ci_actions.each do |ci_action|
do_actions = proc do
actions = ci_action.fetch(:actions, [])
actions = [actions] unless actions.is_a?(Array)
actions.each do |action|
obj = self
methods = action.fetch(:method, [])
methods = [methods] unless methods.is_a?(Array)
params = action.fetch(:params, [])
params = [params] unless params.is_a?(Array)
logger.info("#{methods.join('.')}(#{params.map {|p| p.inspect}.join(', ')})", tag: 'ACTION')
methods.each_with_index do |sym, i|
if params.empty? || i < (methods.count - 1)
obj = obj.send(sym.to_sym)
else
obj = obj.send(sym.to_sym, *params)
end
end
end
end
if ci_action[:step].nil?
do_actions.call
else
test_step(ci_action[:step], name: 'Verify something', &do_actions)
end
end
end
|