Class: Testcase
- Inherits:
-
Object
- Object
- Testcase
- Defined in:
- lib/testcase.rb
Instance Attribute Summary collapse
-
#check ⇒ Object
Returns the value of attribute check.
-
#testcase ⇒ Object
Returns the value of attribute testcase.
Instance Method Summary collapse
- #exists? ⇒ Boolean
- #find ⇒ Object
- #get_plans(case_id) ⇒ Object
-
#initialize(testcase = nil) ⇒ Testcase
constructor
A new instance of Testcase.
- #print ⇒ Object
- #read(id) ⇒ Object
- #write ⇒ Object
Constructor Details
#initialize(testcase = nil) ⇒ Testcase
Returns a new instance of Testcase.
129 130 131 132 |
# File 'lib/testcase.rb', line 129 def initialize(testcase=nil) @testcase = testcase @check = true end |
Instance Attribute Details
#check ⇒ Object
Returns the value of attribute check.
134 135 136 |
# File 'lib/testcase.rb', line 134 def check @check end |
#testcase ⇒ Object
Returns the value of attribute testcase.
134 135 136 |
# File 'lib/testcase.rb', line 134 def testcase @testcase end |
Instance Method Details
#exists? ⇒ Boolean
190 191 192 193 194 195 196 197 |
# File 'lib/testcase.rb', line 190 def exists? @result = self.find if @result.empty? return false else return true end end |
#find ⇒ Object
183 184 185 186 187 |
# File 'lib/testcase.rb', line 183 def find puts @testcase.inspect @result = $server.call("TestCase.list", @testcase) return @result end |
#get_plans(case_id) ⇒ Object
200 201 202 203 |
# File 'lib/testcase.rb', line 200 def get_plans(case_id) @result = $server.call("TestCase.list", case_id) return @result end |
#print ⇒ Object
178 179 180 |
# File 'lib/testcase.rb', line 178 def print puts @testcase.inspect end |
#read(id) ⇒ Object
172 173 174 175 |
# File 'lib/testcase.rb', line 172 def read(id) @testcase = $server.call("TestCase.get", id) return @testcase end |
#write ⇒ Object
137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 |
# File 'lib/testcase.rb', line 137 def write if @testcase["summary"].nil? puts "Testcase summary needs to have some value" return false elsif @testcase["category"].nil? puts "Testcase category must be set" return false elsif @testcase["plans"].nil? puts "No testplans defined to add testcase" return false end if @testcase["priority"].nil? puts "Testcase priority not set. Using [P5 - None]" @testcase["priority"] = "P5 - None" end if @testcase["status"].nil? puts "Testcase status not set. Using [PROPOSED]" @testcase["status"] = "PROPOSED" end if @check if self.exists? puts "Testcase already existing - aborting" return false else @testcase = $server.call("TestCase.create", @testcase) return @testcase end else @testcase = $server.call("TestCase.create", @testcase) return @testcase end end |