testability-driver 1.3.1 → 1.3.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. data/bin/start_app_perf +6 -6
  2. data/lib/tdriver-devtools/behaviour/xml/rdoc_behaviour_xml_generator.rb +4 -4
  3. data/lib/tdriver-devtools/doc/xslt/template.xsl +103 -21
  4. data/lib/tdriver/base/behaviour/behaviours/object_behaviour_description.rb +1 -1
  5. data/lib/tdriver/base/command_data/loader.rb +6 -2
  6. data/lib/tdriver/base/loader.rb +21 -14
  7. data/lib/tdriver/base/state_object.rb +1 -1
  8. data/lib/tdriver/base/sut/controller.rb +8 -2
  9. data/lib/tdriver/base/sut/generic/behaviours/sut.rb +103 -46
  10. data/lib/tdriver/base/sut/generic/behaviours/switchbox_behaviour.rb +2 -2
  11. data/lib/tdriver/base/sut/generic/behaviours/verification.rb +1 -1
  12. data/lib/tdriver/base/sut/generic/commands/application.rb +18 -278
  13. data/lib/tdriver/base/sut/generic/commands/key_sequence.rb +1 -1
  14. data/lib/tdriver/base/sut/sut.rb +1 -1
  15. data/lib/tdriver/base/test_object/abstract.rb +1 -1
  16. data/lib/tdriver/base/test_object/adapter.rb +4 -1
  17. data/lib/tdriver/base/test_object/behaviours/syncronization.rb +3 -3
  18. data/lib/tdriver/base/test_object/behaviours/test_object.rb +61 -24
  19. data/lib/tdriver/base/test_object/cache.rb +6 -4
  20. data/lib/tdriver/base/test_object/factory.rb +4 -2
  21. data/lib/tdriver/base/test_object/loader.rb +23 -14
  22. data/lib/tdriver/base/test_object/xml/abstraction.rb +63 -0
  23. data/lib/tdriver/base/test_object/xml/adapter.rb +4 -1
  24. data/lib/tdriver/report/report_test_run.rb +1 -1
  25. data/lib/tdriver/report/report_writer.rb +4 -3
  26. data/lib/tdriver/util/common/boolean.rb +10 -13
  27. data/lib/tdriver/util/common/environment.rb +8 -7
  28. data/lib/tdriver/util/common/hash.rb +5 -5
  29. data/lib/tdriver/util/common/numeric.rb +5 -5
  30. data/lib/tdriver/util/common/object.rb +3 -3
  31. data/lib/tdriver/util/common/retryable.rb +65 -2
  32. data/lib/tdriver/util/common/string.rb +4 -4
  33. data/lib/tdriver/util/database/access.rb +9 -11
  34. data/lib/tdriver/util/fixture/service.rb +54 -0
  35. data/lib/tdriver/util/localisation/localisation.rb +3 -2
  36. data/lib/tdriver/util/logger/logger.rb +55 -41
  37. data/lib/tdriver/util/parameter/parameter.rb +38 -7
  38. data/lib/tdriver/util/xml/abstraction.rb +8 -8
  39. data/lib/tdriver/util/xml/builder.rb +1 -1
  40. data/lib/tdriver/util/xml/xml.rb +11 -11
  41. data/lib/tdriver/verify/verify.rb +33 -36
  42. data/lib/tdriver/version.rb +1 -1
  43. data/xml/defaults/sut_generic.xml +1 -29
  44. data/xml/templates/generic.xml +28 -0
  45. metadata +48 -17
@@ -97,11 +97,11 @@ module MobyBehaviour
97
97
  power_up
98
98
  sleep sleep_time_after_powerup
99
99
 
100
- MobyUtil::Retryable.until( :timeout => 60, :retry_timeout => 5 ) {
100
+ MobyUtil::Retryable.until( :timeout => 60, :interval => 5 ) {
101
101
  system(str_commands_after_powerup) if str_commands_after_powerup != nil
102
102
  if $parameters[ :ats4_error_recovery_enabled, false ]!='true'
103
103
  $logger.behaviour "PASS;TDriver attempting reconnect"
104
- self.connect(self.id)
104
+ connect( id )
105
105
  $logger.behaviour "PASS;TDriver connected"
106
106
  else
107
107
  $logger.behaviour "PASS;ATS4 handling reconnection"
@@ -198,7 +198,7 @@ module MobyBehaviour
198
198
  $logger.enabled = ( attributes[ :__logging ] == 'true' ? true : false )
199
199
 
200
200
  # behaviour logging
201
- $logger.behaviour "#{ ( result == true ? 'PASS' : 'FAIL' ) };#{ description };#{ ( self.sut? ? self.id.to_s : '' ) };test_object_exists?;"
201
+ $logger.behaviour "#{ ( result == true ? 'PASS' : 'FAIL' ) };#{ description };#{ ( sut? ? id.to_s : '' ) };test_object_exists?;"
202
202
 
203
203
  # raise exception if neccessery
204
204
  raise result if result.kind_of?( Exception )
@@ -21,43 +21,6 @@ module MobyCommand
21
21
 
22
22
  class Application < MobyCommand::CommandData
23
23
 
24
- =begin
25
- attr_reader(
26
-
27
- :command_type,
28
- :application_name,
29
- :application_uid,
30
- :sut,
31
- :application_arguments,
32
- :events_to_listen,
33
- :signals_to_listen,
34
- :working_directory,
35
- :flags,
36
- :start_command,
37
-
38
- :refresh_arguments,
39
- :attribute_csv_string
40
-
41
-
42
- :_arguments,
43
- :_environment,
44
- :_working_directory,
45
- :_events_to_listen,
46
- :_start_command,
47
- :_application_uid,
48
- :_application_name,
49
- :_command,
50
- :_application_name,
51
- :_application_uid,
52
- :_flags,
53
- :_attribute_csv_string,
54
- :_signals_to_listen,
55
- :_sut,
56
- :_refresh_args
57
-
58
- )
59
- =end
60
-
61
24
  attr_reader :command_arguments
62
25
 
63
26
  # TODO: document me
@@ -85,22 +48,6 @@ module MobyCommand
85
48
  @_refresh_args = nil
86
49
  @_attribute_csv_string = nil
87
50
  @_checksum = nil
88
-
89
- =begin
90
- # store values from arguments
91
- self.name( arguments[ :application_name ] )
92
- self.uid( arguments[ :application_uid ] )
93
- self.sut( arguments[ :sut ] )
94
- self.arguments( arguments[ :arguments ] )
95
- self.events_to_listen( arguments[ :events_to_listen ] )
96
- self.signals_to_listen( arguments[ :signals_to_listen ] )
97
- self.environment( arguments[ :environment ] )
98
- self.working_directory( arguments[ :working_directory ] )
99
- self.flags( arguments[ :flags ] )
100
- self.start_command( arguments[ :start_command ] )
101
- self.refresh_args( arguments[ :refresh_arguments ] )
102
- self.attribute_filter( arguments[ :attribute_filter ] )
103
- =end
104
51
 
105
52
  # store values from arguments - call setter method only when required
106
53
  arguments.each_pair{ | key, value |
@@ -195,7 +142,7 @@ module MobyCommand
195
142
  # ArgumentError:: When sut is not nil or a SUT
196
143
  def sut( sut )
197
144
 
198
- raise ArgumentError.new( "The given sut must be nil or a SUT." ) unless sut == nil || sut.kind_of?( MobyBase::SUT )
145
+ sut.check_type [ MobyBase::SUT, NilClass ], 'wrong argument type $1 for SUT (expected $2)'
199
146
  @_sut = sut
200
147
  self
201
148
 
@@ -208,59 +155,59 @@ module MobyCommand
208
155
  # Application:: This CommandData object
209
156
  # == raises
210
157
  # ArgumentError:: When app_name is not nil or a String
211
- def name( app_name )
158
+ def name( name )
212
159
 
213
- raise ArgumentError.new( "The given application name must be nil or a String." ) unless app_name == nil || app_name.kind_of?( String )
214
- @_application_name = app_name
160
+ name.check_type [ String, NilClass ], 'wrong argument type $1 for application name (expected $2)'
161
+ @_application_name = name
215
162
  self
216
163
 
217
164
  end
218
165
 
219
166
  def arguments( arguments )
220
167
 
221
- raise ArgumentError.new( "The given application arguments must be nil or a String." ) unless arguments == nil || arguments.kind_of?( String )
168
+ arguments.check_type [ String, NilClass ], 'wrong argument type $1 for application arguments (expected $2)'
222
169
  @_arguments = arguments
223
170
 
224
171
  end
225
172
 
226
173
  def flags( flags )
227
174
 
228
- raise ArgumentError.new( "The given application flags must be nil or a Hash." ) unless flags == nil || flags.kind_of?( Hash )
175
+ flags.check_type [ Hash, NilClass ], 'wrong argument type $1 for application flags (expected $2)'
229
176
  @_flags = flags
230
177
 
231
178
  end
232
179
 
233
- def environment( environment )
180
+ def environment( env )
234
181
 
235
- raise ArgumentError.new( "The given application environment must be nil or a String." ) unless environment == nil || environment.kind_of?( String )
236
- @_environment = environment
182
+ env.check_type [ String, NilClass ], 'wrong argument type $1 for application environment (expected $2)'
183
+ @_environment = env
237
184
 
238
185
  end
239
186
 
240
- def working_directory( working_directory )
187
+ def working_directory( dir )
241
188
 
242
- raise ArgumentError.new( "The given application working directory must be nil or a String." ) unless working_directory == nil || working_directory.kind_of?( String )
243
- @_working_directory = working_directory
189
+ dir.check_type [ String, NilClass ], 'wrong argument type $1 for application working directory (expected $2)'
190
+ @_working_directory = dir
244
191
 
245
192
  end
246
193
 
247
194
  def events_to_listen( events )
248
195
 
249
- raise ArgumentError.new( "The events to listen must be nil or a String." ) unless events == nil || events.kind_of?( String )
196
+ events.check_type [ String, NilClass ], 'wrong argument type $1 for events to be listened (expected $2)'
250
197
  @_events_to_listen = events
251
198
 
252
199
  end
253
200
 
254
201
  def signals_to_listen( signals )
255
202
 
256
- raise ArgumentError.new( "The signals to listen must be nil or a String." ) unless signals == nil || signals.kind_of?( String )
203
+ signals.check_type [ String, NilClass ], 'wrong argument type $1 for signals to be listened (expected $2)'
257
204
  @_signals_to_listen = signals
258
205
 
259
206
  end
260
207
 
261
208
  def start_command( start_command )
262
209
 
263
- raise ArgumentError.new( "The start_command must be nil or a String." ) unless start_command == nil || start_command.kind_of?( String )
210
+ start_command.check_type [ String, NilClass ], 'wrong argument type $1 for application start command (expected $2)'
264
211
  @_start_command = start_command
265
212
 
266
213
  end
@@ -272,9 +219,10 @@ module MobyCommand
272
219
  # Application:: This CommandData object
273
220
  # == raises
274
221
  # ArgumentError:: When app_name is not nil or a String
275
- def uid( app_uid )
222
+ def uid( app_uid )
223
+
224
+ app_uid.check_type [ Fixnum, String, NilClass ], 'wrong argument type $1 for application UID (expected $2)'
276
225
 
277
- raise ArgumentError.new( "The given application uid must be nil, a String or an Integer." ) unless app_uid == nil || app_uid.kind_of?( String ) || app_uid.kind_of?( Fixnum )
278
226
  @_application_uid = app_uid
279
227
  @_application_uid = @_application_uid.to_i unless @_application_uid == nil
280
228
  self
@@ -322,213 +270,5 @@ module MobyCommand
322
270
 
323
271
  end
324
272
 
325
- =begin
326
-
327
- class Application < MobyCommand::CommandData
328
-
329
- #Application command types
330
- #Launch application = :Run
331
- #Close application = :Close
332
- #List of running applications = :List
333
- #Current state of the UI = :State
334
- #Kill = :Kill
335
- #Kill All = :KillAll
336
- #
337
- # Constructs a new Application CommandData object
338
- # == params
339
- # command_type:: (optional) Symbol, defines the command to perform on the application
340
- # app_name:: (optional) String, name of application to perform this command on
341
- # app_uid::
342
- # sut:: (optional) SUT, creator of the command. Can be used to access parameters when creating messages.
343
- # arguments:: (optional) Arguments given to the application on start up. Comma separated list if more the one.
344
- # environment:: (optional) Environment given to the application on start up. Comma separated list if more the one.
345
- # working_directory:: (optional) Working directory for the application (not used on Symbian)
346
- # == returns
347
- # Application:: New CommandData object
348
- # == raises
349
- # ArgumentError:: When the supplied command_type is invalid.
350
- def initialize( command_type = nil, app_name = nil, app_uid = nil, sut = nil, arguments = nil, environment = nil, working_directory = nil, events_to_listen = nil, signals_to_listen = nil, flags = nil, start_command = nil)
351
- # Set status value to nil (not executed)
352
-
353
- self.command( command_type )
354
- self.name( app_name )
355
- self.uid( app_uid )
356
- self.sut( sut )
357
- self.arguments( arguments )
358
- self.events_to_listen( events_to_listen )
359
- self.signals_to_listen( signals_to_listen )
360
- self.environment( environment )
361
- self.working_directory( working_directory )
362
- self.flags( flags )
363
- self.start_command( start_command )
364
- self.refresh_args
365
-
366
- @_attribute_csv_string = nil
367
-
368
- self
369
-
370
- end
371
-
372
- # Store the args for possible future use
373
- def refresh_args(refresh_args={})
374
- @_refresh_args = refresh_args
375
- end
376
-
377
- def get_refresh_args
378
- @_refresh_args
379
- end
380
-
381
-
382
- # Defines the type of command this Application CommandData object represents
383
- # == params
384
- # command_type:: Symbol, defines the command to perform on the application
385
- # == returns
386
- # Application:: This CommandData object
387
- # == raises
388
- # ArgumentError:: When the supplied command_type is invalid.
389
- def command( command_type )
390
-
391
- @_command = command_type
392
- self
393
-
394
- end
395
-
396
- # Defines the used SUT to be able to access parameters when creating messages
397
- # == params
398
- # sut:: SUT, creator of the command.
399
- # == returns
400
- # Application:: This CommandData object
401
- # == raises
402
- # ArgumentError:: When sut is not nil or a SUT
403
- def sut( sut )
404
-
405
- raise ArgumentError.new( "The given sut must be nil or a SUT." ) unless sut == nil || sut.kind_of?( MobyBase::SUT )
406
- @_sut = sut
407
- self
408
-
409
- end
410
-
411
- # Defines the name of the application this Application CommandData object is associated with
412
- # == params
413
- # app_name:: String, name of application to perform this command on
414
- # == returns
415
- # Application:: This CommandData object
416
- # == raises
417
- # ArgumentError:: When app_name is not nil or a String
418
- def name( app_name )
419
-
420
- raise ArgumentError.new( "The given application name must be nil or a String." ) unless app_name == nil || app_name.kind_of?( String )
421
- @_application_name = app_name
422
- self
423
-
424
- end
425
-
426
- def arguments( arguments )
427
-
428
- raise ArgumentError.new( "The given application arguments must be nil or a String." ) unless arguments == nil || arguments.kind_of?( String )
429
- @_arguments = arguments
430
-
431
- end
432
-
433
- def flags( flags )
434
-
435
- raise ArgumentError.new( "The given application flags must be nil or a Hash." ) unless flags == nil || flags.kind_of?( Hash )
436
- @_flags = flags
437
-
438
- end
439
-
440
- def environment( environment )
441
-
442
- raise ArgumentError.new( "The given application environment must be nil or a String." ) unless environment == nil || environment.kind_of?( String )
443
- @_environment = environment
444
-
445
- end
446
-
447
- def working_directory( working_directory )
448
-
449
- raise ArgumentError.new( "The given application working directory must be nil or a String." ) unless working_directory == nil || working_directory.kind_of?( String )
450
- @_working_directory = working_directory
451
-
452
- end
453
-
454
- def events_to_listen( events )
455
-
456
- raise ArgumentError.new( "The events to listen must be nil or a String." ) unless events == nil || events.kind_of?( String )
457
- @_events_to_listen = events
458
-
459
- end
460
-
461
- def signals_to_listen( signals )
462
-
463
- raise ArgumentError.new( "The signals to listen must be nil or a String." ) unless signals == nil || signals.kind_of?( String )
464
- @_signals_to_listen = signals
465
-
466
- end
467
-
468
- def start_command( start_command )
469
-
470
- raise ArgumentError.new( "The start_command must be nil or a String." ) unless start_command == nil || start_command.kind_of?( String )
471
- @_start_command = start_command
472
-
473
- end
474
-
475
- # Defines the uid of the application this Application CommandData object is associated with
476
- # == params
477
- # app_uid:: FixNum, uid of application to perform this command on
478
- # == returns
479
- # Application:: This CommandData object
480
- # == raises
481
- # ArgumentError:: When app_name is not nil or a String
482
- def uid( app_uid )
483
-
484
- raise ArgumentError.new( "The given application uid must be nil, a String or an Integer." ) unless app_uid == nil || app_uid.kind_of?( String ) || app_uid.kind_of?( Fixnum )
485
- @_application_uid = app_uid
486
- @_application_uid = @_application_uid.to_i unless @_application_uid == nil
487
- self
488
-
489
- end
490
-
491
- def get_command
492
-
493
- @_command
494
-
495
- end
496
-
497
- def get_application
498
-
499
- @_application_name
500
-
501
- end
502
-
503
- def get_uid
504
-
505
- @_application_uid
506
-
507
- end
508
-
509
- def get_flags
510
-
511
- @_flags
512
-
513
- end
514
-
515
- def attribute_filter(attribute_string)
516
-
517
- @_attribute_csv_string = attribute_string
518
-
519
- end
520
-
521
- def get_attribute_filter
522
-
523
- @_attribute_csv_string
524
-
525
- end
526
-
527
- # enable hooking for performance measurement & debug logging
528
- TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
529
-
530
- end # Application
531
- =end
532
-
533
273
  end # MobyCommand
534
274
 
@@ -33,7 +33,7 @@ module MobyCommand
33
33
  #TODO: Review comment (OR): @sequence -> @_sequence?
34
34
  @sequence = [] # Array.new( 0 )
35
35
  #@_sut = sut
36
- self.append!( key_symbol, type_symbol ) unless key_symbol.nil?
36
+ append!( key_symbol, type_symbol ) unless key_symbol.nil?
37
37
  end
38
38
 
39
39
  # Function to append a keypress with type to KeySequence.sequence array
@@ -86,7 +86,7 @@ module MobyBase
86
86
  # TODO: document me
87
87
  def inspect
88
88
 
89
- "#<#{ self.class }:0x#{ ( "%x" % ( self.object_id.to_i << 1 ) )[ 3 .. -1 ] } @id=#{ @id.inspect } @input=\"#{ @input }\" @type=\"#{ @type }\" @ui_type=\"#{ @ui_type }\" @ui_version=\"#{ @ui_version }\">"
89
+ "#<#{ self.class }:0x#{ ( "%x" % ( object_id.to_i << 1 ) )[ 3 .. -1 ] } @id=#{ @id.inspect } @input=\"#{ @input }\" @type=\"#{ @type }\" @ui_type=\"#{ @ui_type }\" @ui_version=\"#{ @ui_version }\">"
90
90
 
91
91
  end
92
92
 
@@ -188,7 +188,7 @@ module MobyBase
188
188
  # TODO: document me
189
189
  def inspect
190
190
 
191
- "#<#{ self.class }:0x#{ ( "%x" % ( self.object_id.to_i << 1 ) )[ 3 .. -1 ] } @id=\"#{ @id }\" @name=\"#{ @name }\" @parent=#{ @parent.inspect } @sut=#{ @sut.inspect } @type=\"#{ @type }\" @x_path=\"#{ @x_path }\">"
191
+ "#<#{ self.class }:0x#{ ( "%x" % ( object_id.to_i << 1 ) )[ 3 .. -1 ] } @id=\"#{ @id }\" @name=\"#{ @name }\" @parent=#{ @parent.inspect } @sut=#{ @sut.inspect } @type=\"#{ @type }\" @x_path=\"#{ @x_path }\">"
192
192
 
193
193
  end
194
194
 
@@ -23,7 +23,10 @@ module TDriver
23
23
 
24
24
  # private methods and variables
25
25
  class << self
26
-
26
+
27
+ # include abstraction module
28
+ include TDriver::Abstraction::TestObjectAdapter
29
+
27
30
  private
28
31
 
29
32
  # TODO: document me
@@ -111,10 +111,10 @@ module MobyBehaviour
111
111
  :identification_directives => dynamic_attributes.default_values(
112
112
  :__timeout => timeout,
113
113
  :__retry_interval => retry_interval,
114
- :__refresh_arguments => self.kind_of?( MobyBase::SUT ) ? attributes : { :id => self.get_application_id },
115
- :__parent_application => self.sut? == true ? nil : @parent_application
114
+ :__refresh_arguments => kind_of?( MobyBase::SUT ) ? attributes : { :id => get_application_id },
115
+ :__parent_application => sut? == true ? nil : @parent_application
116
116
  ),
117
- :parent => self
117
+ :parent => self
118
118
  )
119
119
 
120
120
  rescue MobyBase::TestObjectNotFoundError