66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
|
# File 'lib/test_rail_integration/cli.rb', line 66
def shoot
if options[:test_run_id]
test_run_id = options[:test_run_id]
Connection.test_run_id = test_run_id
TestRailTools.write_test_run_id(test_run_id)
command = TestRail::Command.new(test_run_id)
if options[:auto]
parameters = TestRail::TestRun.get_by_id(test_run_id).name.downcase.match(/(#{TestRunParameters::VENTURE_REGEX}) (#{TestRunParameters::ENVIRONMENT_REGEX})*/)
if parameters.nil?
puts "Your test run name is not correct. It don't contain venture, env params. Please provide correct name for test run on test rail side."
return
end
if parameters[1].nil?
puts "Your test run name is not correct. It don't contain venture param. Please provide correct name for test run on test rail side."
return
end
if parameters[2].nil?
puts "Your test run name is not correct. It don't contain env param. Please provide correct name for test run on test rail side."
return
end
if parameters
if options[:venture]
command.venture = options[:venture]
else
command.venture = parameters[1]
end
command.env = parameters[2]
end
elsif options[:simple] && !options[:command]
puts "You should add command param to execute simple execution"
return
elsif !options[:simple] && !options[:command]
if options[:venture].nil? && options[:env].nil?
puts "You must set correct env, venture params through --env, --venture in order to execute command"
return
end
if options[:venture].nil?
puts "You must set correct venture param through --venture in order to execute command"
return
end
if options[:env].nil?
puts "You must set correct env param through --env in order to execute command"
return
end
command.venture = options[:venture]
command.env = options[:env]
end
if options[:env] == "showroom" && options[:showroom]
command.env = command.env + " SR='#{options[:showroom]}'"
end
if options[:command]
command.command = options[:command]
else
command.command = TestRunParameters::EXEC_COMMAND
end
if options[:type]
command.type = options[:type].to_i
end
command.generate
command.execute
else
puts "You must set correct test run id through --test_run_id"
end
end
|