Class: Testrun

Inherits:
Object
  • Object
show all
Defined in:
lib/testrun.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(testrun = nil) ⇒ Testrun

Returns a new instance of Testrun.



110
111
112
113
# File 'lib/testrun.rb', line 110

def initialize(testrun=nil)
  @testrun = testrun
  @check = true
end

Instance Attribute Details

#checkObject

Returns the value of attribute check.



115
116
117
# File 'lib/testrun.rb', line 115

def check
  @check
end

#testrunObject

Returns the value of attribute testrun.



115
116
117
# File 'lib/testrun.rb', line 115

def testrun
  @testrun
end

Instance Method Details

#add(case_ids) ⇒ Object



179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
# File 'lib/testrun.rb', line 179

def add(case_ids)
  @case_ids = case_ids

  if @testrun["run_id"].nil
    puts "No test run_id set"
    return false
  else
    @result = $server.call("TestRun.add_cases", @case_ids, @testrun["run_id"])
    if @result.empty?
	return true
    else
	return false
    end
  end

end

#exists?Boolean

Returns:

  • (Boolean)


169
170
171
172
173
174
175
176
# File 'lib/testrun.rb', line 169

def exists?
  @result =  self.find
  if @result.empty?
    return false
  else
    return true
  end
end

#findObject



162
163
164
165
166
# File 'lib/testrun.rb', line 162

def find
  puts @testcase.inspect
  @result = $server.call("TestRun.list", @testrun)
  return @result
end


157
158
159
# File 'lib/testrun.rb', line 157

def print
  puts @tr
end

#read(id) ⇒ Object



151
152
153
154
# File 'lib/testrun.rb', line 151

def read(id)
  @testrun = $server.call("TestRun.get", id)
  return @testrun
end

#writeObject



118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
# File 'lib/testrun.rb', line 118

def write
  if @testrun["plan_id"].nil?
    puts "Testrun plan_id not set"
    return false
  elsif @testrun["environment"].nil?
    puts "Testrun environment not set"
    return false
  elsif @testrun["build"].nil?
    puts "Testrun build not set"
    return false
  elsif @testrun["summary"].nil?
    puts "Testrun summary not set"
    return false
  end
  if @testrun["manager"].nil?
    puts "Testrun manager not set. Using ",$tt_account," as manager"
    @testrun["manager"] = $tt_account
  end

  if @check
    if self.exists?
      puts "Testrun already existing - aborting"
      return false
    else
      @testrun = $server.call("TestRun.create", @testrun)
      return @testrun
    end  
  end
  @testrun = $server.call("TestRun.create", @testrun)
  return @testrun
end