Module: AutoTest::Test
- Included in:
- AutoTest
- Defined in:
- lib/test.rb
Class Method Summary collapse
- .action_path ⇒ Object
- .add_to_action_path(hash) ⇒ Object
- .add_to_sessions_array(session) ⇒ Object
-
.always_present(class_name, key, value) ⇒ Object
add an array of the classname, key and value of the object to be checked every cycle.
- .check_invariants ⇒ Object
- .fixtures(*fixtures) ⇒ Object
- .get_always_present ⇒ Object
- .get_depth ⇒ Object
- .get_fixtures ⇒ Object
- .get_inputs ⇒ Object
- .get_links_to_exclude ⇒ Object
- .get_max_depth ⇒ Object
- .get_max_number_of_session_links ⇒ Object
- .get_number_of_sessions ⇒ Object
- .get_number_of_test_runs ⇒ Object
-
.get_object_dependencies ⇒ Object
get object dependencies.
- .get_sessions(i, key) ⇒ Object
- .get_sessions_array ⇒ Object
-
.inc_depth ⇒ Object
incremtent the depth.
- .init_action_path ⇒ Object
- .init_always_present ⇒ Object
- .init_auth ⇒ Object
-
.init_depth ⇒ Object
initialize the depth of link search with 0.
- .init_fixtures ⇒ Object
- .init_hash_sessions(key, value) ⇒ Object
- .init_inputs ⇒ Object
- .init_links ⇒ Object
- .init_number_of_test_runs ⇒ Object
-
.init_object_dependencies ⇒ Object
initialize dependency array.
- .init_ready ⇒ Object
- .init_sessions ⇒ Object
- .init_sessions_array ⇒ Object
- .init_stop ⇒ Object
- .init_stop_at_first_error ⇒ Object
-
.initialize_test ⇒ Object
initialize all variables.
- .iterations ⇒ Object
- .iterations=(value) ⇒ Object
- .link_counter ⇒ Object
- .link_counter=(value) ⇒ Object
-
.links_to_exclude(*links) ⇒ Object
list of links that will not be clicked during the test.
- .no_auth ⇒ Object
- .paths ⇒ Object
- .paths=(value) ⇒ Object
- .ready(i) ⇒ Object
- .ready? ⇒ Boolean
- .run ⇒ Object
- .run=(value) ⇒ Object
- .sessions(index, key, value) ⇒ Object
-
.set_input(input, *values) ⇒ Object
for the name or part of the name of an input field, decide, which values to use if not set, random values matching the input type are used.
- .set_max_depth(value) ⇒ Object
- .set_max_number_of_session_links(no) ⇒ Object
- .set_no_auth ⇒ Object
- .set_number_of_sessions(number) ⇒ Object
- .set_number_of_test_runs(number) ⇒ Object
-
.set_object_dependency(child, parent, attribute_name) ⇒ Object
for all objects of class child, there has to be one object of class parent attribute_name is the column that joins the two tables.
- .stop! ⇒ Object
- .stop? ⇒ Boolean
- .stop_at_first_error(stop_at_first_error) ⇒ Object
- .stop_at_first_error? ⇒ Boolean
- .use_fixtures(bool) ⇒ Object
- .use_fixtures? ⇒ Boolean
- .users_logged_in ⇒ Object
- .users_logged_in=(value) ⇒ Object
Class Method Details
.action_path ⇒ Object
235 236 237 |
# File 'lib/test.rb', line 235 def action_path @@action_paths end |
.add_to_action_path(hash) ⇒ Object
247 248 249 |
# File 'lib/test.rb', line 247 def add_to_action_path(hash) @@action_paths << hash end |
.add_to_sessions_array(session) ⇒ Object
301 302 303 |
# File 'lib/test.rb', line 301 def add_to_sessions_array(session) @sessions_array << session end |
.always_present(class_name, key, value) ⇒ Object
add an array of the classname, key and value of the object to be checked every cycle
187 188 189 |
# File 'lib/test.rb', line 187 def always_present(class_name, key, value) @@always_present << [class_name, key, value] end |
.check_invariants ⇒ Object
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 |
# File 'lib/test.rb', line 85 def check_invariants get_always_present.each do |present| if present[0].find(:first, :conditions => "#{present[1]} = '#{present[2]}'") == nil then if stop_at_first_error? then stop! end logger.info "*"*100 = "ERROR : Invariant always_present : class '#{present[0]}' attribute '#{present[1]}' value '#{present[2]}' was deleted" logger.error logger.info "*"*100 Error.inc_error() end end get_object_dependencies.each do |dependency| children = dependency[0].find(:all) children.each do |child| begin dependency[1].find(child.send(dependency[2].to_sym)) rescue if stop_at_first_error? then stop! end logger.info "*"*100 = "ERROR : Invariant object_dependencies : no '#{dependency[1]}' for #{dependency[0]} #{child.id}" logger.error logger.info "*"*100 Error.inc_error() end end end end |
.fixtures(*fixtures) ⇒ Object
30 31 32 |
# File 'lib/test.rb', line 30 def fixtures(*fixtures) @@fixtures = fixtures end |
.get_always_present ⇒ Object
191 192 193 |
# File 'lib/test.rb', line 191 def get_always_present @@always_present end |
.get_depth ⇒ Object
144 145 146 |
# File 'lib/test.rb', line 144 def get_depth @@depth end |
.get_fixtures ⇒ Object
34 35 36 |
# File 'lib/test.rb', line 34 def get_fixtures @@fixtures end |
.get_inputs ⇒ Object
174 175 176 |
# File 'lib/test.rb', line 174 def get_inputs @@inputs end |
.get_links_to_exclude ⇒ Object
195 196 197 |
# File 'lib/test.rb', line 195 def get_links_to_exclude @@links end |
.get_max_depth ⇒ Object
152 153 154 |
# File 'lib/test.rb', line 152 def get_max_depth @@max_depth end |
.get_max_number_of_session_links ⇒ Object
313 314 315 |
# File 'lib/test.rb', line 313 def get_max_number_of_session_links @@no_session_links end |
.get_number_of_sessions ⇒ Object
182 183 184 |
# File 'lib/test.rb', line 182 def get_number_of_sessions @@number_of_sessions end |
.get_number_of_test_runs ⇒ Object
119 120 121 |
# File 'lib/test.rb', line 119 def get_number_of_test_runs @@runs end |
.get_object_dependencies ⇒ Object
get object dependencies
158 159 160 |
# File 'lib/test.rb', line 158 def get_object_dependencies @@dependencies end |
.get_sessions(i, key) ⇒ Object
289 290 291 |
# File 'lib/test.rb', line 289 def get_sessions(i, key) @sessions["#{i}"]["#{key}"] end |
.get_sessions_array ⇒ Object
293 294 295 |
# File 'lib/test.rb', line 293 def get_sessions_array @sessions_array end |
.inc_depth ⇒ Object
incremtent the depth
140 141 142 |
# File 'lib/test.rb', line 140 def inc_depth @@depth = @@depth + 1 end |
.init_action_path ⇒ Object
67 68 69 |
# File 'lib/test.rb', line 67 def init_action_path @@action_paths = [] end |
.init_always_present ⇒ Object
76 77 78 |
# File 'lib/test.rb', line 76 def init_always_present @@always_present = [] end |
.init_auth ⇒ Object
63 64 65 |
# File 'lib/test.rb', line 63 def init_auth @@no_auth = false end |
.init_depth ⇒ Object
initialize the depth of link search with 0
59 60 61 |
# File 'lib/test.rb', line 59 def init_depth @@depth = 0 end |
.init_fixtures ⇒ Object
22 23 24 |
# File 'lib/test.rb', line 22 def init_fixtures @@use_fixtures = false end |
.init_hash_sessions(key, value) ⇒ Object
281 282 283 |
# File 'lib/test.rb', line 281 def init_hash_sessions(key, value) @sessions["#{key}"] = value end |
.init_inputs ⇒ Object
80 81 82 |
# File 'lib/test.rb', line 80 def init_inputs @@inputs = Hash.new end |
.init_links ⇒ Object
46 47 48 |
# File 'lib/test.rb', line 46 def init_links @@links = [] end |
.init_number_of_test_runs ⇒ Object
42 43 44 |
# File 'lib/test.rb', line 42 def init_number_of_test_runs @@runs = 1 end |
.init_object_dependencies ⇒ Object
initialize dependency array
72 73 74 |
# File 'lib/test.rb', line 72 def init_object_dependencies @@dependencies = [] end |
.init_ready ⇒ Object
255 256 257 |
# File 'lib/test.rb', line 255 def init_ready @ready = Array.new(Test.get_number_of_sessions) end |
.init_sessions ⇒ Object
277 278 279 |
# File 'lib/test.rb', line 277 def init_sessions @sessions = Hash.new end |
.init_sessions_array ⇒ Object
297 298 299 |
# File 'lib/test.rb', line 297 def init_sessions_array @sessions_array = [] end |
.init_stop ⇒ Object
54 55 56 |
# File 'lib/test.rb', line 54 def init_stop @@stop = false end |
.init_stop_at_first_error ⇒ Object
50 51 52 |
# File 'lib/test.rb', line 50 def init_stop_at_first_error @@stop_at_first_error = false end |
.initialize_test ⇒ Object
initialize all variables
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/test.rb', line 5 def initialize_test Error.init_error Authentication.init_users Authentication.init_login_data init_fixtures init_action_path init_links init_depth init_inputs init_always_present init_object_dependencies init_stop_at_first_error init_stop init_auth init_number_of_test_runs end |
.iterations ⇒ Object
212 213 214 |
# File 'lib/test.rb', line 212 def iterations @iterations end |
.iterations=(value) ⇒ Object
216 217 218 |
# File 'lib/test.rb', line 216 def iterations=(value) @iterations = value end |
.link_counter ⇒ Object
220 221 222 |
# File 'lib/test.rb', line 220 def link_counter @link_counter end |
.link_counter=(value) ⇒ Object
223 224 225 |
# File 'lib/test.rb', line 223 def link_counter=(value) @link_counter = value end |
.links_to_exclude(*links) ⇒ Object
list of links that will not be clicked during the test
200 201 202 |
# File 'lib/test.rb', line 200 def links_to_exclude(*links) @@links = links end |
.no_auth ⇒ Object
239 240 241 |
# File 'lib/test.rb', line 239 def no_auth @@no_auth end |
.paths ⇒ Object
208 209 210 |
# File 'lib/test.rb', line 208 def paths @paths end |
.paths=(value) ⇒ Object
204 205 206 |
# File 'lib/test.rb', line 204 def paths=(value) @paths = value end |
.ready(i) ⇒ Object
259 260 261 |
# File 'lib/test.rb', line 259 def ready(i) @ready[i-1] = true end |
.ready? ⇒ Boolean
263 264 265 266 267 268 269 270 271 272 273 274 275 |
# File 'lib/test.rb', line 263 def ready? count = 0 for i in 0..@ready.size-1 do if @ready[i] == true then count = count + 1 end end if count == @ready.size then return true else return false end end |
.run ⇒ Object
231 232 233 |
# File 'lib/test.rb', line 231 def run @run end |
.run=(value) ⇒ Object
227 228 229 |
# File 'lib/test.rb', line 227 def run=(value) @run = value end |
.sessions(index, key, value) ⇒ Object
285 286 287 |
# File 'lib/test.rb', line 285 def sessions(index, key, value) @sessions["#{index}"]["#{key}"] = value end |
.set_input(input, *values) ⇒ Object
for the name or part of the name of an input field, decide, which values to use if not set, random values matching the input type are used
170 171 172 |
# File 'lib/test.rb', line 170 def set_input(input, *values) @@inputs.store(input, values) end |
.set_max_depth(value) ⇒ Object
148 149 150 |
# File 'lib/test.rb', line 148 def set_max_depth(value) @@max_depth = value end |
.set_max_number_of_session_links(no) ⇒ Object
309 310 311 |
# File 'lib/test.rb', line 309 def set_max_number_of_session_links(no) @@no_session_links = no end |
.set_no_auth ⇒ Object
243 244 245 |
# File 'lib/test.rb', line 243 def set_no_auth @@no_auth = true end |
.set_number_of_sessions(number) ⇒ Object
178 179 180 |
# File 'lib/test.rb', line 178 def set_number_of_sessions(number) @@number_of_sessions = number end |
.set_number_of_test_runs(number) ⇒ Object
115 116 117 |
# File 'lib/test.rb', line 115 def set_number_of_test_runs(number) @@runs = number end |
.set_object_dependency(child, parent, attribute_name) ⇒ Object
for all objects of class child, there has to be one object of class parent attribute_name is the column that joins the two tables
164 165 166 |
# File 'lib/test.rb', line 164 def set_object_dependency(child, parent, attribute_name) @@dependencies << [child, parent, attribute_name] end |
.stop! ⇒ Object
135 136 137 |
# File 'lib/test.rb', line 135 def stop! @@stop = true end |
.stop? ⇒ Boolean
131 132 133 |
# File 'lib/test.rb', line 131 def stop? @@stop end |
.stop_at_first_error(stop_at_first_error) ⇒ Object
123 124 125 |
# File 'lib/test.rb', line 123 def stop_at_first_error(stop_at_first_error) @@stop_at_first_error = stop_at_first_error end |
.stop_at_first_error? ⇒ Boolean
127 128 129 |
# File 'lib/test.rb', line 127 def stop_at_first_error? @@stop_at_first_error end |
.use_fixtures(bool) ⇒ Object
38 39 40 |
# File 'lib/test.rb', line 38 def use_fixtures(bool) @@use_fixtures = bool end |
.use_fixtures? ⇒ Boolean
26 27 28 |
# File 'lib/test.rb', line 26 def use_fixtures? @@use_fixtures end |
.users_logged_in ⇒ Object
251 252 253 |
# File 'lib/test.rb', line 251 def users_logged_in @users_logged_in end |
.users_logged_in=(value) ⇒ Object
305 306 307 |
# File 'lib/test.rb', line 305 def users_logged_in=(value) @users_logged_in = value end |