testability-driver 0.9.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (214) hide show
  1. data/README +1 -0
  2. data/bin/start_app_perf +199 -0
  3. data/bin/tdriver-devtools +3 -0
  4. data/config/sut_parameters.rb +39 -0
  5. data/ext/extconf.rb +67 -0
  6. data/ext/native_extensions.c +70 -0
  7. data/lib/matti.rb +30 -0
  8. data/lib/tdriver-devtools/behaviour/old/xml/example/flick-example.rb +223 -0
  9. data/lib/tdriver-devtools/behaviour/old/xml/example/impl.rb_invalid +194 -0
  10. data/lib/tdriver-devtools/behaviour/old/xml/generate_behaviour_xml.rb +95 -0
  11. data/lib/tdriver-devtools/behaviour/old/xml/lib/tdriver_generator.rb +722 -0
  12. data/lib/tdriver-devtools/behaviour/old/xml/qdoc_generator.rb +321 -0
  13. data/lib/tdriver-devtools/behaviour/old/xml/templates/behaviour.method.template +43 -0
  14. data/lib/tdriver-devtools/behaviour/old/xml/templates/behaviour.module.template +54 -0
  15. data/lib/tdriver-devtools/behaviour/old/xml/templates/behaviour.xml.argument.template +7 -0
  16. data/lib/tdriver-devtools/behaviour/old/xml/templates/behaviour.xml.argument_type.template +7 -0
  17. data/lib/tdriver-devtools/behaviour/old/xml/templates/behaviour.xml.exception.template +5 -0
  18. data/lib/tdriver-devtools/behaviour/old/xml/templates/behaviour.xml.howto.line.template +2 -0
  19. data/lib/tdriver-devtools/behaviour/old/xml/templates/behaviour.xml.howto.template +5 -0
  20. data/lib/tdriver-devtools/behaviour/old/xml/templates/behaviour.xml.method.template +23 -0
  21. data/lib/tdriver-devtools/behaviour/old/xml/templates/behaviour.xml.template +14 -0
  22. data/lib/tdriver-devtools/behaviour/old/xml/update +3 -0
  23. data/lib/tdriver-devtools/behaviour/xml/generate.rb +88 -0
  24. data/lib/tdriver-devtools/behaviour/xml/rdoc_behaviour_xml_generator.rb +1924 -0
  25. data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.argument.default.template +1 -0
  26. data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.argument.template +3 -0
  27. data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.argument_type.template +4 -0
  28. data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.exception.template +4 -0
  29. data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.method.arguments.template +4 -0
  30. data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.method.deprecated.template +3 -0
  31. data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.method.exceptions.template +3 -0
  32. data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.method.info.template +1 -0
  33. data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.method.returns.template +3 -0
  34. data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.method.tables.template +3 -0
  35. data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.method.template +12 -0
  36. data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.returns.template +5 -0
  37. data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.table.item.template +1 -0
  38. data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.table.row.template +2 -0
  39. data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.table.template +8 -0
  40. data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.template +14 -0
  41. data/lib/tdriver-devtools/behaviour/xml_generator/example/flick-example.rb +245 -0
  42. data/lib/tdriver-devtools/behaviour/xml_generator/example/sut.rb +964 -0
  43. data/lib/tdriver-devtools/behaviour/xml_generator/generate.rb +68 -0
  44. data/lib/tdriver-devtools/behaviour/xml_generator/lib/custom_rdoc_generator.rb +1865 -0
  45. data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.argument.default.template +1 -0
  46. data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.argument.template +3 -0
  47. data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.argument_type.template +4 -0
  48. data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.exception.template +4 -0
  49. data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.method.arguments.template +4 -0
  50. data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.method.deprecated.template +3 -0
  51. data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.method.exceptions.template +3 -0
  52. data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.method.info.template +1 -0
  53. data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.method.returns.template +3 -0
  54. data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.method.tables.template +3 -0
  55. data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.method.template +12 -0
  56. data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.returns.template +5 -0
  57. data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.table.item.template +1 -0
  58. data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.table.row.template +2 -0
  59. data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.table.template +7 -0
  60. data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.template +14 -0
  61. data/lib/tdriver-devtools/behaviour/xml_generator/update +3 -0
  62. data/lib/tdriver-devtools/doc/behaviour_xml/QtExampleGestureBehaviour.xml +138 -0
  63. data/lib/tdriver-devtools/doc/behaviour_xml/created.rid +1 -0
  64. data/lib/tdriver-devtools/doc/behaviour_xml/tdriver.hash +1 -0
  65. data/lib/tdriver-devtools/doc/feature_xml/qt_widget_hold.feature.xml +9 -0
  66. data/lib/tdriver-devtools/doc/feature_xml/qt_widget_tap.feature.xml +9 -0
  67. data/lib/tdriver-devtools/doc/generate.rb +892 -0
  68. data/lib/tdriver-devtools/doc/update +1 -0
  69. data/lib/tdriver-devtools/doc/xslt/html.rb +7 -0
  70. data/lib/tdriver-devtools/doc/xslt/template.xsl +1861 -0
  71. data/lib/tdriver-devtools/doc/xslt/update +3 -0
  72. data/lib/tdriver-devtools/plugin/placeholder.txt +1 -0
  73. data/lib/tdriver-devtools/tdriver-devtools.rb +404 -0
  74. data/lib/tdriver-devtools/tests/feature_tests/example/flick-example.rb +233 -0
  75. data/lib/tdriver-devtools/tests/feature_tests/example/impl.rb +194 -0
  76. data/lib/tdriver-devtools/tests/feature_tests/generate.rb +82 -0
  77. data/lib/tdriver-devtools/tests/feature_tests/lib/custom_rdoc_generator.rb +468 -0
  78. data/lib/tdriver-devtools/tests/feature_tests/templates/feature_attribute.template +5 -0
  79. data/lib/tdriver-devtools/tests/feature_tests/templates/feature_method.template +5 -0
  80. data/lib/tdriver-devtools/tests/feature_tests/templates/scenario_attribute.template +5 -0
  81. data/lib/tdriver-devtools/tests/feature_tests/templates/scenario_method.template +5 -0
  82. data/lib/tdriver-devtools/tests/feature_tests/update +3 -0
  83. data/lib/tdriver.rb +26 -0
  84. data/lib/tdriver/base/behaviour/behaviour.rb +32 -0
  85. data/lib/tdriver/base/behaviour/behaviours/object_behaviour_composition.rb +94 -0
  86. data/lib/tdriver/base/behaviour/behaviours/object_behaviour_description.rb +262 -0
  87. data/lib/tdriver/base/behaviour/behaviours/object_composition.rb +111 -0
  88. data/lib/tdriver/base/behaviour/factory.rb +380 -0
  89. data/lib/tdriver/base/behaviour/loader.rb +28 -0
  90. data/lib/tdriver/base/command_data/command_data.rb +51 -0
  91. data/lib/tdriver/base/command_data/loader.rb +25 -0
  92. data/lib/tdriver/base/errors.rb +131 -0
  93. data/lib/tdriver/base/loader.rb +38 -0
  94. data/lib/tdriver/base/state_object.rb +270 -0
  95. data/lib/tdriver/base/sut/adapter.rb +28 -0
  96. data/lib/tdriver/base/sut/controller.rb +119 -0
  97. data/lib/tdriver/base/sut/factory.rb +287 -0
  98. data/lib/tdriver/base/sut/generic/behaviours/application.rb +243 -0
  99. data/lib/tdriver/base/sut/generic/behaviours/controller.rb +67 -0
  100. data/lib/tdriver/base/sut/generic/behaviours/find.rb +96 -0
  101. data/lib/tdriver/base/sut/generic/behaviours/flash_behaviour.rb +346 -0
  102. data/lib/tdriver/base/sut/generic/behaviours/sut.rb +1268 -0
  103. data/lib/tdriver/base/sut/generic/behaviours/switchbox_behaviour.rb +182 -0
  104. data/lib/tdriver/base/sut/generic/behaviours/verification.rb +119 -0
  105. data/lib/tdriver/base/sut/generic/commands/application.rb +219 -0
  106. data/lib/tdriver/base/sut/generic/commands/key_sequence.rb +82 -0
  107. data/lib/tdriver/base/sut/generic/commands/screen_capture.rb +58 -0
  108. data/lib/tdriver/base/sut/generic/plugin.rb +96 -0
  109. data/lib/tdriver/base/sut/loader.rb +35 -0
  110. data/lib/tdriver/base/sut/sut.rb +67 -0
  111. data/lib/tdriver/base/test_object/abstract.rb +179 -0
  112. data/lib/tdriver/base/test_object/behaviours/syncronization.rb +94 -0
  113. data/lib/tdriver/base/test_object/behaviours/test_object.rb +787 -0
  114. data/lib/tdriver/base/test_object/factory.rb +618 -0
  115. data/lib/tdriver/base/test_object/identificator.rb +511 -0
  116. data/lib/tdriver/base/test_object/loader.rb +37 -0
  117. data/lib/tdriver/env.rb +21 -0
  118. data/lib/tdriver/loader.rb +36 -0
  119. data/lib/tdriver/matti.rb +35 -0
  120. data/lib/tdriver/report/error_recovery/tdriver_custom_error_recovery.rb +83 -0
  121. data/lib/tdriver/report/error_recovery/tdriver_error_recovery.rb +158 -0
  122. data/lib/tdriver/report/error_recovery/tdriver_error_recovery_settings.rb +98 -0
  123. data/lib/tdriver/report/report.rb +47 -0
  124. data/lib/tdriver/report/report_api.rb +207 -0
  125. data/lib/tdriver/report/report_combine.rb +86 -0
  126. data/lib/tdriver/report/report_crash_file_capture.rb +167 -0
  127. data/lib/tdriver/report/report_creator.rb +571 -0
  128. data/lib/tdriver/report/report_cucumber.rb +158 -0
  129. data/lib/tdriver/report/report_cucumber_listener.rb +337 -0
  130. data/lib/tdriver/report/report_cucumber_reporter.rb +335 -0
  131. data/lib/tdriver/report/report_data_presentation.rb +152 -0
  132. data/lib/tdriver/report/report_data_table.rb +64 -0
  133. data/lib/tdriver/report/report_execution_statistics.rb +284 -0
  134. data/lib/tdriver/report/report_file_capture.rb +159 -0
  135. data/lib/tdriver/report/report_grouping.rb +539 -0
  136. data/lib/tdriver/report/report_junit_xml.rb +147 -0
  137. data/lib/tdriver/report/report_rspec.rb +108 -0
  138. data/lib/tdriver/report/report_test_case_run.rb +621 -0
  139. data/lib/tdriver/report/report_test_run.rb +1286 -0
  140. data/lib/tdriver/report/report_test_unit.rb +175 -0
  141. data/lib/tdriver/report/report_writer.rb +1405 -0
  142. data/lib/tdriver/tdriver.rb +158 -0
  143. data/lib/tdriver/util/common.rb +24 -0
  144. data/lib/tdriver/util/common/array.rb +39 -0
  145. data/lib/tdriver/util/common/crc16.rb +100 -0
  146. data/lib/tdriver/util/common/environment.rb +153 -0
  147. data/lib/tdriver/util/common/error.rb +39 -0
  148. data/lib/tdriver/util/common/file.rb +315 -0
  149. data/lib/tdriver/util/common/gem.rb +108 -0
  150. data/lib/tdriver/util/common/kernel.rb +189 -0
  151. data/lib/tdriver/util/common/loader.rb +39 -0
  152. data/lib/tdriver/util/common/retryable.rb +98 -0
  153. data/lib/tdriver/util/common/string.rb +77 -0
  154. data/lib/tdriver/util/dbaccess/dbaccess.rb +188 -0
  155. data/lib/tdriver/util/dbaccess/dbconnection.rb +41 -0
  156. data/lib/tdriver/util/dbaccess/error.rb +35 -0
  157. data/lib/tdriver/util/dbaccess/loader.rb +29 -0
  158. data/lib/tdriver/util/dynamic_attribute_filter.rb +182 -0
  159. data/lib/tdriver/util/hooking.rb +434 -0
  160. data/lib/tdriver/util/loader.rb +65 -0
  161. data/lib/tdriver/util/localisation.rb +24 -0
  162. data/lib/tdriver/util/localisation/error.rb +32 -0
  163. data/lib/tdriver/util/localisation/loader.rb +28 -0
  164. data/lib/tdriver/util/localisation/localisation.rb +479 -0
  165. data/lib/tdriver/util/logger.rb +377 -0
  166. data/lib/tdriver/util/operator_data/error.rb +29 -0
  167. data/lib/tdriver/util/operator_data/loader.rb +26 -0
  168. data/lib/tdriver/util/operator_data/operator_data.rb +93 -0
  169. data/lib/tdriver/util/other/config.rb +221 -0
  170. data/lib/tdriver/util/parameter.rb +24 -0
  171. data/lib/tdriver/util/parameter/error.rb +45 -0
  172. data/lib/tdriver/util/parameter/loader.rb +37 -0
  173. data/lib/tdriver/util/parameter/parameter.rb +285 -0
  174. data/lib/tdriver/util/parameter/parameter_hash.rb +101 -0
  175. data/lib/tdriver/util/parameter/parameter_template.rb +120 -0
  176. data/lib/tdriver/util/parameter/parameter_user_api.rb +84 -0
  177. data/lib/tdriver/util/parameter/parameter_xml.rb +247 -0
  178. data/lib/tdriver/util/plugin/abstract.rb +60 -0
  179. data/lib/tdriver/util/plugin/error.rb +25 -0
  180. data/lib/tdriver/util/plugin/loader.rb +28 -0
  181. data/lib/tdriver/util/plugin/service.rb +200 -0
  182. data/lib/tdriver/util/recorder.rb +292 -0
  183. data/lib/tdriver/util/stats.rb +90 -0
  184. data/lib/tdriver/util/user_data/error.rb +29 -0
  185. data/lib/tdriver/util/user_data/loader.rb +26 -0
  186. data/lib/tdriver/util/user_data/user_data.rb +103 -0
  187. data/lib/tdriver/util/video_rec.rb +264 -0
  188. data/lib/tdriver/util/xml/abstraction.rb +47 -0
  189. data/lib/tdriver/util/xml/builder.rb +54 -0
  190. data/lib/tdriver/util/xml/document.rb +32 -0
  191. data/lib/tdriver/util/xml/element.rb +32 -0
  192. data/lib/tdriver/util/xml/error.rb +46 -0
  193. data/lib/tdriver/util/xml/loader.rb +46 -0
  194. data/lib/tdriver/util/xml/nil_element.rb +89 -0
  195. data/lib/tdriver/util/xml/nodeset.rb +32 -0
  196. data/lib/tdriver/util/xml/parsers/libxml/libxml.rb +140 -0
  197. data/lib/tdriver/util/xml/parsers/loader.rb +22 -0
  198. data/lib/tdriver/util/xml/parsers/nokogiri/abstraction.rb +111 -0
  199. data/lib/tdriver/util/xml/parsers/nokogiri/attribute.rb +54 -0
  200. data/lib/tdriver/util/xml/parsers/nokogiri/builder.rb +58 -0
  201. data/lib/tdriver/util/xml/parsers/nokogiri/document.rb +58 -0
  202. data/lib/tdriver/util/xml/parsers/nokogiri/element.rb +147 -0
  203. data/lib/tdriver/util/xml/parsers/nokogiri/loader.rb +42 -0
  204. data/lib/tdriver/util/xml/parsers/nokogiri/nodeset.rb +187 -0
  205. data/lib/tdriver/util/xml/xml.rb +170 -0
  206. data/lib/tdriver/verify/verify.rb +687 -0
  207. data/lib/tdriver/verify/verify.rb_org +630 -0
  208. data/lib/tdriver/version.rb +21 -0
  209. data/xml/behaviours/generic.xml +495 -0
  210. data/xml/defaults/generic.xml +97 -0
  211. data/xml/defaults/sut_generic.xml +36 -0
  212. data/xml/parameters/tdriver_parameters.xml +23 -0
  213. data/xml/templates/generic.xml +227 -0
  214. metadata +327 -0
@@ -0,0 +1,94 @@
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
+ ##
18
+ ############################################################################
19
+
20
+ module MobyBehaviour
21
+
22
+ # == description
23
+ # TDriver synchronization functionality. These methods make it possible to wait until the SUT is in some user defined state
24
+ #
25
+ # == behaviour
26
+ # GenericTestObjectSynchronization
27
+ #
28
+ # == requires
29
+ # *
30
+ #
31
+ # == input_type
32
+ # *
33
+ #
34
+ # == sut_type
35
+ # *
36
+ #
37
+ # == sut_version
38
+ # *
39
+ #
40
+ # == objects
41
+ # *;sut
42
+ #
43
+ module TestObjectSynchronization
44
+
45
+ include MobyBehaviour::Behaviour
46
+
47
+ # Wait until this test object has a child test object of the specified type and matching the given attributes.
48
+ # The child being waited for must be identifiable by the provided constraints. The call terminates
49
+ # only when exactly a single child matches the criteria.
50
+ #
51
+ # === params
52
+ # type:: String defining the type of the child test object, eg. "list", "softkey"
53
+ # attributes:: (optional) Hash defining the set of attributes that the child test object must possess.
54
+ # timeout:: (optional) Integer overriding the default synchronization timeout.
55
+ # === raises
56
+ # ArgumentError:: One of the arguments was not of a valid format.
57
+ # SyncTimeoutError:: The timeout has passed without synchronization success.
58
+ def wait_child( attributes = {}, timeout_secs = 10, retry_interval = 0.5 )
59
+
60
+ Kernel::raise ArgumentError.new( "Argument type was not a valid. Expected: String" ) unless attributes[ :type ].kind_of?( String ) && attributes[ :type ].length > 0
61
+
62
+ Kernel::raise ArgumentError.new( "Argument attributes was not a valid. Expected: Hash" ) unless attributes.kind_of?( Hash )
63
+
64
+ Kernel::raise ArgumentError.new( "Argument timeout_secs was not a valid. Expected: Integer, Fixnum or Float" ) unless [ Integer, Fixnum, Float ].include? timeout_secs.class
65
+
66
+ Kernel::raise ArgumentError.new( "Argument retry_interval was not a valid. Expected: Integer, Fixnum or Float" ) unless [ Integer, Fixnum, Float ].include? retry_interval.class
67
+
68
+ begin
69
+
70
+ MobyUtil::Retryable.until( :timeout => timeout_secs, :interval => retry_interval ) {
71
+
72
+ #self.refresh( attributes )
73
+
74
+ self.refresh( self.kind_of?( MobyBase::SUT ) ? attributes : { :id => self.get_application_id } )
75
+
76
+ MobyBase::TestObjectIdentificator.new( attributes ).find_object_data( self.xml_data )
77
+
78
+ }
79
+ rescue
80
+
81
+ # the child object was not found in the specified timeout
82
+ Kernel::raise MobyBase::SyncTimeoutError.new( "Synchronization timed out (%i) before the defined child object could be found." % timeout_secs )
83
+ end
84
+
85
+ self
86
+
87
+ end
88
+
89
+ # enable hooking for performance measurement & debug logging
90
+ MobyUtil::Hooking.instance.hook_methods( self ) if defined?( MobyUtil::Hooking )
91
+
92
+ end # TDriverSyncronization
93
+
94
+ end # MobyBehaviour
@@ -0,0 +1,787 @@
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
+ ##
18
+ ############################################################################
19
+
20
+ module MobyBehaviour
21
+
22
+ # == description
23
+ # Describes the generic behaviour of TestObject, common methods that can be used to control TestObject
24
+ #
25
+ # == behaviour
26
+ # GenericTestObject
27
+ #
28
+ # == requires
29
+ # *
30
+ #
31
+ # == input_type
32
+ # *
33
+ #
34
+ # == sut_type
35
+ # *
36
+ #
37
+ # == sut_version
38
+ # *
39
+ #
40
+ # == objects
41
+ # *
42
+ #
43
+ module TestObject
44
+
45
+ # == nodoc
46
+ # == description
47
+ # attr_accessor
48
+ # == returns
49
+ # Hash
50
+ # description: Hash containing the identification attributes that were used when the test object was created.
51
+ # example: { :name => 'Triangle1', :type => :Triangle }
52
+ attr_accessor :creation_attributes
53
+
54
+ # === description
55
+ # Determines if the current test object is of type 'application'
56
+ # === returns
57
+ # TrueClass::
58
+ # FalseClass::
59
+ # == example
60
+ # @test_app = @sut.run(:name => 'testapp') # launches testapp
61
+ # isApplication = @test_app.application?
62
+ def application?
63
+
64
+ @type == 'application'
65
+
66
+ end
67
+
68
+ # == description
69
+ # Return all test object attributes
70
+ # === returns
71
+ # Hash:: Test object attributes
72
+ # == example
73
+ # @test_app = @sut.run(:name => 'testapp') # launches testapp
74
+ # attributes_hash = @test_app.Triangle( :name => 'Triangle1' ).attributes # retrieve all attribute for triangle object
75
+ def attributes
76
+
77
+ # return hash of test object attributes
78
+ Hash[ xml_data.xpath( 'attributes/attribute' ).collect{ | test_object | [ test_object.attribute( 'name' ), test_object.content ] } ]
79
+
80
+ end
81
+
82
+ # == nodoc
83
+ # == description
84
+ # Changes the status of the test object to active
85
+ # == returns
86
+ # TrueClass::
87
+ # == example
88
+ # @app = @sut.run(:name => 'testapp') # launches testapp
89
+ # @app.Node( :name => 'Node1' ).activate() # activate given object
90
+ def activate
91
+
92
+ @_active = true
93
+
94
+ end
95
+
96
+ # == nodoc
97
+ # Changes the status of the test object to inactive, also deactivating all children
98
+ # Removes reference from @parent TestObject or SUT to this TestObject so that
99
+ # @parent.refresh does not refresh currrent TestObject
100
+ #
101
+ # Does nothing if TestObject is already deactivated
102
+ # == returns
103
+ # ?
104
+ def deactivate
105
+
106
+ return if !@_active
107
+
108
+ @_active = false
109
+
110
+ @_child_object_cache.each_value{ | test_object |
111
+
112
+ # deactivate test object
113
+ test_object.deactivate
114
+
115
+ }
116
+
117
+ @_child_object_cache.clear
118
+
119
+ @parent.remove_child( self )
120
+
121
+ end
122
+
123
+ # == description
124
+ # Function returns a attribute of test object
125
+ # == params
126
+ # name:: String definig the name of the attribute to get
127
+ # == returns
128
+ # String:: Value of the attribute as a string
129
+ # == exceptions
130
+ # TestObjectNotInitializedError:: if the test object xml data has not been initialized
131
+ # AttributeNotFoundError:: if the requested attribute can not be found in the xml data of the object
132
+ # == example
133
+ # @test_app = @sut.run(:name => 'testapp') # launches testapp
134
+ # puts @test_app.Triangle( :name => 'Triangle1' ).attribute('color') # prints color of triangle object
135
+ def attribute( name )
136
+
137
+ # note: count of tries represents total number of tries
138
+ MobyUtil::Retryable.while( :tries => 2, :interval => 0 ) { | attempt |
139
+
140
+ begin
141
+
142
+ # find attribute from xml
143
+ find_attribute( name )
144
+
145
+ rescue MobyBase::AttributeNotFoundError
146
+
147
+ # do following actions only once
148
+ if ( attempt == 1 )
149
+
150
+ # add to dynamic attribute filter once
151
+ MobyUtil::DynamicAttributeFilter.instance.add_attribute( name )
152
+
153
+ # refresh ui state
154
+ refresh( :id => get_application_id )
155
+
156
+ end
157
+
158
+ # raise exception and retry if attempts left
159
+ raise
160
+
161
+ end
162
+
163
+ }
164
+
165
+ end
166
+
167
+ # == description
168
+ # Returns the parent test object for the current object in question, according to the UI object hierarchy. For getting the test object that was actually used
169
+ # as the parent when the test object instance was created, see parent_object.
170
+ # == returns
171
+ # TestObject:: test object that is parent of this test object, self if no parent (ie. application objects)
172
+ # == example
173
+ # @app = @sut.run(:name => 'testapp') # launches testapp
174
+ # parent_test_object = @app.Node( :name => 'Node1' ).get_parent() #get parent for some test object
175
+ def get_parent()
176
+
177
+ return self if application?
178
+
179
+ @sut.refresh if disable_optimizer
180
+
181
+ #find parent id
182
+ #element_set = @sut.xml_data.xpath( "//object/objects/object[@id='%s']/../.." % @id )
183
+ element_set = @sut.xml_data.xpath( "//object/objects/object[@id='#{ @id }']/../.." )
184
+
185
+ kid = nil
186
+ if( element_set == nil or element_set.size == 0 )
187
+ kid = self
188
+ else
189
+ element = element_set.first
190
+
191
+ #if app set look for the item under the app to make sure app id is available
192
+
193
+ if self.get_application_id && element.attribute( "type" ) != 'application'
194
+
195
+ kid = @sut.child(
196
+
197
+ :id => get_application_id,
198
+ :type => 'application'
199
+
200
+ ).child(
201
+
202
+ :id => element.attribute( "id" ),
203
+ :name => element.attribute( "name" ),
204
+ :type => element.attribute( "type" ),
205
+ :__index => 0 # there was a case when the same parent was included twice in the ui dump
206
+
207
+ )
208
+
209
+ else
210
+
211
+ kid = @sut.child(
212
+ :id => element.attribute( "id" ),
213
+ :name => element.attribute( "name" ),
214
+ :type => element.attribute( "type" )
215
+ )
216
+
217
+ end
218
+ end
219
+ enable_optimizer
220
+ kid
221
+ end
222
+
223
+ # == nodoc
224
+ # Updates this test object to match the data in the provided xml document
225
+ # Propagates updating to all child TestObjects
226
+ # If TestObject is not identified, then current TO is deactivated, as is all the Child objects, as defined in TestObject#deactivate.
227
+ # === params
228
+ # xml_document:: LibXML::XML::Node describing the new state of this test object
229
+ # === returns
230
+ # ?
231
+ # === raises
232
+ # nothing
233
+ def update( xml_document )
234
+
235
+ begin
236
+
237
+ if !( _xml_data = MobyBase::TestObjectIdentificator.new( :type => @type, :id => @id, :name => @name ).find_object_data( xml_document ) ).eql?( xml_data )
238
+
239
+ @_child_objects.each { | test_object | test_object.update( ( xml_data = _xml_data ) ) }
240
+
241
+ end
242
+
243
+ rescue MobyBase::TestObjectNotFoundError, MobyBase::MultipleTestObjectsIdentifiedError
244
+
245
+ deactivate
246
+
247
+ end
248
+
249
+ end
250
+
251
+ # == nodoc
252
+ # Function refreshes test objects to correspond with the current state of the device.
253
+ #
254
+ # NOTE:
255
+ #
256
+ # @sut#refresh will call update method for this TestObject, if state has changed. Thus, calling
257
+ # @sut.refresh might have a side effect that changes the @_active instance variable.
258
+ # === raises
259
+ # TestObjectNotFoundError:: if TestObject is not identified within synch timeout.
260
+ def refresh( refresh_args = {} )
261
+
262
+ object_search_params = @test_object_factory.make_object_search_params(@creation_attributes)
263
+ search_params = @test_object_factory.get_parent_params(parent)
264
+ search_params.push(object_search_params)
265
+ @sut.refresh( refresh_args, search_params )
266
+
267
+ end
268
+
269
+ # == nodoc
270
+ # Function refreshes test objects to correspond with the current state of the device, forcing
271
+ # the sut to request a new XML dump from the device.
272
+ #
273
+ # NOTE:
274
+ #
275
+ # @sut#force_refresh will call update method for this TestObject, if state has changed. Thus, calling
276
+ # @sut.force_refresh might have a side effect that changes the @_active instance variable.
277
+ # === raises
278
+ # TestObjectNotFoundError:: if TestObject is not identified within synch timeout.
279
+ def force_refresh( refresh_args = {} )
280
+
281
+ refresh(refresh_args)
282
+
283
+ end
284
+
285
+ # == description
286
+ # Function for finding out the application this test ojbect
287
+ # == returns
288
+ # MobyBase::TestObject
289
+ # description: Application test object that the test object belongs to, or nil, if no parent of type application can be found.
290
+ # example: -
291
+ # == example
292
+ # parent_app = @app.Node( :name => 'Node1' ).get_application() #get application for some test object, this should return @app.
293
+ def get_application
294
+
295
+ return self if application?
296
+
297
+ test_object = @parent
298
+
299
+ while test_object
300
+
301
+ return test_object if ( test_object.type == 'application' )
302
+
303
+ test_object = test_object.parent
304
+
305
+ end
306
+
307
+ # return application object or nil if no parent found
308
+ # Does is make sense to return nil - should n't all test objects belong to an application? Maybe throw exception if application not found
309
+
310
+ return @sut.child( :type => 'application' ) rescue nil
311
+
312
+ end
313
+
314
+ # == description
315
+ # Function for finding out the application id for this test object
316
+ # == returns
317
+ # String:: representing the id of the application test object that this test object belongs to.
318
+ # == example
319
+ # puts @app.Node( :name => 'Node1' ).get_application_id() #print the application id, this should print @app.id
320
+ def get_application_id
321
+
322
+ return @_application_id if @_application_id
323
+ #What about the case when get_application returns nil? This line will throw an exception in that case.
324
+ get_application.id
325
+
326
+ end
327
+
328
+ # == nodoc
329
+ def set_application_id( application_id )
330
+
331
+ @_application_id = application_id
332
+
333
+ end
334
+
335
+ # == description
336
+ # Returns a StateObject containing the current state of this test object as XML.
337
+ # The state object is static and thus is not refreshed or synchronized etc.
338
+ # == returns
339
+ # StateObject:: State of this test object
340
+ # == exceptions
341
+ # ArgumentError
342
+ # description: If the xml source for the object cannot be read
343
+ # == example
344
+ # app_state = @sut.application( :name => "calculator" ).state #get the state object for the app
345
+ # button_state = app_state.Button( :text => "Backspace" ) #get the state for test object button
346
+ # button_text = button_state.attribute( "text" ) #get attribute text from the button state object
347
+ def state
348
+
349
+ MobyBase::StateObject.new( xml_data, self )
350
+
351
+ end
352
+
353
+ # Function for translating all symbol values into strings using sut's translate method
354
+ # Goes through all items in a hash and if a value is symbol then uses that symbol as a logical
355
+ # name and tries to find a translation for that.
356
+ # === params
357
+ # hash:: Hash containing key, value pairs. The parameter will get modified if symbols are found from values
358
+ # === raises
359
+ # LanguageNotFoundError:: In case of language is not found
360
+ # LogicalNameNotFoundError:: In case of logical name is not found for current language
361
+ # MySqlConnectError:: In case problems with the db connectivity
362
+ def translate!( hash, file_name = nil, plurality = nil, numerus = nil, lengthvariant = nil )
363
+
364
+ hash.each_pair do | _key, _value |
365
+
366
+ next if [ :name, :type, :id ].include?( _key )
367
+
368
+ hash[ _key ] = sut.translate( _value, file_name, plurality, numerus, lengthvariant ) if _value.kind_of?( Symbol )
369
+
370
+ end if !hash.nil?
371
+
372
+ end
373
+
374
+ # == description
375
+ # Creates a test object for a child object of this test object. Caller test object will be result (child) object's parent object.\n
376
+ # \n
377
+ # [b]NOTE:[/b] Subsequent calls to TestObject#child( rule ) always returns reference to same Testobject:\n
378
+ # [code]a = to.child( :type => 'Button', :text => '1' )
379
+ # b = to.child( :type => 'Button', :text => '1' )
380
+ # a.eql?( b ) # => true[/code]
381
+ # == arguments
382
+ # attributes
383
+ # Hash
384
+ # description: Hash object holding information for identifying which child to create
385
+ # example: { :type => :slider }
386
+ #
387
+ # == returns
388
+ # MobyBase::TestObject
389
+ # description: new child test object or reference to existing child
390
+ # example: -
391
+ #
392
+ # == exceptions
393
+ # TypeError
394
+ # description: raised if agument is not a Hash
395
+ #
396
+ # MultipleTestObjectsIdentifiedError
397
+ # description: raised if multiple objects found that match the given attributes
398
+ #
399
+ # TestObjectNotFoundError
400
+ # description: raised if the child object could not be found
401
+ #
402
+ # TestObjectNotVisibleError
403
+ # description: rasied if the parent test object is no longer visible
404
+ def child( attributes )
405
+
406
+ # verify attributes argument format
407
+ raise TypeError.new( 'Unexpected argument type (%s) for attributes, expecting %s' % [ attributes.class, "Hash" ] ) unless attributes.kind_of?( Hash )
408
+
409
+ # retrieve child object
410
+ get_child_objects( attributes )
411
+
412
+ end
413
+
414
+ # == description
415
+ # Function similar to child, but returns an array of children test objects that meet the given criteria
416
+ #
417
+ # == arguments
418
+ # attributes
419
+ # Hash
420
+ # description: object holding information for identifying which child to create
421
+ # example: { :type => :slider }
422
+ #
423
+ # find_all_children
424
+ # TrueClass
425
+ # description: Boolean specifying whether all children under the test node or just immediate children should be retreived
426
+ # example: true
427
+ # FalseClass
428
+ # description: Boolean specifying whether all children under the test node or just immediate children should be retreived
429
+ # example: false
430
+ #
431
+ # == returns
432
+ # Array
433
+ # description: An array of test objects
434
+ # example: [ MobyBase::TestObject, MobyBase::TestObject, MobyBase::TestObject, ... ]
435
+ #
436
+ # == exceptions
437
+ # TypeError
438
+ # description: raised if agument is not a Hash
439
+ #
440
+ # TestObjectNotFoundError
441
+ # description: raised if the child object could not be found
442
+ #
443
+ # TestObjectNotVisibleError
444
+ # description: rasied if the parent test object is no longer visible
445
+ def children( attributes, find_all_children = true )
446
+
447
+ # verify attributes argument format
448
+ raise TypeError.new( 'Unexpected argument type (%s) for attributes, expecting %s' % [ attributes.class, "Hash" ] ) unless attributes.kind_of?( Hash )
449
+
450
+ # respect the original attributes variable value
451
+ creation_attributes = attributes.clone
452
+
453
+ # If empty or only special attributes then add :type => "any" to search all
454
+ creation_attributes.merge!( :type => "any" ) if creation_attributes.select{ | key, value | key.to_s !~ /^__/ ? true : false }.empty?
455
+
456
+ # children method specific settings
457
+ creation_attributes.merge!( :__multiple_objects => true, :__find_all_children => find_all_children )
458
+
459
+
460
+ disable_optimizer
461
+ # retrieve child objects
462
+ kids = get_child_objects( creation_attributes )
463
+ enable_optimizer
464
+
465
+
466
+ kids
467
+
468
+ end
469
+
470
+ private
471
+
472
+ def disable_optimizer
473
+ #disable optimizer for this call since it will not work
474
+ @_enable_optimizer = false
475
+ if MobyUtil::Parameter[ @sut.id ][ :use_find_object, 'false' ] == 'true' and @sut.methods.include?('find_object')
476
+ MobyUtil::Parameter[ @sut.id ][ :use_find_object] = 'false'
477
+ @_enable_optimizer = true
478
+ end
479
+ @_enable_optimizer
480
+ end
481
+
482
+ def enable_optimizer
483
+ MobyUtil::Parameter[ @sut.id ][ :use_find_object] = 'true' if @_enable_optimizer
484
+ @_enable_optimizer = false
485
+ end
486
+
487
+ # Tries to use the missing method id as a child object type and find an object based on it
488
+ def method_missing( method_id, *method_arguments )
489
+
490
+ # method mapping/aliases - this should be configured in xml file
491
+ #case method_id
492
+ # when :Button; method_id = [ :Button, :QToolButton, :DuiButton, :HbPushButton, :softkey ]
493
+ # when :List; method_id = [ :QList, :HbListWidgetView, :DuiList ]
494
+ #end
495
+
496
+ hash_rule = ( method_arguments.first.kind_of?( Hash ) ? method_arguments.first : {} ).merge( :type => method_id )
497
+
498
+ begin
499
+
500
+ child( hash_rule )
501
+
502
+ rescue MobyBase::TestObjectNotFoundError, MobyBase::TestObjectNotVisibleError
503
+
504
+ #hash_rule.delete( :type )
505
+
506
+ Kernel::raise MobyBase::TestObjectNotFoundError.new(
507
+ 'The test object (id: "%s", type: "%s", name: "%s") has no child object with type or behaviour method with name "%s" (%s) on sut "%s".' %
508
+ [ @id, @type, @name, method_id.inspect, ( hash_rule.empty? ? "" : "attributes: #{ hash_rule.inspect }" ), @sut.id ]
509
+ )
510
+
511
+ end
512
+
513
+ end
514
+
515
+ # TODO: refactor logging_enabled
516
+ # try to reactivate test object if currently not active
517
+ def reactivate_test_object( attributes )
518
+
519
+ refresh_args = ( attributes[ :type ] == 'application' ? { :name => attributes[ :name ], :id => attributes[ :id ] } : { :id => get_application_id } )
520
+
521
+ refresh( refresh_args)
522
+
523
+ begin
524
+
525
+ @parent.child( :type => @type, :id => @id )
526
+
527
+ rescue MobyBase::TestObjectNotFoundError => exception
528
+
529
+ Kernel::raise MobyBase::TestObjectNotVisibleError
530
+
531
+ end
532
+
533
+ end
534
+
535
+ # Strip dynamic attributes (such as :__timeout, :__logging) from hash and return those as hash
536
+ # == returns
537
+ # Hash:: Hash of dynamic attributes
538
+ def strip_dynamic_attributes!( attributes, exceptions = [] )
539
+
540
+ Hash[ attributes.select{ | key, value |
541
+
542
+ if /^__/.match( key.to_s ) and !exceptions.include?( key )
543
+
544
+ attributes.delete( key )
545
+
546
+ true
547
+
548
+ else
549
+
550
+ false
551
+
552
+ end
553
+
554
+ }]
555
+
556
+ end
557
+
558
+ def get_cached_test_object!( object )
559
+
560
+ object_hash = object.hash
561
+
562
+ if @_child_object_cache.has_key?( object_hash )
563
+
564
+ object = @_child_object_cache[ object_hash ]
565
+
566
+ true
567
+
568
+ else
569
+
570
+ false
571
+
572
+ end
573
+
574
+ end
575
+
576
+ def get_child_objects( attributes )
577
+
578
+ # create copy of attributes hash
579
+ creation_data = attributes.clone
580
+
581
+ # strip all dynamic attributes such as :__timeout, :__logging etc.
582
+ dynamic_attributes = strip_dynamic_attributes!( creation_data )
583
+
584
+ # store and set logger state if given, use default value if none given
585
+ TDriver.logger.push_enabled( MobyUtil::KernelHelper.to_boolean( dynamic_attributes[ :__logging ], TDriver.logger.enabled ) )
586
+
587
+ # determine if multiple matches is allowed, default value is false
588
+ multiple_objects = MobyUtil::KernelHelper.to_boolean( dynamic_attributes[ :__multiple_objects ], false )
589
+
590
+ find_all_children = MobyUtil::KernelHelper.to_boolean( dynamic_attributes[ :__find_all_children ], true )
591
+
592
+ # check if the hash contains symbols as values and translate those into strings
593
+ file_name = dynamic_attributes[ :__fname ]
594
+ plurality = dynamic_attributes[ :__plurality ]
595
+ numerus = dynamic_attributes[ :__numerus ]
596
+ lengthvariant = dynamic_attributes[ :__lengthvariant ]
597
+ translate!( creation_data, file_name, plurality, numerus, lengthvariant )
598
+
599
+ # use custom timeout if defined
600
+ timeout = ( dynamic_attributes[ :__timeout ] || @test_object_factory.timeout ).to_i
601
+
602
+ # determine which application to refresh
603
+ application_id_hash = ( creation_data[ :type ] == 'application' ? { :name => creation_data[ :name ], :id => creation_data[ :id ] } : { :id => get_application_id } )
604
+
605
+ # add symbols to dynamic attributes list -- to avoid IRB bug
606
+ MobyUtil::DynamicAttributeFilter.instance.add_attributes( creation_data.keys )
607
+
608
+ begin
609
+
610
+ # try to reactivate test object if currently not active
611
+ reactivate_test_object( creation_data ) unless @_active
612
+
613
+ # retrieve test objects from xml
614
+ child_objects = @test_object_factory.make_child_objects(
615
+
616
+ :attributes => creation_data,
617
+ :dynamic_attributes => dynamic_attributes,
618
+
619
+ :parent => self,
620
+ :sut => @sut,
621
+ :application => application_id_hash,
622
+
623
+ :timeout => timeout,
624
+ :multiple_objects => multiple_objects,
625
+ :find_all_children => find_all_children
626
+
627
+ )
628
+
629
+ # Type information is stored in a separate member, not in the Hash
630
+ #creation_data.delete( :type )
631
+
632
+ child_objects.each do | child_object |
633
+
634
+ # use cached test object if once already retrieved
635
+ get_cached_test_object!( child_object ).tap{ | found_in_cache |
636
+
637
+ # Store/update the attributes that were used to create the child object.
638
+ child_object.creation_attributes = creation_data
639
+
640
+ # add child to objects cache
641
+ add_child( child_object ) unless found_in_cache
642
+
643
+ }
644
+
645
+ end
646
+
647
+ # return test object(s)
648
+ multiple_objects ? child_objects : child_objects.first
649
+
650
+ rescue Exception => exception
651
+
652
+ if exception.kind_of?( MobyBase::MultipleTestObjectsIdentifiedError )
653
+
654
+ description = "Multiple child objects matched criteria."
655
+
656
+ elsif exception.kind_of?( MobyBase::TestObjectNotFoundError )
657
+
658
+ description = "The child object(s) could not be found."
659
+
660
+ elsif exception.kind_of?( MobyBase::TestObjectNotVisibleError )
661
+
662
+ description = "Parent test object no longer visible."
663
+
664
+ else
665
+
666
+ description = "Failed when trying to find child object(s)."
667
+
668
+ end
669
+
670
+ TDriver.logger.behaviour(
671
+
672
+ "%s;%s;%s;%s;%s" % [ "FAIL", description, identity, multiple_objects ? "children" : "child", creation_data.inspect ]
673
+
674
+ )
675
+
676
+ Kernel::raise exception
677
+
678
+ ensure
679
+
680
+ # restore logger state
681
+ MobyUtil::Logger.instance.pop_enabled
682
+
683
+ end
684
+
685
+ end
686
+
687
+ # Creates a string identifying this test object: sut, type, attributes used when created
688
+ #
689
+ # === returns
690
+ # String:: String identifying this test object
691
+ def identity
692
+
693
+ #"%s;%s;%s" % [ @sut.id, @type, @creation_attributes.inspect ]
694
+ "#{ @sut.id };#{ @type };#{ @creation_attributes.inspect }"
695
+
696
+ end
697
+
698
+ def find_attribute( name )
699
+
700
+ # store xml data to variable, due to xml_data is a function that returns result of xpath to sut.xml_data
701
+ _xml_data = nil
702
+ begin
703
+ _xml_data = xml_data
704
+ rescue MobyBase::TestObjectNotFoundError
705
+ #lets refresh if not found initially
706
+ refresh_args = ( @creation_attributes[ :type ] == 'application' ? { :name => @creation_attributes[ :name ], :id => @creation_attributes[ :id ] } : { :id => get_application_id } )
707
+
708
+ refresh( refresh_args)
709
+ _xml_data = xml_data
710
+ end
711
+
712
+ # convert name to string if variable type is symbol
713
+ name = name.to_s if name.kind_of?( Symbol )
714
+
715
+ # raise exception if attribute name variable type is other than string
716
+ Kernel::raise ArgumentError.new( "Wrong argument type %s for attribute argument (expected String)" % name.class ) unless name.kind_of?( String )
717
+
718
+ # raise eception if xml data is empty or nil
719
+ Kernel::raise MobyBase::TestObjectNotInitializedError.new if _xml_data.nil? || _xml_data.to_s.empty?
720
+
721
+ # retrieve attribute(s) from xml
722
+ #nodeset = _xml_data.xpath( "attributes/attribute[translate(@name,'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz')='%s']" % name.downcase )
723
+ nodeset = _xml_data.xpath( "attributes/attribute[translate(@name,'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz')='#{ name.downcase }']" )
724
+
725
+ # raise exception if no such attribute found
726
+ Kernel::raise MobyBase::AttributeNotFoundError.new( "Could not find attribute '%s' for test object of type '%s'." % [ name, type ] ) if nodeset.empty?
727
+
728
+ # Need to disable this for now #Kernel::raise MobyBase::MultipleAttributesFoundError.new( "Multiple attributes found with name '%s'" % name ) if nodeset.count > 1
729
+
730
+ # return found attribute
731
+ nodeset.first.content.strip
732
+
733
+ end
734
+
735
+ # this method will be automatically invoked after module is extended to sut object
736
+ def self.extended( target_object )
737
+
738
+ target_object.instance_exec{
739
+
740
+ initialize_settings
741
+
742
+ }
743
+
744
+ end
745
+
746
+ def initialize_settings
747
+
748
+ # defaults
749
+ @_application_id = nil
750
+ @creation_attributes = nil
751
+
752
+ @_child_object_cache = {}
753
+
754
+ activate
755
+
756
+ end
757
+
758
+ # == description
759
+ # Returns the actual test object that was used as the parent when this object instance was created. For getting the parent object in the UI object hierarchy,
760
+ # see get_parent.
761
+ #
762
+ # == returns
763
+ # TestObject:: test object that was used as parent when this object was created. Can also be of type SUT if sut was the parent (ie. application objects)
764
+
765
+ public
766
+
767
+ # This method is deprecated, please use [link="#GenericTestObject:parent"]TestObject#parent[/link] instead.
768
+ # == deprecated
769
+ # 0.8.x
770
+ #
771
+ # == description
772
+ # This method is deprecated, please use TestObject#parent
773
+ #
774
+ def parent_object()
775
+
776
+ $stderr.puts "warning: TestObject#parent_object is deprecated, please use TestObject#parent instead."
777
+
778
+ @parent
779
+
780
+ end
781
+
782
+ # enable hooking for performance measurement & debug logging
783
+ MobyUtil::Hooking.instance.hook_methods( self ) if defined?( MobyUtil::Hooking )
784
+
785
+ end # TestObject
786
+
787
+ end # MobyBehaviour