testability-driver 1.0.4 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (104) hide show
  1. data/bin/tdriver-devtools +0 -0
  2. data/config/sut_setup.rb +32 -0
  3. data/config/sut_teardown.rb +32 -0
  4. data/ext/extconf.rb +3 -1
  5. data/lib/tdriver-devtools/behaviour/old/xml/update +0 -0
  6. data/lib/tdriver-devtools/behaviour/xml/generate.rb +0 -0
  7. data/lib/tdriver-devtools/doc/update +0 -0
  8. data/lib/tdriver-devtools/doc/xslt/update +0 -0
  9. data/lib/tdriver-devtools/tdriver-devtools.rb +0 -0
  10. data/lib/tdriver-devtools/tests/feature_tests/output/application_closable_0x3f.feature +10 -0
  11. data/lib/tdriver-devtools/tests/feature_tests/output/application_close.feature +15 -0
  12. data/lib/tdriver-devtools/tests/feature_tests/output/application_environment.feature +10 -0
  13. data/lib/tdriver-devtools/tests/feature_tests/output/application_executable_name.feature +10 -0
  14. data/lib/tdriver-devtools/tests/feature_tests/output/application_uid.feature +10 -0
  15. data/lib/tdriver-devtools/tests/feature_tests/output/created.rid +1 -0
  16. data/lib/tdriver-devtools/tests/feature_tests/output/find_find.feature +15 -0
  17. data/lib/tdriver-devtools/tests/feature_tests/output/flash_behaviour_flash.feature +10 -0
  18. data/lib/tdriver-devtools/tests/feature_tests/output/flash_behaviour_flash_images.feature +15 -0
  19. data/lib/tdriver-devtools/tests/feature_tests/output/sut_application.feature +15 -0
  20. data/lib/tdriver-devtools/tests/feature_tests/output/sut_capture_screen.feature +10 -0
  21. data/lib/tdriver-devtools/tests/feature_tests/output/sut_child.feature +10 -0
  22. data/lib/tdriver-devtools/tests/feature_tests/output/sut_clear_verify_blocks.feature +10 -0
  23. data/lib/tdriver-devtools/tests/feature_tests/output/sut_connect.feature +10 -0
  24. data/lib/tdriver-devtools/tests/feature_tests/output/sut_controller_execution_order.feature +10 -0
  25. data/lib/tdriver-devtools/tests/feature_tests/output/sut_controller_execution_order_0x3d.feature +10 -0
  26. data/lib/tdriver-devtools/tests/feature_tests/output/sut_current_application_id.feature +15 -0
  27. data/lib/tdriver-devtools/tests/feature_tests/output/sut_disconnect.feature +10 -0
  28. data/lib/tdriver-devtools/tests/feature_tests/output/sut_dump_count.feature +15 -0
  29. data/lib/tdriver-devtools/tests/feature_tests/output/sut_freeze.feature +10 -0
  30. data/lib/tdriver-devtools/tests/feature_tests/output/sut_frozen.feature +10 -0
  31. data/lib/tdriver-devtools/tests/feature_tests/output/sut_get_application_id.feature +10 -0
  32. data/lib/tdriver-devtools/tests/feature_tests/output/sut_get_object.feature +10 -0
  33. data/lib/tdriver-devtools/tests/feature_tests/output/sut_get_operator_data.feature +10 -0
  34. data/lib/tdriver-devtools/tests/feature_tests/output/sut_get_ui_dump.feature +15 -0
  35. data/lib/tdriver-devtools/tests/feature_tests/output/sut_get_user_information.feature +10 -0
  36. data/lib/tdriver-devtools/tests/feature_tests/output/sut_input.feature +15 -0
  37. data/lib/tdriver-devtools/tests/feature_tests/output/sut_parameter.feature +15 -0
  38. data/lib/tdriver-devtools/tests/feature_tests/output/sut_press_key.feature +10 -0
  39. data/lib/tdriver-devtools/tests/feature_tests/output/sut_received_data.feature +10 -0
  40. data/lib/tdriver-devtools/tests/feature_tests/output/sut_refresh.feature +20 -0
  41. data/lib/tdriver-devtools/tests/feature_tests/output/sut_refresh_timeout.feature +15 -0
  42. data/lib/tdriver-devtools/tests/feature_tests/output/sut_refresh_tries.feature +15 -0
  43. data/lib/tdriver-devtools/tests/feature_tests/output/sut_refresh_ui_dump.feature +20 -0
  44. data/lib/tdriver-devtools/tests/feature_tests/output/sut_run.feature +10 -0
  45. data/lib/tdriver-devtools/tests/feature_tests/output/sut_sent_data.feature +10 -0
  46. data/lib/tdriver-devtools/tests/feature_tests/output/sut_state.feature +10 -0
  47. data/lib/tdriver-devtools/tests/feature_tests/output/sut_translate.feature +30 -0
  48. data/lib/tdriver-devtools/tests/feature_tests/output/sut_ui_type.feature +10 -0
  49. data/lib/tdriver-devtools/tests/feature_tests/output/sut_ui_version.feature +10 -0
  50. data/lib/tdriver-devtools/tests/feature_tests/output/sut_unfreeze.feature +10 -0
  51. data/lib/tdriver-devtools/tests/feature_tests/output/sut_update.feature +10 -0
  52. data/lib/tdriver-devtools/tests/feature_tests/output/sut_verify_always.feature +20 -0
  53. data/lib/tdriver-devtools/tests/feature_tests/output/sut_verify_blocks.feature +10 -0
  54. data/lib/tdriver-devtools/tests/feature_tests/output/sut_x_path.feature +10 -0
  55. data/lib/tdriver-devtools/tests/feature_tests/output/sut_xml_data.feature +10 -0
  56. data/lib/tdriver-devtools/tests/feature_tests/output/sut_xml_data_0x3d.feature +10 -0
  57. data/lib/tdriver-devtools/tests/feature_tests/output/sut_xml_data_crc.feature +10 -0
  58. data/lib/tdriver-devtools/tests/feature_tests/output/switchbox_behaviour_power_down.feature +10 -0
  59. data/lib/tdriver-devtools/tests/feature_tests/output/switchbox_behaviour_power_status.feature +10 -0
  60. data/lib/tdriver-devtools/tests/feature_tests/output/switchbox_behaviour_power_up.feature +10 -0
  61. data/lib/tdriver-devtools/tests/feature_tests/output/switchbox_behaviour_reset.feature +10 -0
  62. data/lib/tdriver-devtools/tests/feature_tests/output/verification_test_object_exists_0x3f.feature +15 -0
  63. data/lib/tdriver-devtools/tests/feature_tests/update +0 -0
  64. data/lib/tdriver/base/behaviour/behaviours/object_composition.rb +4 -4
  65. data/lib/tdriver/base/behaviour/factory.rb +8 -0
  66. data/lib/tdriver/base/sut/generic/behaviours/application.rb +24 -3
  67. data/lib/tdriver/base/sut/generic/behaviours/sut.rb +465 -354
  68. data/lib/tdriver/base/test_object/adapter.rb +2 -2
  69. data/lib/tdriver/base/test_object/behaviours/test_object.rb +22 -5
  70. data/lib/tdriver/base/test_object/cache.rb +1 -1
  71. data/lib/tdriver/base/test_object/factory.rb +23 -3
  72. data/lib/tdriver/env.rb +0 -0
  73. data/lib/tdriver/loader.rb +0 -0
  74. data/lib/tdriver/matti.rb +0 -0
  75. data/lib/tdriver/report/error_recovery/tdriver_error_recovery.rb +22 -24
  76. data/lib/tdriver/report/report.rb +8 -1
  77. data/lib/tdriver/report/report_api.rb +18 -0
  78. data/lib/tdriver/report/report_combine.rb +1 -1
  79. data/lib/tdriver/report/report_creator.rb +5 -1
  80. data/lib/tdriver/report/report_execution_statistics.rb +105 -78
  81. data/lib/tdriver/report/report_test_case_run.rb +2 -1
  82. data/lib/tdriver/report/report_test_run.rb +187 -116
  83. data/lib/tdriver/report/report_writer.rb +49 -29
  84. data/lib/tdriver/tdriver.rb +14 -3
  85. data/lib/tdriver/util/common/exception.rb +53 -0
  86. data/lib/tdriver/util/common/hash.rb +79 -23
  87. data/lib/tdriver/util/common/numeric.rb +26 -5
  88. data/lib/tdriver/util/common/object.rb +44 -15
  89. data/lib/tdriver/util/common/string.rb +4 -1
  90. data/lib/tdriver/util/filters/dynamic_attributes.rb +2 -1
  91. data/lib/tdriver/util/keymap/keymap.rb +81 -0
  92. data/lib/tdriver/util/loader.rb +4 -1
  93. data/lib/tdriver/util/logger/logger.rb +17 -9
  94. data/lib/tdriver/util/other/config.rb +0 -0
  95. data/lib/tdriver/util/parameter/error.rb +3 -0
  96. data/lib/tdriver/util/parameter/loader.rb +6 -1
  97. data/lib/tdriver/util/parameter/parameter.rb +87 -14
  98. data/lib/tdriver/util/parameter/parameter_new.rb +869 -0
  99. data/lib/tdriver/util/parameter/parameter_template.rb +2 -2
  100. data/lib/tdriver/util/parameter/parameter_user_api.rb +27 -3
  101. data/lib/tdriver/util/parameter/parameter_xml.rb +36 -38
  102. data/lib/tdriver/version.rb +1 -1
  103. data/xml/templates/generic.xml +4 -10
  104. metadata +196 -138
@@ -1,20 +1,20 @@
1
1
  ############################################################################
2
- ##
3
- ## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
4
- ## All rights reserved.
5
- ## Contact: Nokia Corporation (testabilitydriver@nokia.com)
6
- ##
7
- ## This file is part of Testability Driver.
8
- ##
9
- ## If you have questions regarding the use of this file, please contact
10
- ## Nokia at testabilitydriver@nokia.com .
11
- ##
12
- ## This library is free software; you can redistribute it and/or
13
- ## modify it under the terms of the GNU Lesser General Public
14
- ## License version 2.1 as published by the Free Software Foundation
15
- ## and appearing in the file LICENSE.LGPL included in the packaging
16
- ## of this file.
17
- ##
2
+ ##
3
+ ## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
4
+ ## All rights reserved.
5
+ ## Contact: Nokia Corporation (testabilitydriver@nokia.com)
6
+ ##
7
+ ## This file is part of Testability Driver.
8
+ ##
9
+ ## If you have questions regarding the use of this file, please contact
10
+ ## Nokia at testabilitydriver@nokia.com .
11
+ ##
12
+ ## This library is free software; you can redistribute it and/or
13
+ ## modify it under the terms of the GNU Lesser General Public
14
+ ## License version 2.1 as published by the Free Software Foundation
15
+ ## and appearing in the file LICENSE.LGPL included in the packaging
16
+ ## of this file.
17
+ ##
18
18
  ############################################################################
19
19
 
20
20
  module MobyBehaviour
@@ -47,24 +47,24 @@ module MobyBehaviour
47
47
  # == nodoc
48
48
  attr_accessor(
49
49
 
50
- :dump_count, # number of UI dump requests done to current SUT
51
- :current_application_id, # id of the current appication if set
52
- :input, # the input method used for interacting with this sut as a symbol, eg. :key or :touch.
53
- :refresh_tries, # number of retries for ui dump on error case
54
- :refresh_timeout # timeout between timeout retry
50
+ :dump_count, # number of UI dump requests done to current SUT
51
+ :current_application_id, # id of the current appication if set
52
+ :input, # the input method used for interacting with this sut as a symbol, eg. :key or :touch.
53
+ :refresh_tries, # number of retries for ui dump on error case
54
+ :refresh_timeout # timeout between timeout retry
55
55
 
56
56
  )
57
57
 
58
58
  # == nodoc
59
59
  attr_reader(
60
60
 
61
- :xml_data, # sut xml_data
62
- :x_path, # x_path pattern for xml_data
63
- :ui_type, # type of the UI used on the sut, ie. s60, qt, windows
64
- :ui_version, # version of the ui used on the sut, ie 3.2.3
65
- :frozen, # flag that tells if the ui dump getting is disabled
66
- :xml_data_crc, # crc of the previous ui state message
67
- :verify_blocks # verify blocks
61
+ :xml_data, # sut xml_data
62
+ :x_path, # x_path pattern for xml_data
63
+ :ui_type, # type of the UI used on the sut, ie. s60, qt, windows
64
+ :ui_version, # version of the ui used on the sut, ie 3.2.3
65
+ :frozen, # flag that tells if the ui dump getting is disabled
66
+ :xml_data_crc, # crc of the previous ui state message
67
+ :verify_blocks # verify blocks
68
68
 
69
69
  )
70
70
 
@@ -108,7 +108,7 @@ module MobyBehaviour
108
108
  # == examples
109
109
  # @sut.disconnect
110
110
  def received_data
111
-
111
+
112
112
  @_sutController.received_bytes
113
113
 
114
114
  end
@@ -122,7 +122,7 @@ module MobyBehaviour
122
122
  # == examples
123
123
  # @sut.sent_data
124
124
  def sent_data
125
-
125
+
126
126
  @_sutController.sent_bytes
127
127
 
128
128
  end
@@ -130,7 +130,7 @@ module MobyBehaviour
130
130
  # == description
131
131
  # Function to disable taking UI dumps from target for a moment. This method might be deprecated in future release.\n
132
132
  # \n
133
- # [b]NOTE:[/b] Remember to enable ui dumps again using unfreeze!
133
+ # [b]NOTE:[/b] Remember to enable ui dumps again using unfreeze!
134
134
  # == returns
135
135
  # NilClass
136
136
  # description: -
@@ -171,21 +171,21 @@ module MobyBehaviour
171
171
  warn("warning: SUT##{ __method__ } is not supported when use_find_objects optimization is enabled")
172
172
 
173
173
  else
174
-
174
+
175
175
  @frozen = false
176
176
 
177
177
  end
178
178
  =end
179
179
 
180
180
  @frozen = false
181
-
181
+
182
182
  nil
183
183
 
184
184
  end
185
185
 
186
186
  # == nodoc
187
187
  # == description
188
- # Force to use user defined ui state (e.g. for debugging purposes). Freezes the SUT xml_data, until unfreezed or set to nil.
188
+ # Force to use user defined ui state (e.g. for debugging purposes). Freezes the SUT xml_data, until unfreezed or set to nil.
189
189
  #
190
190
  # == arguments
191
191
  # xml
@@ -236,7 +236,7 @@ module MobyBehaviour
236
236
  end
237
237
 
238
238
 
239
- # TODO: merge TestObject#child and SUT#child
239
+ # TODO: merge TestObject#child and SUT#child
240
240
  # == description
241
241
  # Creates a child test object from this SUT. SUT object will be associated as child test objects parent.\n
242
242
  #
@@ -261,22 +261,22 @@ module MobyBehaviour
261
261
  #
262
262
  # NOTICE: Please do not add anything unnessecery to this method, it might cause a major performance impact
263
263
  #
264
-
264
+
265
265
  # verify attributes argument format
266
266
  attributes.check_type( Hash, "Wrong argument type $1 for attributes (expected $2)" )
267
-
267
+
268
268
  # store original hash
269
269
  creation_hash = attributes.clone
270
270
 
271
271
  identification_directives = creation_hash.strip_dynamic_attributes!
272
272
 
273
- # raise exception if wrong value type given for ;__logging
274
- identification_directives[ :__logging ].check_type(
275
-
276
- [ TrueClass, FalseClass ],
277
-
273
+ # raise exception if wrong value type given for ;__logging
274
+ identification_directives[ :__logging ].check_type(
275
+
276
+ [ TrueClass, FalseClass ],
277
+
278
278
  "Wrong value type $1 for :__logging test object creation directive (expected $2)"
279
-
279
+
280
280
  ) if identification_directives.has_key?( :__logging )
281
281
 
282
282
  # disable logging if requested, remove pair from creation_hash
@@ -289,10 +289,10 @@ module MobyBehaviour
289
289
 
290
290
  # current object as parent, can be either TestObject or SUT
291
291
  :parent => self,
292
-
292
+
293
293
  # test object identification hash
294
294
  :object_attributes_hash => creation_hash,
295
-
295
+
296
296
  :identification_directives => identification_directives
297
297
 
298
298
  )
@@ -327,6 +327,101 @@ module MobyBehaviour
327
327
 
328
328
  end
329
329
 
330
+
331
+ # == description
332
+ # Method for executing sut specific setup method
333
+ # == returns
334
+ # Result
335
+ # description: -
336
+ # example: -
337
+ # == exceptions
338
+ # BehaviourError
339
+ # description: If the implementation is missing for the method
340
+ def setup
341
+
342
+ if self.parameter[ :sut_setup, nil ] || self.parameter[ :setup, nil ]
343
+
344
+ if self.parameter[ :sut_setup, nil ]
345
+ require MobyUtil::FileHelper.expand_path(self.parameter[ :sut_setup ])
346
+
347
+ TDriver.logger.behaviour "PASS;sut.setup method found"
348
+
349
+ self.setup
350
+
351
+ TDriver.logger.behaviour "PASS;sut.setup executed"
352
+ end
353
+
354
+ if self.parameter[ :setup, nil ]
355
+ TDriver.logger.behaviour "PASS;sut.setup parameters found"
356
+ methods=self.parameter[ :setup ]
357
+ methods.each do |method|
358
+ m=method[0].to_s
359
+ args=method[1]
360
+ if args.to_s == ""
361
+ eval("self.#{m}")
362
+ else
363
+ eval("self.#{m}(:#{args.to_sym})")
364
+ end
365
+ end
366
+ TDriver.logger.behaviour "PASS;sut.setup parameter methods executed"
367
+ end
368
+
369
+ else
370
+ TDriver.logger.behaviour "FAIL;No methods or parameters found for sut.setup"
371
+
372
+ Kernel::raise MobyBase::BehaviourError.new("Setup", "Failed to load sut.setup method check the :sut_setup parameter")
373
+ end
374
+
375
+
376
+
377
+ end
378
+
379
+ # == description
380
+ # Method for executing sut specific teardown method
381
+ # == returns
382
+ # Result
383
+ # description: -
384
+ # example: -
385
+ # == exceptions
386
+ # BehaviourError
387
+ # description: If the implementation is missing for the method
388
+ def teardown
389
+
390
+ if self.parameter[ :sut_teardown, nil ] || self.parameter[ :teardown, nil ]
391
+
392
+ if self.parameter[ :sut_teardown, nil ]
393
+ require MobyUtil::FileHelper.expand_path(self.parameter[ :sut_teardown ])
394
+
395
+ TDriver.logger.behaviour "PASS;sut.teardown method found"
396
+
397
+ self.teardown
398
+
399
+ TDriver.logger.behaviour "PASS;sut.teardown executed"
400
+ end
401
+
402
+ if self.parameter[ :teardown, nil ]
403
+ TDriver.logger.behaviour "PASS;sut.teardown parameters found"
404
+ methods=self.parameter[ :teardown ]
405
+ methods.each do |method|
406
+ m=method[0].to_s
407
+ args=method[1]
408
+ if args.to_s == ""
409
+ eval("self.#{m}")
410
+ else
411
+ eval("self.#{m}(:#{args.to_sym})")
412
+ end
413
+ end
414
+ TDriver.logger.behaviour "PASS;sut.teardown parameter methods executed"
415
+ end
416
+
417
+ else
418
+ TDriver.logger.behaviour "FAIL;No method or parameters found for sut.teardown"
419
+
420
+ Kernel::raise MobyBase::BehaviourError.new("Teardown", "Failed to load sut.teardown method check the :sut_teardown parameter")
421
+ end
422
+
423
+ end
424
+
330
425
  # == description
331
426
  # Returns a StateObject containing the current state of this test object as XML.
332
427
  # The state object is static and thus is not refreshed or synchronized etc.
@@ -369,7 +464,7 @@ module MobyBehaviour
369
464
  def application( attributes = {} )
370
465
 
371
466
  begin
372
-
467
+
373
468
  attributes.check_type( Hash, "Wrong argument type $1 for attributes (expected $2)" )
374
469
 
375
470
  attributes[ :type ] = 'application'
@@ -378,16 +473,16 @@ module MobyBehaviour
378
473
 
379
474
  @current_application_id = nil if attributes[ :id ].nil?
380
475
 
381
- # create test object and return it as result
476
+ # create test object and return it as result
382
477
  test_object = child( attributes )
383
478
 
384
479
  # store parent application to test object
385
480
  test_object.instance_variable_set( :@parent_application, test_object )
386
481
 
387
482
  test_object
388
-
483
+
389
484
  rescue
390
-
485
+
391
486
  TDriver.logger.behaviour(
392
487
  "FAIL;Failed to find application.;#{ id.to_s };sut;{};application;#{ attributes.kind_of?( Hash ) ? attributes.inspect : attributes.class.to_s }"
393
488
  )
@@ -396,9 +491,9 @@ module MobyBehaviour
396
491
  Kernel::raise $!
397
492
 
398
493
  ensure
399
-
494
+
400
495
  TDriver.logger.behaviour "PASS;Application found.;#{ id.to_s };sut;{};application;#{ attributes.inspect }" if $!.nil?
401
-
496
+
402
497
  end
403
498
 
404
499
  end
@@ -409,7 +504,7 @@ module MobyBehaviour
409
504
  # == arguments
410
505
  # arguments
411
506
  # Hash
412
- # description:
507
+ # description:
413
508
  # Options to be used for screen capture. See [link="#capture_options_table"]Options table[/link] for valid keys
414
509
  # example: ( :filename => "output.png" )
415
510
  #
@@ -422,7 +517,7 @@ module MobyBehaviour
422
517
  # == returns
423
518
  # NilClass
424
519
  # description: -
425
- # example: -
520
+ # example: -
426
521
  #
427
522
  # == exceptions
428
523
  # TypeError
@@ -434,9 +529,9 @@ module MobyBehaviour
434
529
  # ArgumentError
435
530
  # description: Wrong argument type %s for output filename (expected String)
436
531
  #
437
- # ArgumentError
532
+ # ArgumentError
438
533
  # description: Output filename must not be empty string
439
- #
534
+ #
440
535
  def capture_screen( arguments )
441
536
 
442
537
  begin
@@ -462,13 +557,13 @@ module MobyBehaviour
462
557
  command.redraw = arguments[ :Redraw ] if arguments[ :Redraw ]
463
558
 
464
559
  # execute command and write binary to file
465
- File.open( File.expand_path( arguments[ :filename ] ), 'wb:binary' ){ | file |
560
+ File.open( File.expand_path( arguments[ :filename ] ), 'wb:binary' ){ | file |
466
561
 
467
- file << execute_command( command )
562
+ file << execute_command( command )
468
563
 
469
564
  }
470
565
 
471
- rescue
566
+ rescue
472
567
 
473
568
  TDriver.logger.behaviour "FAIL;Failed to capture screen.;#{ id.to_s };sut;{};capture_screen;#{ arguments.kind_of?( Hash ) ? arguments.inspect : arguments.class.to_s }"
474
569
 
@@ -501,11 +596,11 @@ module MobyBehaviour
501
596
  # |:name|String|Executable name of the application|{ :name => 'calculator' }|
502
597
  # |:arguments|String|Comma separated list of arguments passed to the application when it is started|{ :arguments => '--nogui,-v' }|
503
598
  # |:sleep_time|Integer|Number of seconds to sleep immediately after launching the process|{ :sleep_time => 10 }|
504
- # |:start_command|String|When set, the run method will execute this command and expect the application provided by the :name key to be launched eventually. Note that applications launched this way can't be sent a Kill message and its start up events and signals may not be recorded.|{ :start_command => 'start_app.bat',:name => 'calculator' }|
505
- # |:try_attach|Boolean|If set to true, run will attempt to attach to an existing application with the given name or id. If not found the application will be launched as normal. If more than 1 are found then an exception is thrown|{:try_attach => true,:name => 'calculator'}|
599
+ # |:start_command|String|When set, the run method will execute this command and expect the application provided by the :name key to be launched. Note that applications launched this way can't be sent a Kill message and its start up events and signals may not be recorded.|{ :start_command => 'start_app_batch',:name => 'calculator' }|
600
+ # |:try_attach|Boolean|If set to true, run will attempt to attach to an existing application with the given name or id. If not found the application will be launched as normal. If more than 1 are found then an exception is thrown|{:try_attach => true, :name => 'calculator'}|
506
601
  # |:environment|String|Environment variables you want to pass to started process, passed as key value pairs separated by '=' and pairs separated by spaces |{ :environment => 'LC_ALL=en SPECIAL_VAR=value' }|
507
602
  # |:events_to_listen|String|List of events you want to start listening to when application starts, passed as comma separated string. You can retrieve a list of events fired by a test object by first enabling event listening and then using the get_events method. See methods enable_events, get_events and disable_events |{ :events_to_listen => 'Paint,Show' }|
508
- # |:signals_to_listen|String|List of signals you want to start listening to when application starts, passed as comma separated string. Check your application class what signals it can emit, or you can use the 'signal' fixture's 'list_signal' method to retrieve an xml string listing all the signals the object can emit. E.g. xml = @object.fixture('signal', 'list_signals')|{ :signals_to_listen => 'applicationReady()' }|
603
+ # |:signals_to_listen|String|List of signals you want to start listening to when application starts, passed as comma separated string. Check your application class what signals it can emit, or you can use the 'signal' fixture's 'list_signal' method to retrieve an xml string listing all the signals the object can emit. E.g. xml = @object.fixture('signal', 'list_signals')|{ :signals_to_listen => 'applicationReady()' }|
509
604
  #
510
605
  # == returns
511
606
  # TestObject
@@ -515,7 +610,7 @@ module MobyBehaviour
515
610
  # == exceptions
516
611
  # TypeError
517
612
  # description: Wrong argument type %s for run method (expected Hash)
518
- #
613
+ #
519
614
  # ArgumentError
520
615
  # description: Required key :uid or :name not found from argument hash
521
616
  #
@@ -539,7 +634,8 @@ module MobyBehaviour
539
634
  # raise exception if :uid or :name not found from hash
540
635
  target.require_key( [ :uid, :name ], "Required key :uid or :name not found from argument hash" )
541
636
 
542
- sleep_time = target[ :sleep_after_launch ].to_i
637
+ # due to bug #1488
638
+ sleep_time = ( target[ :sleep_after_launch ] || target[ :sleep_time ] ).to_i
543
639
 
544
640
  Kernel::raise ArgumentError, "Sleep time need to be >= 0" unless sleep_time >= 0
545
641
 
@@ -600,7 +696,7 @@ module MobyBehaviour
600
696
  )
601
697
 
602
698
  end
603
-
699
+
604
700
  # do not remove this, unless qttas server & plugin handles the syncronization between plugin registration & first ui state request
605
701
  # first ui dump is requested too early and target/server seems not be ready...
606
702
  #sleep 0.100
@@ -616,6 +712,8 @@ module MobyBehaviour
616
712
  error_details = target[ :name ].nil? ? "" : "name: " << target[ :name ].to_s
617
713
  error_details << ( error_details.empty? ? "" : ", ") << "id: " << target[ :uid ].to_s if !target[ :uid ].nil?
618
714
 
715
+ app_name=target[ :name ].nil? ? "" : "name: " << target[ :name ].to_s
716
+
619
717
  if( !expected_attributes[ :FullName ].nil? )
620
718
 
621
719
  if( expected_attributes[ :FullName ].include?('/') )
@@ -639,42 +737,55 @@ module MobyBehaviour
639
737
  end
640
738
 
641
739
  expected_attributes.delete( :FullName )
740
+ expected_attributes.delete( :name )
642
741
 
643
742
  end
644
743
 
645
744
  begin
745
+ timeout_time=$parameters[ @id ][ :application_synchronization_timeout, '5' ].to_f
746
+ retryinterval=$parameters[ @id ][ :application_synchronization_retry_interval, '0.5' ].to_f
646
747
 
647
- # verify that application is launched and application test object is found from xml
648
- self.wait_child(
748
+ MobyUtil::Retryable.until(
749
+ :timeout => timeout_time,
750
+ :interval => retryinterval,
751
+ :exception => MobyBase::ApplicationNotAvailableError) {
752
+ # verify that application is launched and application test object is found from xml
753
+ expected_attributes.delete( :name )
649
754
 
650
- # attributes to identify application object
651
- expected_attributes,
755
+ self.wait_child(
652
756
 
653
- # timeout to for application synchronization
654
- $parameters[ @id ][ :application_synchronization_timeout, '5' ].to_f,
757
+ # attributes to identify application object
758
+ expected_attributes,
655
759
 
656
- # wait retry interval and try again if application was not found
657
- $parameters[ @id ][ :application_synchronization_retry_interval, '0.5' ].to_f
760
+ # timeout to for application synchronization
761
+ timeout_time,
658
762
 
659
- )
763
+ # wait retry interval and try again if application was not found
764
+ retryinterval
765
+
766
+ )
767
+
768
+ expected_attributes[ :name ] = app_name
769
+ # retrieve application object element from sut.xml_data
770
+
771
+ @@matches, unused_rule = TDriver::TestObjectAdapter.get_objects( xml_data, expected_attributes, true )
660
772
 
661
- # retrieve application object element from sut.xml_data
662
- matches, unused_rule = TDriver::TestObjectAdapter.get_objects( xml_data, expected_attributes, true )
773
+ # raise exception if application element was not found; this shouldn't ever happen?
774
+ raise MobyBase::ApplicationNotAvailableError if @@matches.count == 0
663
775
 
664
- # raise exception if application element was not found; this shouldn't ever happen?
665
- #raise MobyBase::TestObjectNotFoundError if matches.count == 0
776
+ }
666
777
 
667
778
  # create application test object
668
- foreground_app = @test_object_factory.make_test_object(
669
-
779
+ foreground_app = @test_object_factory.make_test_object(
780
+
670
781
  :parent => self,
671
-
782
+
672
783
  :parent_application => nil,
673
-
784
+
674
785
  :object_attributes_hash => expected_attributes,
675
-
676
- :xml_object => matches.first
677
-
786
+
787
+ :xml_object => @@matches.first
788
+
678
789
  )
679
790
 
680
791
  # store application reference to test application; this will be passed to it's child test object(s)
@@ -693,7 +804,7 @@ module MobyBehaviour
693
804
 
694
805
  end
695
806
 
696
- # raise behaviour error if any exception is raised
807
+ # raise behaviour error if any exception is raised
697
808
  rescue # Exception => e
698
809
 
699
810
  TDriver.logger.behaviour "FAIL;Failed to launch application.;#{ id.to_s };sut;{};run;#{ target.kind_of?( Hash ) ? target.inspect : target.class.to_s }"
@@ -740,7 +851,7 @@ module MobyBehaviour
740
851
  # MobyCommand::KeySequence
741
852
  # description: a KeySequence object of key symbols
742
853
  # example: @sut.press_key( MobyCommand::KeySequence.new(:kDown).times!(3).append!(:kLeft) )
743
- #
854
+ #
744
855
  # == returns
745
856
  # NilClass
746
857
  # description: -
@@ -762,7 +873,7 @@ module MobyBehaviour
762
873
 
763
874
  execute_command( sequence )
764
875
 
765
- rescue
876
+ rescue
766
877
 
767
878
  TDriver.logger.behaviour "FAIL;Failed to press key(s).;#{id.to_s};sut;{};press_key;#{ value }"
768
879
 
@@ -775,7 +886,7 @@ module MobyBehaviour
775
886
  nil
776
887
 
777
888
  end
778
-
889
+
779
890
  # == description
780
891
  # Wrapper function to access sut specific parameters.
781
892
  # Parameters for each sut are stored in the parameters xml file under group tag with name attribute matching the SUT id
@@ -824,108 +935,108 @@ module MobyBehaviour
824
935
 
825
936
  end
826
937
 
827
- # == description
828
- # Wrapper function to return translated string for this SUT to read the values from localisation database.
829
- #
830
- # == arguments
831
- # logical_name
832
- # String
833
- # description: Logical name (LNAME) of the item to be translated. If prefix for User Information or Operator Data are used then the appropiate retrieve methods will be called
834
- # example: "txt_button_ok"
835
- # Symbol
836
- # description: Symbol form of the logical name (LNAME) of the item to be translated.
837
- # example: :txt_button_ok
838
- #
839
- # file_name
840
- # String
841
- # description: Optional FNAME search argument for the translation
842
- # example: "agenda"
843
- # default: nil
844
- #
845
- # plurality
846
- # String
847
- # description: Optional PLURALITY search argument for the translation
848
- # example: "a" or "singular"
849
- # default: nil
850
- #
851
- # numerus
852
- # String
853
- # description: Optional numeral replacement of an '%Ln | %1' tag on the translated string
854
- # example: "1"
855
- # default: nil
856
- # Integer
857
- # description: Optional numeral replacement of an '%Ln | %1' tag on the translated string
858
- # example: 1
859
- # Array
860
- # description: Optional numeral replacements for multiple '%L1 | %1, %L2 | %2, ...' tags on the translated string
861
- # example: [ 3, 2]
862
- #
863
- # lengthvariant
864
- # String
865
- # description: Optional argument to specify a length variant with its priority number (1-9). Translations with no length variants are considered a variant of priority "1". The default 'nil' value will retrieve all variants available.
866
- # example: "1"
867
- # default: nil
868
- #
869
- # == returns
870
- # String
871
- # description: Translation matching the logical_name
872
- # example: "Ok"
873
- # Array
874
- # description: If multiple translations have been found for the search conditions an Array with all Strings be returned
875
- # example: ["Ok", "OK"]
876
- #
877
- # == exceptions
878
- # LanguageNotFoundError
879
- # description: In case language is not found
880
- #
881
- # LogicalNameNotFoundError
882
- # description: In case no logical name is not found for current language
883
- #
884
- # SqlError
885
- # description: In case there are problems with the database connectivity
886
- #
887
- def translate( logical_name, file_name = nil, plurality = nil, numerus = nil, lengthvariant = nil )
938
+ # == description
939
+ # Wrapper function to return translated string for this SUT to read the values from localisation database.
940
+ #
941
+ # == arguments
942
+ # logical_name
943
+ # String
944
+ # description: Logical name (LNAME) of the item to be translated. If prefix for User Information or Operator Data are used then the appropiate retrieve methods will be called
945
+ # example: "txt_button_ok"
946
+ # Symbol
947
+ # description: Symbol form of the logical name (LNAME) of the item to be translated.
948
+ # example: :txt_button_ok
949
+ #
950
+ # file_name
951
+ # String
952
+ # description: Optional FNAME search argument for the translation
953
+ # example: "agenda"
954
+ # default: nil
955
+ #
956
+ # plurality
957
+ # String
958
+ # description: Optional PLURALITY search argument for the translation
959
+ # example: "a" or "singular"
960
+ # default: nil
961
+ #
962
+ # numerus
963
+ # String
964
+ # description: Optional numeral replacement of an '%Ln | %1' tag on the translated string
965
+ # example: "1"
966
+ # default: nil
967
+ # Integer
968
+ # description: Optional numeral replacement of an '%Ln | %1' tag on the translated string
969
+ # example: 1
970
+ # Array
971
+ # description: Optional numeral replacements for multiple '%L1 | %1, %L2 | %2, ...' tags on the translated string
972
+ # example: [ 3, 2]
973
+ #
974
+ # lengthvariant
975
+ # String
976
+ # description: Optional argument to specify a length variant with its priority number (1-9). Translations with no length variants are considered a variant of priority "1". The default 'nil' value will retrieve all variants available.
977
+ # example: "1"
978
+ # default: nil
979
+ #
980
+ # == returns
981
+ # String
982
+ # description: Translation matching the logical_name
983
+ # example: "Ok"
984
+ # Array
985
+ # description: If multiple translations have been found for the search conditions an Array with all Strings be returned
986
+ # example: ["Ok", "OK"]
987
+ #
988
+ # == exceptions
989
+ # LanguageNotFoundError
990
+ # description: In case language is not found
991
+ #
992
+ # LogicalNameNotFoundError
993
+ # description: In case no logical name is not found for current language
994
+ #
995
+ # SqlError
996
+ # description: In case there are problems with the database connectivity
997
+ #
998
+ def translate( logical_name, file_name = nil, plurality = nil, numerus = nil, lengthvariant = nil )
999
+
1000
+ Kernel::raise LogicalNameNotFoundError, "Logical name is nil" if logical_name.nil?
1001
+
1002
+ translation_type = "localisation"
888
1003
 
889
- Kernel::raise LogicalNameNotFoundError, "Logical name is nil" if logical_name.nil?
1004
+ # Check for User Information prefix( "uif_...")
1005
+ $parameters[ :user_data_logical_string_identifier, 'uif_' ].split('|').each do |identifier|
890
1006
 
891
- translation_type = "localisation"
892
-
893
- # Check for User Information prefix( "uif_...")
894
- $parameters[ :user_data_logical_string_identifier, 'uif_' ].split('|').each do |identifier|
1007
+ if logical_name.to_s.index(identifier)==0
895
1008
 
896
- if logical_name.to_s.index(identifier)==0
1009
+ translation_type="user_data"
897
1010
 
898
- translation_type="user_data"
1011
+ end
899
1012
 
900
1013
  end
901
1014
 
902
- end
903
-
904
- # Check for Operator Data prefix( "operator_...")
905
- $parameters[ :operator_data_logical_string_identifier, 'operator_' ].split('|').each do |identifier|
1015
+ # Check for Operator Data prefix( "operator_...")
1016
+ $parameters[ :operator_data_logical_string_identifier, 'operator_' ].split('|').each do |identifier|
906
1017
 
907
- if logical_name.to_s.index(identifier)==0
1018
+ if logical_name.to_s.index(identifier)==0
908
1019
 
909
- translation_type="operator_data"
1020
+ translation_type="operator_data"
1021
+
1022
+ end
910
1023
 
911
1024
  end
912
1025
 
913
- end
914
-
915
- case translation_type
1026
+ case translation_type
916
1027
 
917
1028
  when "user_data"
918
1029
 
919
1030
  get_user_information( logical_name )
920
-
1031
+
921
1032
  when "operator_data"
922
1033
 
923
1034
  get_operator_data( logical_name )
924
-
1035
+
925
1036
  when "localisation"
926
1037
 
927
1038
  language=nil
928
-
1039
+
929
1040
  if ( $parameters[ self.id ][:read_lang_from_app]=='true')
930
1041
 
931
1042
  #read localeName app
@@ -939,17 +1050,17 @@ module MobyBehaviour
939
1050
  language=$parameters[ self.id ][ :language ]
940
1051
 
941
1052
  end
942
-
1053
+
943
1054
  Kernel::raise LanguageNotFoundError, "Language cannot be determind to perform translation" if ( language.nil? || language.empty? )
944
1055
 
945
- translation = MobyUtil::Localisation.translation(
946
- logical_name,
1056
+ translation = MobyUtil::Localisation.translation(
1057
+ logical_name,
947
1058
  language,
948
- $parameters[ self.id ][ :localisation_server_database_tablename ],
949
- file_name,
950
- plurality,
951
- lengthvariant
952
- )
1059
+ $parameters[ self.id ][ :localisation_server_database_tablename ],
1060
+ file_name,
1061
+ plurality,
1062
+ lengthvariant
1063
+ )
953
1064
 
954
1065
  if translation.kind_of? String and !numerus.nil?
955
1066
 
@@ -959,7 +1070,7 @@ module MobyBehaviour
959
1070
 
960
1071
  elsif numerus.kind_of? String or numerus.kind_of? Integer
961
1072
 
962
- translation.gsub!(/%(Ln|1)/){|s| numerus.to_s}
1073
+ translation.gsub!(/%(Ln|1)/){|s| numerus.to_s}
963
1074
 
964
1075
  end
965
1076
 
@@ -973,7 +1084,7 @@ module MobyBehaviour
973
1084
 
974
1085
  elsif numerus.kind_of? String or numerus.kind_of? Integer
975
1086
 
976
- trans.gsub!(/%(Ln|1)/){|s| numerus.to_s}
1087
+ trans.gsub!(/%(Ln|1)/){|s| numerus.to_s}
977
1088
 
978
1089
  end
979
1090
 
@@ -983,134 +1094,134 @@ module MobyBehaviour
983
1094
 
984
1095
  translation
985
1096
 
1097
+ end
1098
+
986
1099
  end
987
1100
 
988
- end
989
-
990
- # == nodoc
991
- # == description
992
- # Translates all symbol values in hash using SUT's translate method.
993
- #
994
- # == arguments
995
- # hash
996
- # Hash
997
- # description: containing key and value pairs. The hash will get modified if symbols are found from values
998
- # example: {:text=>:translate_me}
999
- #
1000
- # == returns
1001
- # Hash
1002
- # description: Translated hash
1003
- # example: {:text=>'translated_text'}
1004
- # == exceptions
1005
- # LanguageNotFoundError
1006
- # description: In case of language is not found
1007
- #
1008
- # LogicalNameNotFoundError
1009
- # description: In case of logical name is not found for current language
1010
- #
1011
- # MySqlConnectError
1012
- # description: In case problems with the db connectivity
1013
- #
1014
- def translate_values!( hash, file_name = nil, plurality = nil, numerus = nil, lengthvariant = nil )
1101
+ # == nodoc
1102
+ # == description
1103
+ # Translates all symbol values in hash using SUT's translate method.
1104
+ #
1105
+ # == arguments
1106
+ # hash
1107
+ # Hash
1108
+ # description: containing key and value pairs. The hash will get modified if symbols are found from values
1109
+ # example: {:text=>:translate_me}
1110
+ #
1111
+ # == returns
1112
+ # Hash
1113
+ # description: Translated hash
1114
+ # example: {:text=>'translated_text'}
1115
+ # == exceptions
1116
+ # LanguageNotFoundError
1117
+ # description: In case of language is not found
1118
+ #
1119
+ # LogicalNameNotFoundError
1120
+ # description: In case of logical name is not found for current language
1121
+ #
1122
+ # MySqlConnectError
1123
+ # description: In case problems with the db connectivity
1124
+ #
1125
+ def translate_values!( hash, file_name = nil, plurality = nil, numerus = nil, lengthvariant = nil )
1015
1126
 
1016
- hash.each_pair do | _key, _value |
1127
+ hash.each_pair do | _key, _value |
1017
1128
 
1018
- next if [ :name, :type, :id ].include?( _key )
1129
+ next if [ :name, :type, :id ].include?( _key )
1019
1130
 
1020
- hash[ _key ] = translate( _value, file_name, plurality, numerus, lengthvariant ) if _value.kind_of?( Symbol )
1131
+ hash[ _key ] = translate( _value, file_name, plurality, numerus, lengthvariant ) if _value.kind_of?( Symbol )
1021
1132
 
1022
- end unless hash.nil?
1133
+ end unless hash.nil?
1023
1134
 
1024
- end
1025
-
1026
- # == description
1027
- # Wrapper function to retrieve user information for this SUT from the user information database.
1028
- #
1029
- # == arguments
1030
- # user_data_lname
1031
- # String
1032
- # description: Logical name (LNAME) of the user information item to be retrieved.
1033
- # example: "uif_first_name"
1034
- # Symbol
1035
- # description: Symbol form of the logical name (LNAME) of the user information item to be retrieved.
1036
- # example: :uif_first_name
1037
- #
1038
- # == returns
1039
- # String
1040
- # description: User data string
1041
- # example: "Ivan"
1042
- # Array
1043
- # description: Array of Strings when multiple user data strings found.
1044
- # example: ["Ivan", "Manolo"]
1045
- #
1046
- # == exceptions
1047
- # UserDataNotFoundError
1048
- # description: In case the desired user data is not found
1049
- #
1050
- # UserDataColumnNotFoundError
1051
- # description: In case the desired data column name to be used for the output is not found
1052
- #
1053
- # SqlError
1054
- # description: In case there are problems with the database connectivity
1055
- #
1056
- def get_user_information( user_data_lname )
1057
-
1058
- MobyUtil::UserData.retrieve(
1059
-
1060
- user_data_lname,
1061
-
1062
- # language
1063
- $parameters[ self.id ][ :language ],
1064
-
1065
- # table name
1066
- $parameters[ self.id ][ :user_data_server_database_tablename ]
1067
-
1068
- )
1135
+ end
1069
1136
 
1070
- end
1071
-
1072
- # == description
1073
- # Wrapper function to retrieve operator data for this SUT from the operator data database.
1074
- #
1075
- # == arguments
1076
- # operator_data_lname
1077
- # String
1078
- # description: Logical name (LNAME) of the operator data item to be retrieved.
1079
- # example: "operator_welcome_message"
1080
- # Symbol
1081
- # description: Symbol form of the logical name (LNAME) of the operator data item to be retrieved.
1082
- # example: :operator_welcome_message
1083
- #
1084
- # == returns
1085
- # String
1086
- # description: User data string
1087
- # example: "Welcome to Orange"
1088
- #
1089
- # == exceptions
1090
- # OperatorDataNotFoundError
1091
- # description: In case the desired operator data is not found
1092
- #
1093
- # OperatorDataColumnNotFoundError
1094
- # description: In case the desired data column name to be used for the output is not found
1095
- #
1096
- # SqlError
1097
- # description: In case there are problems with the database connectivity
1098
- #
1099
- def get_operator_data( operator_data_lname )
1137
+ # == description
1138
+ # Wrapper function to retrieve user information for this SUT from the user information database.
1139
+ #
1140
+ # == arguments
1141
+ # user_data_lname
1142
+ # String
1143
+ # description: Logical name (LNAME) of the user information item to be retrieved.
1144
+ # example: "uif_first_name"
1145
+ # Symbol
1146
+ # description: Symbol form of the logical name (LNAME) of the user information item to be retrieved.
1147
+ # example: :uif_first_name
1148
+ #
1149
+ # == returns
1150
+ # String
1151
+ # description: User data string
1152
+ # example: "Ivan"
1153
+ # Array
1154
+ # description: Array of Strings when multiple user data strings found.
1155
+ # example: ["Ivan", "Manolo"]
1156
+ #
1157
+ # == exceptions
1158
+ # UserDataNotFoundError
1159
+ # description: In case the desired user data is not found
1160
+ #
1161
+ # UserDataColumnNotFoundError
1162
+ # description: In case the desired data column name to be used for the output is not found
1163
+ #
1164
+ # SqlError
1165
+ # description: In case there are problems with the database connectivity
1166
+ #
1167
+ def get_user_information( user_data_lname )
1100
1168
 
1101
- MobyUtil::OperatorData.retrieve(
1169
+ MobyUtil::UserData.retrieve(
1102
1170
 
1103
- operator_data_lname,
1171
+ user_data_lname,
1104
1172
 
1105
- # operator
1106
- $parameters[ self.id ][ :operator_selected ],
1173
+ # language
1174
+ $parameters[ self.id ][ :language ],
1107
1175
 
1108
- # table name
1109
- $parameters[ self.id ][ :operator_data_server_database_tablename ]
1110
-
1111
- )
1176
+ # table name
1177
+ $parameters[ self.id ][ :user_data_server_database_tablename ]
1178
+
1179
+ )
1180
+
1181
+ end
1182
+
1183
+ # == description
1184
+ # Wrapper function to retrieve operator data for this SUT from the operator data database.
1185
+ #
1186
+ # == arguments
1187
+ # operator_data_lname
1188
+ # String
1189
+ # description: Logical name (LNAME) of the operator data item to be retrieved.
1190
+ # example: "operator_welcome_message"
1191
+ # Symbol
1192
+ # description: Symbol form of the logical name (LNAME) of the operator data item to be retrieved.
1193
+ # example: :operator_welcome_message
1194
+ #
1195
+ # == returns
1196
+ # String
1197
+ # description: User data string
1198
+ # example: "Welcome to Orange"
1199
+ #
1200
+ # == exceptions
1201
+ # OperatorDataNotFoundError
1202
+ # description: In case the desired operator data is not found
1203
+ #
1204
+ # OperatorDataColumnNotFoundError
1205
+ # description: In case the desired data column name to be used for the output is not found
1206
+ #
1207
+ # SqlError
1208
+ # description: In case there are problems with the database connectivity
1209
+ #
1210
+ def get_operator_data( operator_data_lname )
1211
+
1212
+ MobyUtil::OperatorData.retrieve(
1112
1213
 
1113
- end
1214
+ operator_data_lname,
1215
+
1216
+ # operator
1217
+ $parameters[ self.id ][ :operator_selected ],
1218
+
1219
+ # table name
1220
+ $parameters[ self.id ][ :operator_data_server_database_tablename ]
1221
+
1222
+ )
1223
+
1224
+ end
1114
1225
 
1115
1226
  # == nodoc
1116
1227
  # Function to update all children of current SUT
@@ -1125,11 +1236,11 @@ module MobyBehaviour
1125
1236
 
1126
1237
  unless @childs_updated
1127
1238
 
1128
- @child_object_cache.each_object{ | test_object |
1239
+ @child_object_cache.each_object{ | test_object |
1129
1240
 
1130
1241
  test_object.send( :update, @xml_data )
1131
1242
 
1132
- #test_object.update( @xml_data )
1243
+ #test_object.update( @xml_data )
1133
1244
 
1134
1245
  }
1135
1246
 
@@ -1138,10 +1249,10 @@ module MobyBehaviour
1138
1249
  @childs_updated = true
1139
1250
 
1140
1251
  end
1141
-
1252
+
1142
1253
  # == nodoc
1143
1254
  def refresh( refresh_args = {}, creation_attributes = {} )
1144
-
1255
+
1145
1256
  refresh_ui_dump( refresh_args, creation_attributes )
1146
1257
 
1147
1258
  # update childs only if ui state is new
@@ -1165,13 +1276,13 @@ module MobyBehaviour
1165
1276
  #
1166
1277
  # &block
1167
1278
  # Proc
1168
- # description: Code block to execute.
1279
+ # description: Code block to execute.
1169
1280
  # example: { @sut.xml_data.empty? == false }
1170
1281
  #
1171
1282
  # &block#sut
1172
1283
  # MobyBase::SUT
1173
- # description:
1174
- # Current SUT object is passed as block parameter. If the verify block is defined outside the scope of
1284
+ # description:
1285
+ # Current SUT object is passed as block parameter. If the verify block is defined outside the scope of
1175
1286
  # the current SUT (e.g. the SUT configuration file), this can be used to get a handle to the current SUT.
1176
1287
  # example: -
1177
1288
  #
@@ -1179,7 +1290,7 @@ module MobyBehaviour
1179
1290
  # NilClass
1180
1291
  # description: This method doesn't pass return value
1181
1292
  # example: -
1182
- #
1293
+ #
1183
1294
  # == exceptions
1184
1295
  # MobyBase::VerificationError
1185
1296
  # description: If verification failed
@@ -1207,35 +1318,35 @@ module MobyBehaviour
1207
1318
 
1208
1319
  # == nodoc
1209
1320
  def get_application_id
1210
-
1321
+
1211
1322
  # retrieve application object from sut.xml_data
1212
1323
  matches, unused_rule = TDriver::TestObjectAdapter.get_objects( xml_data, { :type => 'application' }, true )
1213
1324
 
1214
- # retrieve id attribute if application test object found
1325
+ # retrieve id attribute if application test object found
1215
1326
  if matches.count > 0
1216
1327
 
1217
1328
  # return id attribute value
1218
1329
  TDriver::TestObjectAdapter.test_object_element_attribute( matches.first, 'id' )
1219
-
1330
+
1220
1331
  else
1221
-
1332
+
1222
1333
  # application not found
1223
1334
  '-1'
1224
-
1335
+
1225
1336
  end
1226
1337
 
1227
1338
  end
1228
1339
 
1229
- private
1340
+ private
1230
1341
 
1231
1342
  # TODO: document me
1232
1343
  def update_childs
1233
-
1344
+
1234
1345
  # update childs only if ui state is new
1235
1346
  update if !@childs_updated
1236
-
1347
+
1237
1348
  end
1238
-
1349
+
1239
1350
  # == nodoc
1240
1351
  # Function asks for fresh xml ui data from the device and stores the result
1241
1352
  # == returns
@@ -1247,13 +1358,13 @@ module MobyBehaviour
1247
1358
  if !@frozen #&& ( @_previous_refresh.nil? || ( current_time - @_previous_refresh ).to_f >= @refresh_interval )
1248
1359
 
1249
1360
  use_find_objects = $parameters[ @id ][ :use_find_object, 'false' ] == 'true' and self.respond_to?( 'find_object' )
1250
-
1361
+
1251
1362
  refresh_arguments = refresh_args.clone
1252
1363
 
1253
1364
  MobyUtil::Retryable.while(
1254
1365
  :tries => @refresh_tries,
1255
1366
  :interval => @refresh_interval,
1256
- :unless => [ MobyBase::ControllerNotFoundError, MobyBase::CommandNotFoundError, MobyBase::ApplicationNotAvailableError ]
1367
+ :unless => [ MobyBase::ControllerNotFoundError, MobyBase::CommandNotFoundError, MobyBase::ApplicationNotAvailableError ]
1257
1368
  ) {
1258
1369
 
1259
1370
  #use find_object if set on and the method exists
@@ -1263,44 +1374,44 @@ module MobyBehaviour
1263
1374
 
1264
1375
  else
1265
1376
 
1266
- app_command = MobyCommand::Application.new(
1267
- :State,
1377
+ app_command = MobyCommand::Application.new(
1378
+ :State,
1268
1379
  refresh_args[ :FullName ] || refresh_args[ :name ],
1269
- refresh_args[ :id ],
1270
- self
1271
- )
1380
+ refresh_args[ :id ],
1381
+ self
1382
+ )
1272
1383
 
1273
1384
  # store in case needed
1274
1385
  app_command.refresh_args( refresh_args )
1275
1386
 
1276
1387
  new_xml_data, crc = execute_command( app_command )
1277
1388
 
1278
- end
1389
+ end
1279
1390
 
1280
1391
  @dump_count += 1
1281
1392
 
1282
1393
  @childs_updated = false
1283
-
1394
+
1284
1395
  @xml_data = MobyUtil::XML.parse_string( new_xml_data ).root
1285
1396
 
1286
1397
  @_previous_refresh = Time.now
1287
1398
 
1288
1399
  # remove timestamp from the beginning of tasMessage, parse if not same as previous ui state
1289
- #if ( xml_data_no_timestamp = new_xml_data.split( ">", 2 ).last ) != @last_xml_data
1400
+ #if ( xml_data_no_timestamp = new_xml_data.split( ">", 2 ).last ) != @last_xml_data
1290
1401
  # @xml_data = MobyUtil::XML.parse_string( new_xml_data ).root
1291
1402
  # @last_xml_data = xml_data_no_timestamp
1292
1403
  #end
1293
1404
 
1294
- #if ( @xml_data_crc == 0 || crc != @xml_data_crc || crc.nil? )
1405
+ #if ( @xml_data_crc == 0 || crc != @xml_data_crc || crc.nil? )
1295
1406
  # @xml_data, @xml_data_crc, @childs_updated = MobyUtil::XML.parse_string( new_xml_data ).root, crc, false
1296
1407
  #end
1297
1408
 
1298
- }
1409
+ }
1299
1410
 
1300
1411
  end
1301
1412
 
1302
1413
  fetch_references( @xml_data )
1303
-
1414
+
1304
1415
  end
1305
1416
 
1306
1417
  # TODO: document me
@@ -1337,7 +1448,7 @@ module MobyBehaviour
1337
1448
 
1338
1449
  # ref-ref parent does not know x coordinate, use the grandparent xys
1339
1450
  x_prev = x_abs.to_s unless x_abs.nil?
1340
- y_prev = y_abs.to_s unless y_abs.nil?
1451
+ y_prev = y_abs.to_s unless y_abs.nil?
1341
1452
 
1342
1453
  idx += 1
1343
1454
 
@@ -1346,33 +1457,33 @@ module MobyBehaviour
1346
1457
  begin
1347
1458
 
1348
1459
  subdata =
1349
- MobyUtil::XML.parse_string(
1350
- execute_command(
1351
- MobyCommand::Application.new(
1352
- :State,
1353
- nil,
1354
- pid,
1355
- self,
1356
- nil,
1357
- nil,
1358
- nil,
1359
- nil,
1360
- {
1361
- 'x_parent_absolute' => x_prev,
1362
- 'y_parent_absolute' => y_prev,
1363
- 'embedded' => 'true',
1364
- 'parent_size' => winSize
1365
- }
1366
- )
1367
- )[ 0 ]
1368
- )
1460
+ MobyUtil::XML.parse_string(
1461
+ execute_command(
1462
+ MobyCommand::Application.new(
1463
+ :State,
1464
+ nil,
1465
+ pid,
1466
+ self,
1467
+ nil,
1468
+ nil,
1469
+ nil,
1470
+ nil,
1471
+ {
1472
+ 'x_parent_absolute' => x_prev,
1473
+ 'y_parent_absolute' => y_prev,
1474
+ 'embedded' => 'true',
1475
+ 'parent_size' => winSize
1476
+ }
1477
+ )
1478
+ )[ 0 ]
1479
+ )
1369
1480
 
1370
1481
  child = subdata.root.xpath('//object')[0]
1371
1482
 
1372
1483
  # Remove the attribute with the pid retrieval was not successful.
1373
1484
  # (server returns the previous hit if not found)
1374
1485
  if child.attribute('id' ) != pid
1375
-
1486
+
1376
1487
  element.remove
1377
1488
 
1378
1489
  else
@@ -1471,10 +1582,10 @@ module MobyBehaviour
1471
1582
  @refresh_interval = $parameters[ @id ][ :refresh_interval, @refresh_interval ].to_f
1472
1583
 
1473
1584
  end
1474
-
1585
+
1475
1586
  @last_xml_data = nil
1476
-
1477
- ruby_file = $parameters[ @id ][ :verify_blocks ]
1587
+
1588
+ ruby_file = $parameters[ @id ][ :verify_blocks ]
1478
1589
 
1479
1590
  @verify_blocks = []
1480
1591
 
@@ -1493,7 +1604,7 @@ module MobyBehaviour
1493
1604
 
1494
1605
  end
1495
1606
 
1496
- public # deprecated
1607
+ public # deprecated
1497
1608
 
1498
1609
  # == nodoc
1499
1610
  # function to get TestObject
@@ -1502,12 +1613,12 @@ module MobyBehaviour
1502
1613
  # TODO: Document me when I'm ready
1503
1614
  def get_object( object_id )
1504
1615
 
1505
- warn("deprecated: use SUT#child instead of SUT#get_object in order to retrieve child test objects")
1616
+ warn "warning: deprecated method SUT#get_object; please use SUT#child instead"
1506
1617
 
1507
- child( object_id )
1618
+ child object_id
1508
1619
 
1509
1620
  end
1510
-
1621
+
1511
1622
  # == nodoc
1512
1623
  #TODO: Update documentation
1513
1624
  #TODO: Is this function deprecated? (see SUT#refresh_ui_dump)
@@ -1518,7 +1629,7 @@ module MobyBehaviour
1518
1629
  # == raises
1519
1630
  # someException:: If Dump does not conform to the tasMessage schema error is raised
1520
1631
  def get_ui_dump( refresh_args = {} )
1521
-
1632
+
1522
1633
  #$stderr.puts "warning: SUT#get_ui_dump is deprecated, please use SUT#refresh_ui_dump instead."
1523
1634
 
1524
1635
  refresh_ui_dump refresh_args, {}
@@ -1529,5 +1640,5 @@ module MobyBehaviour
1529
1640
  TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
1530
1641
 
1531
1642
  end # SUT
1532
-
1643
+
1533
1644
  end # MobyBehaviour