Module: AutoTest::Test
- 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
- .get_always_present ⇒ Object
- .get_depth ⇒ 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_hash_sessions(key, value) ⇒ Object
- .init_inputs ⇒ 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
- .users_logged_in ⇒ Object
- .users_logged_in=(value) ⇒ Object
- .write_user_input_to_file ⇒ Object
Class Method Details
.action_path ⇒ Object
213 214 215 |
# File 'lib/test.rb', line 213 def action_path @@action_paths end |
.add_to_action_path(hash) ⇒ Object
225 226 227 |
# File 'lib/test.rb', line 225 def add_to_action_path(hash) @@action_paths << hash end |
.add_to_sessions_array(session) ⇒ Object
279 280 281 |
# File 'lib/test.rb', line 279 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
165 166 167 |
# File 'lib/test.rb', line 165 def always_present(class_name, key, value) @@always_present << [class_name, key, value] end |
.check_invariants ⇒ Object
63 64 65 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 |
# File 'lib/test.rb', line 63 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 |
.get_always_present ⇒ Object
169 170 171 |
# File 'lib/test.rb', line 169 def get_always_present @@always_present end |
.get_depth ⇒ Object
122 123 124 |
# File 'lib/test.rb', line 122 def get_depth @@depth end |
.get_inputs ⇒ Object
152 153 154 |
# File 'lib/test.rb', line 152 def get_inputs @@inputs end |
.get_links_to_exclude ⇒ Object
173 174 175 |
# File 'lib/test.rb', line 173 def get_links_to_exclude @@links end |
.get_max_depth ⇒ Object
130 131 132 |
# File 'lib/test.rb', line 130 def get_max_depth @@max_depth end |
.get_max_number_of_session_links ⇒ Object
291 292 293 |
# File 'lib/test.rb', line 291 def get_max_number_of_session_links @@no_session_links end |
.get_number_of_sessions ⇒ Object
160 161 162 |
# File 'lib/test.rb', line 160 def get_number_of_sessions @@number_of_sessions end |
.get_number_of_test_runs ⇒ Object
97 98 99 |
# File 'lib/test.rb', line 97 def get_number_of_test_runs @@runs end |
.get_object_dependencies ⇒ Object
get object dependencies
136 137 138 |
# File 'lib/test.rb', line 136 def get_object_dependencies @@dependencies end |
.get_sessions(i, key) ⇒ Object
267 268 269 |
# File 'lib/test.rb', line 267 def get_sessions(i, key) @sessions["#{i}"]["#{key}"] end |
.get_sessions_array ⇒ Object
271 272 273 |
# File 'lib/test.rb', line 271 def get_sessions_array @sessions_array end |
.inc_depth ⇒ Object
incremtent the depth
118 119 120 |
# File 'lib/test.rb', line 118 def inc_depth @@depth = @@depth + 1 end |
.init_action_path ⇒ Object
45 46 47 |
# File 'lib/test.rb', line 45 def init_action_path @@action_paths = [] end |
.init_always_present ⇒ Object
54 55 56 |
# File 'lib/test.rb', line 54 def init_always_present @@always_present = [] end |
.init_auth ⇒ Object
41 42 43 |
# File 'lib/test.rb', line 41 def init_auth @@no_auth = false end |
.init_depth ⇒ Object
initialize the depth of link search with 0
37 38 39 |
# File 'lib/test.rb', line 37 def init_depth @@depth = 0 end |
.init_hash_sessions(key, value) ⇒ Object
259 260 261 |
# File 'lib/test.rb', line 259 def init_hash_sessions(key, value) @sessions["#{key}"] = value end |
.init_inputs ⇒ Object
58 59 60 |
# File 'lib/test.rb', line 58 def init_inputs @@inputs = Hash.new end |
.init_number_of_test_runs ⇒ Object
24 25 26 |
# File 'lib/test.rb', line 24 def init_number_of_test_runs @@runs = 1 end |
.init_object_dependencies ⇒ Object
initialize dependency array
50 51 52 |
# File 'lib/test.rb', line 50 def init_object_dependencies @@dependencies = [] end |
.init_ready ⇒ Object
233 234 235 |
# File 'lib/test.rb', line 233 def init_ready @ready = Array.new(Test.get_number_of_sessions) end |
.init_sessions ⇒ Object
255 256 257 |
# File 'lib/test.rb', line 255 def init_sessions @sessions = Hash.new end |
.init_sessions_array ⇒ Object
275 276 277 |
# File 'lib/test.rb', line 275 def init_sessions_array @sessions_array = [] end |
.init_stop ⇒ Object
32 33 34 |
# File 'lib/test.rb', line 32 def init_stop @@stop = false end |
.init_stop_at_first_error ⇒ Object
28 29 30 |
# File 'lib/test.rb', line 28 def init_stop_at_first_error @@stop_at_first_error = false end |
.initialize_test ⇒ Object
initialize all variables
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/test.rb', line 8 def initialize_test Error.init_error Authentication.init_users Authentication.init_login_data init_action_path 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
190 191 192 |
# File 'lib/test.rb', line 190 def iterations @iterations end |
.iterations=(value) ⇒ Object
194 195 196 |
# File 'lib/test.rb', line 194 def iterations=(value) @iterations = value end |
.link_counter ⇒ Object
198 199 200 |
# File 'lib/test.rb', line 198 def link_counter @link_counter end |
.link_counter=(value) ⇒ Object
201 202 203 |
# File 'lib/test.rb', line 201 def link_counter=(value) @link_counter = value end |
.links_to_exclude(*links) ⇒ Object
list of links that will not be clicked during the test
178 179 180 |
# File 'lib/test.rb', line 178 def links_to_exclude(*links) @@links = links end |
.no_auth ⇒ Object
217 218 219 |
# File 'lib/test.rb', line 217 def no_auth @@no_auth end |
.paths ⇒ Object
186 187 188 |
# File 'lib/test.rb', line 186 def paths @paths end |
.paths=(value) ⇒ Object
182 183 184 |
# File 'lib/test.rb', line 182 def paths=(value) @paths = value end |
.ready(i) ⇒ Object
237 238 239 |
# File 'lib/test.rb', line 237 def ready(i) @ready[i-1] = true end |
.ready? ⇒ Boolean
241 242 243 244 245 246 247 248 249 250 251 252 253 |
# File 'lib/test.rb', line 241 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
209 210 211 |
# File 'lib/test.rb', line 209 def run @run end |
.run=(value) ⇒ Object
205 206 207 |
# File 'lib/test.rb', line 205 def run=(value) @run = value end |
.sessions(index, key, value) ⇒ Object
263 264 265 |
# File 'lib/test.rb', line 263 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
148 149 150 |
# File 'lib/test.rb', line 148 def set_input(input, *values) @@inputs.store(input, values) end |
.set_max_depth(value) ⇒ Object
126 127 128 |
# File 'lib/test.rb', line 126 def set_max_depth(value) @@max_depth = value end |
.set_max_number_of_session_links(no) ⇒ Object
287 288 289 |
# File 'lib/test.rb', line 287 def set_max_number_of_session_links(no) @@no_session_links = no end |
.set_no_auth ⇒ Object
221 222 223 |
# File 'lib/test.rb', line 221 def set_no_auth @@no_auth = true end |
.set_number_of_sessions(number) ⇒ Object
156 157 158 |
# File 'lib/test.rb', line 156 def set_number_of_sessions(number) @@number_of_sessions = number end |
.set_number_of_test_runs(number) ⇒ Object
93 94 95 |
# File 'lib/test.rb', line 93 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
142 143 144 |
# File 'lib/test.rb', line 142 def set_object_dependency(child, parent, attribute_name) @@dependencies << [child, parent, attribute_name] end |
.stop! ⇒ Object
113 114 115 |
# File 'lib/test.rb', line 113 def stop! @@stop = true end |
.stop? ⇒ Boolean
109 110 111 |
# File 'lib/test.rb', line 109 def stop? @@stop end |
.stop_at_first_error(stop_at_first_error) ⇒ Object
101 102 103 |
# File 'lib/test.rb', line 101 def stop_at_first_error(stop_at_first_error) @@stop_at_first_error = stop_at_first_error end |
.stop_at_first_error? ⇒ Boolean
105 106 107 |
# File 'lib/test.rb', line 105 def stop_at_first_error? @@stop_at_first_error end |
.users_logged_in ⇒ Object
229 230 231 |
# File 'lib/test.rb', line 229 def users_logged_in @users_logged_in end |
.users_logged_in=(value) ⇒ Object
283 284 285 |
# File 'lib/test.rb', line 283 def users_logged_in=(value) @users_logged_in = value end |
.write_user_input_to_file ⇒ Object
296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 |
# File 'lib/test.rb', line 296 def write_user_input_to_file f = File.new("log/user_input.log", "w") if Test.no_auth then f.puts("get_number_of_test_runs:#{get_number_of_test_runs} get_number_of_sessions:#{get_number_of_sessions}") else f.puts("get_number_of_test_runs:#{get_number_of_test_runs} get_login_path:#{Authentication.get_login_path} get_logout_path:#{Authentication.get_logout_path} get_login_attributes:#{Authentication.get_login_attributes} get_number_of_sessions:#{get_number_of_sessions} get_login_data:#{Authentication.get_login_data} get_login_names:#{Authentication.get_login_names} get_unique_login_attribute_name:#{Authentication.get_unique_login_attribute_name} use_db_users:#{Authentication.use_db_users} user_class:#{Authentication.user_class}") end f.close end |