testability-driver 1.0.3 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/tdriver-devtools/behaviour/xml/rdoc_behaviour_xml_generator.rb +2 -2
- data/lib/tdriver-devtools/tdriver-devtools.rb +1 -1
- data/lib/tdriver-devtools/tests/feature_tests/lib/custom_rdoc_generator.rb +3 -3
- data/lib/tdriver/base/behaviour/behaviours/object_behaviour_composition.rb +6 -1
- data/lib/tdriver/base/behaviour/behaviours/object_behaviour_description.rb +5 -3
- data/lib/tdriver/base/behaviour/behaviours/object_composition.rb +1 -1
- data/lib/tdriver/base/behaviour/factory.rb +225 -225
- data/lib/tdriver/base/errors.rb +1 -1
- data/lib/tdriver/base/state_object.rb +227 -179
- data/lib/tdriver/base/sut/controller.rb +2 -2
- data/lib/tdriver/base/sut/factory.rb +190 -182
- data/lib/tdriver/base/sut/generic/behaviours/application.rb +69 -25
- data/lib/tdriver/base/sut/generic/behaviours/controller.rb +1 -1
- data/lib/tdriver/base/sut/generic/behaviours/find.rb +4 -4
- data/lib/tdriver/base/sut/generic/behaviours/flash_behaviour.rb +3 -3
- data/lib/tdriver/base/sut/generic/behaviours/sut.rb +350 -165
- data/lib/tdriver/base/sut/generic/behaviours/switchbox_behaviour.rb +9 -9
- data/lib/tdriver/base/sut/generic/behaviours/verification.rb +191 -103
- data/lib/tdriver/base/sut/generic/commands/application.rb +1 -1
- data/lib/tdriver/base/sut/generic/commands/key_sequence.rb +1 -1
- data/lib/tdriver/base/sut/generic/commands/screen_capture.rb +1 -1
- data/lib/tdriver/base/sut/generic/plugin.rb +1 -1
- data/lib/tdriver/base/sut/sut.rb +5 -1
- data/lib/tdriver/base/test_object/abstract.rb +136 -151
- data/lib/tdriver/base/test_object/adapter.rb +293 -82
- data/lib/tdriver/base/test_object/behaviours/syncronization.rb +20 -17
- data/lib/tdriver/base/test_object/behaviours/test_object.rb +159 -532
- data/lib/tdriver/base/test_object/cache.rb +1 -1
- data/lib/tdriver/base/test_object/factory.rb +254 -605
- data/lib/tdriver/base/test_object/identificator.rb +1 -1
- data/lib/tdriver/base/test_object/loader.rb +1 -1
- data/lib/tdriver/base/test_object/verification.rb +17 -17
- data/lib/tdriver/loader.rb +20 -9
- data/lib/tdriver/report/report.rb +5 -0
- data/lib/tdriver/report/report_creator.rb +2 -2
- data/lib/tdriver/report/report_cucumber_listener.rb +4 -4
- data/lib/tdriver/report/report_cucumber_reporter.rb +4 -4
- data/lib/tdriver/report/report_execution_statistics.rb +22 -22
- data/lib/tdriver/report/report_grouping.rb +2 -2
- data/lib/tdriver/report/report_javascript.rb +11 -4
- data/lib/tdriver/report/report_test_case_run.rb +2 -2
- data/lib/tdriver/report/report_test_run.rb +5 -5
- data/lib/tdriver/report/report_test_unit.rb +74 -26
- data/lib/tdriver/report/report_writer.rb +70 -13
- data/lib/tdriver/tdriver.rb +17 -8
- data/lib/tdriver/util/common/array.rb +1 -1
- data/lib/tdriver/util/common/crc16.rb +1 -1
- data/lib/tdriver/util/common/environment.rb +1 -1
- data/lib/tdriver/util/common/file.rb +18 -9
- data/lib/tdriver/util/common/gem.rb +1 -1
- data/lib/tdriver/util/common/hash.rb +21 -0
- data/lib/tdriver/util/common/kernel.rb +1 -1
- data/lib/tdriver/util/common/loader.rb +5 -2
- data/lib/tdriver/util/common/numeric.rb +54 -3
- data/lib/tdriver/util/common/retryable.rb +30 -12
- data/lib/tdriver/util/common/stackable.rb +185 -0
- data/lib/tdriver/util/common/string.rb +21 -5
- data/lib/tdriver/util/{dbaccess/dbaccess.rb → database/access.rb} +4 -1
- data/lib/tdriver/util/{dbaccess/dbconnection.rb → database/connection.rb} +3 -0
- data/lib/tdriver/util/{dbaccess → database}/error.rb +0 -1
- data/lib/tdriver/util/{dbaccess → database}/loader.rb +5 -6
- data/lib/tdriver/util/{dynamic_attribute_filter.rb → filters/dynamic_attributes.rb} +1 -1
- data/lib/tdriver/util/hooking/hooking.rb +477 -0
- data/lib/tdriver/util/loader.rb +35 -29
- data/lib/tdriver/util/localisation/error.rb +0 -1
- data/lib/tdriver/util/localisation/loader.rb +1 -4
- data/lib/tdriver/util/localisation/localisation.rb +30 -27
- data/lib/tdriver/util/{common.rb → logger/loader.rb} +2 -4
- data/lib/tdriver/util/logger/logger.rb +574 -0
- data/lib/tdriver/util/operator_data/loader.rb +4 -3
- data/lib/tdriver/util/operator_data/operator_data.rb +5 -5
- data/lib/tdriver/util/parameter/parameter.rb +7 -1
- data/lib/tdriver/util/parameter/parameter_hash.rb +1 -1
- data/lib/tdriver/util/parameter/parameter_template.rb +1 -1
- data/lib/tdriver/util/parameter/parameter_user_api.rb +28 -20
- data/lib/tdriver/util/parameter/parameter_xml.rb +1 -1
- data/lib/tdriver/util/plugin/abstract.rb +1 -1
- data/lib/tdriver/util/plugin/service.rb +1 -1
- data/lib/tdriver/util/{localisation.rb → recorder/loader.rb} +4 -3
- data/lib/tdriver/util/recorder/recorder.rb +66 -0
- data/lib/tdriver/util/recorder/scripter.rb +258 -0
- data/lib/tdriver/util/{stats.rb → statistics/statistics.rb} +7 -8
- data/lib/tdriver/util/user_data/error.rb +0 -1
- data/lib/tdriver/util/user_data/loader.rb +1 -2
- data/lib/tdriver/util/user_data/user_data.rb +6 -6
- data/lib/tdriver/util/video/camera.rb +67 -0
- data/lib/tdriver/util/video/camera_linux.rb +139 -0
- data/lib/tdriver/util/video/camera_windows.rb +174 -0
- data/lib/tdriver/util/video/loader.rb +31 -0
- data/lib/tdriver/util/video/video_utils.rb +139 -0
- data/lib/tdriver/util/xml/abstraction.rb +56 -5
- data/lib/tdriver/util/xml/builder.rb +2 -5
- data/lib/tdriver/util/{parameter.rb → xml/comment.rb} +10 -2
- data/lib/tdriver/util/xml/loader.rb +32 -22
- data/lib/tdriver/util/xml/nil_node.rb +2 -2
- data/lib/tdriver/util/xml/parsers/loader.rb +0 -1
- data/lib/tdriver/util/xml/parsers/nokogiri/abstraction.rb +18 -44
- data/lib/tdriver/util/xml/parsers/nokogiri/attribute.rb +9 -13
- data/lib/tdriver/util/xml/parsers/nokogiri/builder.rb +9 -3
- data/lib/tdriver/util/xml/parsers/nokogiri/comment.rb +39 -0
- data/lib/tdriver/util/xml/parsers/nokogiri/document.rb +6 -11
- data/lib/tdriver/util/xml/parsers/nokogiri/element.rb +2 -122
- data/lib/tdriver/util/xml/parsers/nokogiri/loader.rb +26 -16
- data/lib/tdriver/util/xml/parsers/nokogiri/node.rb +203 -0
- data/lib/tdriver/util/xml/parsers/nokogiri/nodeset.rb +1 -2
- data/lib/tdriver/util/xml/parsers/nokogiri/text.rb +2 -20
- data/lib/tdriver/util/xml/xml.rb +52 -20
- data/lib/tdriver/verify/verify.rb +238 -81
- data/xml/behaviours/generic.xml +12 -10
- metadata +156 -180
- data/lib/tdriver/base/test_object/factory_new.rb +0 -202
- data/lib/tdriver/util/hooking.rb +0 -434
- data/lib/tdriver/util/logger.rb +0 -506
- data/lib/tdriver/util/recorder.rb +0 -297
- data/lib/tdriver/util/video_utils.rb +0 -384
- data/lib/tdriver/util/xml/nil_element.rb +0 -89
@@ -125,7 +125,7 @@ module TDriver
|
|
125
125
|
end
|
126
126
|
|
127
127
|
# enable hooking for performance measurement & debug logging
|
128
|
-
|
128
|
+
TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
|
129
129
|
|
130
130
|
end # TestObjectCache
|
131
131
|
|
@@ -16,419 +16,6 @@
|
|
16
16
|
## of this file.
|
17
17
|
##
|
18
18
|
############################################################################
|
19
|
-
module TDriver
|
20
|
-
|
21
|
-
class TestObjectFactory
|
22
|
-
|
23
|
-
attr_reader :test_object_adapter, :timeout, :retry_interval
|
24
|
-
|
25
|
-
# TODO: move to test object adapter
|
26
|
-
# TODO: This method should be in application test object
|
27
|
-
def get_layout_direction( sut )
|
28
|
-
|
29
|
-
sut.xml_data.at_xpath('*//object[@type="application"]/attributes/attribute[@name="layoutDirection"]/value/text()').to_s || 'LeftToRight'
|
30
|
-
|
31
|
-
end
|
32
|
-
|
33
|
-
def initialize( options )
|
34
|
-
|
35
|
-
@test_object_adapter = options[ :test_object_adapter ]
|
36
|
-
|
37
|
-
@timeout = options[ :timeout ] || MobyUtil::Parameter[ :application_synchronization_timeout, "20" ].to_i
|
38
|
-
|
39
|
-
@retry_interval = options[ :retry_interval ] || MobyUtil::Parameter[ :application_synchronization_retry_interval, "1" ].to_i
|
40
|
-
|
41
|
-
end
|
42
|
-
|
43
|
-
# Function to set timeout for TestObjectFactory
|
44
|
-
# This should be used only in unit testing, otherwise should not be used
|
45
|
-
# sets timeout used in identifying TestObjects to new timeout
|
46
|
-
#
|
47
|
-
# == params
|
48
|
-
# new_timeout:: Fixnum which defines the new timeout
|
49
|
-
# == raises
|
50
|
-
# ArgumentError:: if parameter is not kind of Fixnum
|
51
|
-
def timeout=( value )
|
52
|
-
|
53
|
-
value.check_type( Numeric, "Wrong argument type $1 for timeout value (expected $2)" )
|
54
|
-
|
55
|
-
@timeout = value
|
56
|
-
|
57
|
-
end
|
58
|
-
|
59
|
-
def retry_interval=( value )
|
60
|
-
|
61
|
-
value.check_type( Numeric, "Wrong argument type $1 for timeout retry interval value (expected $2)" )
|
62
|
-
|
63
|
-
@retry_interval = value
|
64
|
-
|
65
|
-
end
|
66
|
-
|
67
|
-
# TODO: document me
|
68
|
-
def get_test_objects( rules )
|
69
|
-
|
70
|
-
# store rules hash to variable
|
71
|
-
object_attributes_hash = rules[ :object_attributes_hash ].clone
|
72
|
-
|
73
|
-
# remove test object identification directives for object identification attributes hash (e.g. :__index, :__multiple_objects etc.)
|
74
|
-
identification_directives = rules[ :identification_directives ]
|
75
|
-
|
76
|
-
#object_attributes_hash.strip_dynamic_attributes!
|
77
|
-
|
78
|
-
# get parent object
|
79
|
-
parent = rules[ :parent ]
|
80
|
-
|
81
|
-
# retrieve sut object
|
82
|
-
sut = parent.kind_of?( MobyBase::SUT ) ? parent : parent.sut
|
83
|
-
|
84
|
-
# create application refresh attributes hash
|
85
|
-
if object_attributes_hash[ :type ] == 'application'
|
86
|
-
|
87
|
-
# collect :name, :id and :applicationUid from object_attributes_hash if found
|
88
|
-
refresh_arguments = object_attributes_hash.collect_keys( :name, :id, :applicationUid )
|
89
|
-
|
90
|
-
else
|
91
|
-
|
92
|
-
if parent.kind_of?( MobyBase::TestObject )
|
93
|
-
|
94
|
-
# get current application for test object
|
95
|
-
refresh_arguments = { :id => parent.get_application_id }
|
96
|
-
|
97
|
-
elsif parent.kind_of?( MobyBase::SUT )
|
98
|
-
|
99
|
-
# get current application for sut
|
100
|
-
refresh_arguments = { :id => sut.current_application_id }
|
101
|
-
|
102
|
-
end
|
103
|
-
|
104
|
-
end
|
105
|
-
|
106
|
-
# set default values
|
107
|
-
identification_directives.default_values(
|
108
|
-
|
109
|
-
# associated sut
|
110
|
-
:__sut => sut,
|
111
|
-
|
112
|
-
# new child objects parent object
|
113
|
-
:__parent => parent,
|
114
|
-
|
115
|
-
# get timeout from rules hash or TestObjectFactory
|
116
|
-
:__timeout => @timeout,
|
117
|
-
|
118
|
-
# get retry interval from rules hash or TestObjectFactory
|
119
|
-
:__retry_interval => @retry_interval,
|
120
|
-
|
121
|
-
# determine that are we going to retrieve multiple test objects or just one
|
122
|
-
:__multiple_objects => false,
|
123
|
-
|
124
|
-
# determine that should all child objects childrens be retrieved
|
125
|
-
:__find_all_children => true,
|
126
|
-
|
127
|
-
# determine that did user give index value
|
128
|
-
:__index_given => identification_directives.has_key?( :__index ),
|
129
|
-
|
130
|
-
# determine index of test object to be retrieved
|
131
|
-
:__index => 0,
|
132
|
-
|
133
|
-
:__refresh_arguments => refresh_arguments,
|
134
|
-
|
135
|
-
# make search params
|
136
|
-
:__search_params => get_parent_params( parent ).push( make_object_search_params( object_attributes_hash ) ),
|
137
|
-
|
138
|
-
:__xy_sorting => false,
|
139
|
-
|
140
|
-
# test object identificator to be used
|
141
|
-
:__test_object_identificator => MobyBase::TestObjectIdentificator.new( object_attributes_hash )
|
142
|
-
|
143
|
-
)
|
144
|
-
|
145
|
-
identification_directives[ :__index ].check_type( Fixnum, "Wrong value type $1 for :__index test object identification directive (expected $2)" )
|
146
|
-
|
147
|
-
# add object identification attribute keys to dynamic attributes white list
|
148
|
-
MobyUtil::DynamicAttributeFilter.instance.add_attributes( object_attributes_hash.keys )
|
149
|
-
|
150
|
-
child_objects = identify_object( object_attributes_hash, identification_directives, rules ).collect{ | test_object_xml |
|
151
|
-
|
152
|
-
# create new test object
|
153
|
-
make_test_object(
|
154
|
-
|
155
|
-
# sut object to t_o
|
156
|
-
:sut => identification_directives[ :__sut ],
|
157
|
-
|
158
|
-
# parent object to t_o
|
159
|
-
:parent => identification_directives[ :__parent ],
|
160
|
-
|
161
|
-
# t_o xml
|
162
|
-
:xml_object => test_object_xml,
|
163
|
-
|
164
|
-
# test object factory
|
165
|
-
:test_object_factory => self,
|
166
|
-
|
167
|
-
:object_attributes_hash => object_attributes_hash
|
168
|
-
|
169
|
-
)
|
170
|
-
|
171
|
-
}
|
172
|
-
|
173
|
-
# return test object(s); either one or multiple objects
|
174
|
-
identification_directives[ :__multiple_objects ] ? child_objects : child_objects.first
|
175
|
-
|
176
|
-
end
|
177
|
-
|
178
|
-
# TODO: document me
|
179
|
-
def identify_object( object_attributes_hash, identification_directives, rules )
|
180
|
-
|
181
|
-
MobyUtil::Retryable.until(
|
182
|
-
|
183
|
-
# maximum time used for retrying, if timeout exceeds pass last raised exception
|
184
|
-
:timeout => identification_directives[ :__timeout ],
|
185
|
-
|
186
|
-
# interval used before retrying
|
187
|
-
:interval => identification_directives[ :__retry_interval ],
|
188
|
-
|
189
|
-
# following exceptions are allowed; Retry until timeout exceeds or other exception type is raised
|
190
|
-
:exception => [ MobyBase::TestObjectNotFoundError, MobyBase::MultipleTestObjectsIdentifiedError ]
|
191
|
-
|
192
|
-
){
|
193
|
-
|
194
|
-
# refresh sut
|
195
|
-
identification_directives[ :__sut ].refresh( identification_directives[ :__refresh_arguments ], identification_directives[ :__search_params ] )
|
196
|
-
|
197
|
-
matches, rule = identification_directives[ :__test_object_identificator ].find_objects(
|
198
|
-
identification_directives[ :__parent ].xml_data,
|
199
|
-
identification_directives[ :__find_all_children ]
|
200
|
-
)
|
201
|
-
|
202
|
-
# raise exception if no matching object(s) found
|
203
|
-
raise MobyBase::TestObjectNotFoundError.new(
|
204
|
-
|
205
|
-
"Cannot find object with rule:\n%s" % rules[ :object_attributes_hash ].inspect
|
206
|
-
|
207
|
-
) if matches.empty?
|
208
|
-
|
209
|
-
# raise exception if multiple matches found and only one expected
|
210
|
-
if ( !identification_directives[ :__multiple_objects ] ) && ( matches.count > 1 && !identification_directives[ :__index_given ] )
|
211
|
-
|
212
|
-
# raise exception (with list of paths to all matching objects) if multiple objects flag is false and more than one match found
|
213
|
-
raise MobyBase::MultipleTestObjectsIdentifiedError.new(
|
214
|
-
|
215
|
-
"Multiple test objects found with rule: %s\nMatching objects:\n%s\n" % [
|
216
|
-
rules[ :object_attributes_hash ].inspect,
|
217
|
-
list_matching_test_objects( matches ).each_with_index.collect{ | object, object_index | "%3s) %s" % [ object_index + 1, object ] }.join( "\n" )
|
218
|
-
]
|
219
|
-
)
|
220
|
-
|
221
|
-
end
|
222
|
-
|
223
|
-
# sort matches
|
224
|
-
if identification_directives[ :__xy_sorting ] == true
|
225
|
-
|
226
|
-
# sort elements
|
227
|
-
identification_directives[ :__test_object_identificator ].sort_elements_by_xy_layout!(
|
228
|
-
|
229
|
-
matches,
|
230
|
-
|
231
|
-
get_layout_direction( identification_directives[ :__sut ] )
|
232
|
-
|
233
|
-
)
|
234
|
-
|
235
|
-
end
|
236
|
-
|
237
|
-
# return result
|
238
|
-
if identification_directives[ :__multiple_objects ] && !identification_directives[ :__index_given ]
|
239
|
-
|
240
|
-
# return multiple test objects
|
241
|
-
matches.to_a
|
242
|
-
|
243
|
-
else
|
244
|
-
|
245
|
-
# return only one test object
|
246
|
-
[ matches[ identification_directives[ :__index ] ] ]
|
247
|
-
|
248
|
-
end
|
249
|
-
|
250
|
-
}
|
251
|
-
|
252
|
-
end
|
253
|
-
|
254
|
-
def make_test_object( rules )
|
255
|
-
|
256
|
-
# get test object factory object from hash
|
257
|
-
test_object_factory = rules[ :test_object_factory ]
|
258
|
-
|
259
|
-
# get sut object from hash
|
260
|
-
sut = rules[ :sut ]
|
261
|
-
|
262
|
-
# get parent object from hash
|
263
|
-
parent = rules[ :parent]
|
264
|
-
|
265
|
-
xml_object = rules[ :xml_object ]
|
266
|
-
|
267
|
-
if xml_object.kind_of?( MobyUtil::XML::Element )
|
268
|
-
|
269
|
-
# retrieve test object id from xml
|
270
|
-
object_id = xml_object.attribute( 'id' ).to_i
|
271
|
-
|
272
|
-
# retrieve test object name from xml
|
273
|
-
object_name = xml_object.attribute( 'name' ).to_s
|
274
|
-
|
275
|
-
# retrieve test object type from xml
|
276
|
-
object_type = xml_object.attribute( 'type' ).to_s
|
277
|
-
|
278
|
-
# retrieve test object type from xml
|
279
|
-
env = ( xml_object.attribute( 'env' ) || MobyUtil::Parameter[ sut.id ][ :env ] ).to_s
|
280
|
-
|
281
|
-
else
|
282
|
-
|
283
|
-
# defaults - refactor this
|
284
|
-
object_type = ""
|
285
|
-
|
286
|
-
object_name = ""
|
287
|
-
|
288
|
-
object_id = 0
|
289
|
-
|
290
|
-
env = MobyUtil::Parameter[ sut.id ][ :env ].to_s
|
291
|
-
|
292
|
-
end
|
293
|
-
|
294
|
-
# calculate object cache hash key
|
295
|
-
hash_key = ( ( ( 17 * 37 + object_id ) * 37 + object_type.hash ) * 37 + object_name.hash )
|
296
|
-
|
297
|
-
# (DO NOT!!) remove object type from object attributes hash_rule
|
298
|
-
#rules[ :object_attributes_hash ].delete( :type )
|
299
|
-
|
300
|
-
# get reference to parent objects child objects cache
|
301
|
-
parent_cache = rules[ :parent ].instance_variable_get( :@child_object_cache )
|
302
|
-
|
303
|
-
# get cached test object from parents child objects cache if found; if not found from cache pass newly created object as is
|
304
|
-
if parent_cache.has_object?( hash_key )
|
305
|
-
|
306
|
-
# get test object from cache
|
307
|
-
test_object = parent_cache[ hash_key ]
|
308
|
-
|
309
|
-
test_object.xml_data = xml_object
|
310
|
-
|
311
|
-
else
|
312
|
-
|
313
|
-
test_object = MobyBase::TestObject.new( test_object_factory, sut, parent, xml_object )
|
314
|
-
|
315
|
-
# apply behaviours to test object
|
316
|
-
test_object.extend( MobyBehaviour::ObjectBehaviourComposition )
|
317
|
-
|
318
|
-
# apply behaviours to test object
|
319
|
-
test_object.apply_behaviour!(
|
320
|
-
:object_type => [ '*', object_type ],
|
321
|
-
#:sut_type => [ '*', sut.ui_type ],
|
322
|
-
:input_type => [ '*', sut.input.to_s ],
|
323
|
-
:env => [ '*', *env.split(";") ],
|
324
|
-
:version => [ '*', sut.ui_version ]
|
325
|
-
)
|
326
|
-
|
327
|
-
# create child accessors
|
328
|
-
TDriver::TestObjectAdapter.create_child_accessors!( xml_object, test_object )
|
329
|
-
|
330
|
-
# set given parent in rules hash as parent object to new child test object
|
331
|
-
test_object.instance_variable_set( :@parent, parent )
|
332
|
-
|
333
|
-
# add created test object to parents child objects cache
|
334
|
-
parent_cache.add_object( test_object )
|
335
|
-
|
336
|
-
end
|
337
|
-
|
338
|
-
# update test objects creation attributes (either cached object or just newly created child object)
|
339
|
-
test_object.instance_variable_set( :@creation_attributes, rules[ :object_attributes_hash ].clone )
|
340
|
-
|
341
|
-
# do not make test object verifications if we are operating on the
|
342
|
-
# base sut itself (allow run to pass)
|
343
|
-
unless parent.kind_of?( MobyBase::SUT )
|
344
|
-
|
345
|
-
TDriver::TestObjectVerification.verify_ui_dump( sut ) unless sut.verify_blocks.empty?
|
346
|
-
|
347
|
-
end
|
348
|
-
|
349
|
-
test_object
|
350
|
-
|
351
|
-
end
|
352
|
-
|
353
|
-
def make_object_search_params( creation_attributes )
|
354
|
-
|
355
|
-
if creation_attributes[ :type ] != 'application'
|
356
|
-
|
357
|
-
object_search_params = creation_attributes.clone
|
358
|
-
|
359
|
-
object_search_params[ :className ] = object_search_params.delete( :type ) if creation_attributes.has_key?( :type )
|
360
|
-
object_search_params[ :objectName ] = object_search_params.delete( :name ) if creation_attributes.has_key?( :name )
|
361
|
-
|
362
|
-
object_search_params
|
363
|
-
|
364
|
-
else
|
365
|
-
|
366
|
-
{}
|
367
|
-
|
368
|
-
end
|
369
|
-
|
370
|
-
end
|
371
|
-
|
372
|
-
def get_parent_params( test_object )
|
373
|
-
|
374
|
-
unless [ 'application', 'sut' ].include?( test_object.type )
|
375
|
-
|
376
|
-
search_params.concat( get_parent_params( test_object.parent ) ) if test_object.parent
|
377
|
-
search_params.concat( [ { :className => test_object.type, :tasId => test_object.id } ] ) #if test_object
|
378
|
-
|
379
|
-
search_params
|
380
|
-
|
381
|
-
else
|
382
|
-
|
383
|
-
[]
|
384
|
-
|
385
|
-
end
|
386
|
-
|
387
|
-
end
|
388
|
-
|
389
|
-
private
|
390
|
-
|
391
|
-
def list_matching_test_objects( matches )
|
392
|
-
|
393
|
-
matches.collect{ | object |
|
394
|
-
|
395
|
-
path = [ object.attribute("type") ]
|
396
|
-
|
397
|
-
while object.attribute("type") != 'application' do
|
398
|
-
|
399
|
-
# object/objects/object/../..
|
400
|
-
object = object.parent.parent
|
401
|
-
|
402
|
-
path << object.attribute("type")
|
403
|
-
|
404
|
-
end
|
405
|
-
|
406
|
-
path.reverse.join(".")
|
407
|
-
|
408
|
-
}.sort
|
409
|
-
|
410
|
-
end
|
411
|
-
|
412
|
-
end # TestObjectFactory
|
413
|
-
|
414
|
-
end # TDriver
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
19
|
|
433
20
|
module MobyBase
|
434
21
|
|
@@ -446,14 +33,13 @@ module MobyBase
|
|
446
33
|
def initialize
|
447
34
|
|
448
35
|
# get timeout from parameters, use default value if parameter not found
|
449
|
-
@timeout =
|
36
|
+
@timeout = $parameters[ :application_synchronization_timeout, "20" ].to_f
|
450
37
|
|
451
38
|
# get timeout retry interval from parameters, use default value if parameter not found
|
452
|
-
@_retry_interval =
|
39
|
+
@_retry_interval = $parameters[ :application_synchronization_retry_interval, "1" ].to_f
|
453
40
|
|
454
41
|
end
|
455
42
|
|
456
|
-
#TODO: Team TE review @ Wheels
|
457
43
|
# Function to set timeout for TestObjectFactory
|
458
44
|
# This should be used only in unit testing, otherwise should not be used
|
459
45
|
# sets timeout used in identifying TestObjects to new timeout
|
@@ -471,63 +57,93 @@ module MobyBase
|
|
471
57
|
end
|
472
58
|
|
473
59
|
# TODO: document me
|
474
|
-
def identify_object(
|
60
|
+
def identify_object( rules )
|
475
61
|
|
62
|
+
# retrieve test object identification directives; e.g. :__index, :__xy_sorting etc
|
63
|
+
directives = rules[ :identification_directives ]
|
64
|
+
|
65
|
+
# retrieve sut object
|
66
|
+
sut = rules[ :parent ].instance_variable_get( :@sut )
|
67
|
+
|
68
|
+
# search parameters for find_objects feature
|
69
|
+
search_parameters = make_object_search_params( rules[ :parent ], rules[ :object_attributes_hash ] )
|
70
|
+
|
71
|
+
# default rules
|
72
|
+
directives.default_values(
|
73
|
+
|
74
|
+
# get timeout from rules hash or TestObjectFactory
|
75
|
+
:__timeout => @timeout,
|
76
|
+
|
77
|
+
# get retry interval from rules hash or TestObjectFactory
|
78
|
+
:__retry_interval => @_retry_interval,
|
79
|
+
|
80
|
+
# determine that are we going to retrieve multiple test objects or just one
|
81
|
+
:__multiple_objects => false,
|
82
|
+
|
83
|
+
# determine that should all child objects childrens be retrieved
|
84
|
+
:__find_all_children => true,
|
85
|
+
|
86
|
+
# determine that did user give index value
|
87
|
+
:__index_given => directives.has_key?( :__index ),
|
88
|
+
|
89
|
+
# use sorting if index given
|
90
|
+
:__xy_sorting => directives.has_key?( :__index ),
|
91
|
+
|
92
|
+
# determine index of test object to be retrieved
|
93
|
+
:__index => 0
|
94
|
+
|
95
|
+
)
|
96
|
+
|
97
|
+
# identify objects until desired matches found or timeout exceeds
|
476
98
|
MobyUtil::Retryable.until(
|
477
99
|
|
478
100
|
# maximum time used for retrying, if timeout exceeds pass last raised exception
|
479
|
-
:timeout =>
|
101
|
+
:timeout => directives[ :__timeout ],
|
480
102
|
|
481
103
|
# interval used before retrying
|
482
|
-
:interval =>
|
104
|
+
:interval => directives[ :__retry_interval ],
|
483
105
|
|
484
106
|
# following exceptions are allowed; Retry until timeout exceeds or other exception type is raised
|
485
|
-
:exception => [ MobyBase::TestObjectNotFoundError, MobyBase::MultipleTestObjectsIdentifiedError ]
|
107
|
+
:exception => [ MobyBase::TestObjectNotFoundError, MobyBase::MultipleTestObjectsIdentifiedError ]
|
486
108
|
|
487
109
|
){
|
488
110
|
|
489
111
|
# refresh sut
|
490
|
-
|
491
|
-
|
492
|
-
matches, rule = identification_directives[ :__test_object_identificator ].find_objects(
|
493
|
-
identification_directives[ :__parent ].xml_data,
|
494
|
-
identification_directives[ :__find_all_children ]
|
495
|
-
)
|
112
|
+
sut.refresh( directives[ :__refresh_arguments ], search_parameters )
|
496
113
|
|
497
|
-
#
|
498
|
-
|
114
|
+
# retrieve objects from xml
|
115
|
+
matches, rule = TDriver::TestObjectAdapter.get_objects(
|
499
116
|
|
500
|
-
|
117
|
+
rules[ :parent ].xml_data,
|
118
|
+
rules[ :object_attributes_hash ],
|
119
|
+
directives[ :__find_all_children ]
|
501
120
|
|
502
|
-
)
|
121
|
+
)
|
122
|
+
|
123
|
+
# raise exception if no matching object(s) found
|
124
|
+
raise MobyBase::TestObjectNotFoundError, "Cannot find object with rule:\n#{ rules[ :object_attributes_hash ].inspect }" if matches.empty?
|
503
125
|
|
504
126
|
# raise exception if multiple matches found and only one expected
|
505
|
-
if ( !
|
127
|
+
if ( !directives[ :__multiple_objects ] ) && ( matches.count > 1 && !directives[ :__index_given ] )
|
506
128
|
|
507
129
|
# raise exception (with list of paths to all matching objects) if multiple objects flag is false and more than one match found
|
508
|
-
raise MobyBase::MultipleTestObjectsIdentifiedError.
|
509
|
-
|
510
|
-
"Multiple test objects found with rule: %s\nMatching objects:\n%s\n" % [
|
511
|
-
rules[ :object_attributes_hash ].inspect,
|
512
|
-
list_matching_test_objects( matches ).each_with_index.collect{ | object, object_index | "%3s) %s" % [ object_index + 1, object ] }.join( "\n" )
|
513
|
-
]
|
514
|
-
)
|
130
|
+
raise MobyBase::MultipleTestObjectsIdentifiedError, "Multiple test objects found with rule: #{ rules[ :object_attributes_hash ].inspect }\nMatching objects:\n#{ list_matching_test_objects_as_list( matches ) }\n"
|
515
131
|
|
516
132
|
end
|
517
133
|
|
518
|
-
# sort matches
|
519
|
-
if
|
520
|
-
|
134
|
+
# sort matches if enabled
|
135
|
+
if directives[ :__xy_sorting ] == true
|
136
|
+
|
521
137
|
# sort elements
|
522
138
|
TDriver::TestObjectAdapter.sort_elements(
|
523
139
|
matches,
|
524
|
-
TDriver::TestObjectAdapter.application_layout_direction(
|
140
|
+
TDriver::TestObjectAdapter.application_layout_direction( sut )
|
525
141
|
)
|
526
142
|
|
527
143
|
end
|
528
144
|
|
529
|
-
# return result
|
530
|
-
if
|
145
|
+
# return result; one or multiple xml elements
|
146
|
+
if directives[ :__multiple_objects ] && !directives[ :__index_given ]
|
531
147
|
|
532
148
|
# return multiple test objects
|
533
149
|
matches.to_a
|
@@ -535,7 +151,7 @@ module MobyBase
|
|
535
151
|
else
|
536
152
|
|
537
153
|
# return only one test object
|
538
|
-
[ matches[
|
154
|
+
[ matches[ directives[ :__index ] ] ]
|
539
155
|
|
540
156
|
end
|
541
157
|
|
@@ -575,92 +191,107 @@ module MobyBase
|
|
575
191
|
value.check_type( type, "Wrong variable type $1 for #{ key.inspect } test object identification directive (expected $2)" ) unless type.nil?
|
576
192
|
|
577
193
|
}
|
578
|
-
|
579
|
-
#
|
580
|
-
|
581
|
-
|
582
|
-
|
583
|
-
|
584
|
-
|
585
|
-
# create application refresh attributes hash
|
586
|
-
if object_attributes_hash[ :type ] == 'application'
|
194
|
+
|
195
|
+
# do not create refresh arguments hash if already exists
|
196
|
+
unless identification_directives.has_key?( :__refresh_arguments )
|
197
|
+
|
198
|
+
# create application refresh attributes hash
|
199
|
+
if object_attributes_hash[ :type ] == 'application'
|
587
200
|
|
588
|
-
|
589
|
-
|
201
|
+
# collect :name, :id and :applicationUid from object_attributes_hash if found
|
202
|
+
identification_directives[ :__refresh_arguments ] = object_attributes_hash.collect_keys( :name, :id, :applicationUid )
|
590
203
|
|
591
|
-
|
592
|
-
|
593
|
-
|
204
|
+
else
|
205
|
+
|
206
|
+
if rules[ :parent ].kind_of?( MobyBase::TestObject )
|
594
207
|
|
595
|
-
|
596
|
-
|
208
|
+
# get current application for test object
|
209
|
+
identification_directives[ :__refresh_arguments ] = { :id => rules[ :parent ].get_application_id }
|
597
210
|
|
598
|
-
|
599
|
-
|
600
|
-
|
601
|
-
|
211
|
+
elsif rules[ :parent ].kind_of?( MobyBase::SUT )
|
212
|
+
|
213
|
+
# get current application for sut
|
214
|
+
identification_directives[ :__refresh_arguments ] = { :id => rules[ :parent ].current_application_id }
|
602
215
|
|
216
|
+
end
|
217
|
+
|
603
218
|
end
|
604
|
-
|
219
|
+
|
605
220
|
end
|
606
|
-
|
607
|
-
# set default values
|
608
|
-
identification_directives.default_values(
|
609
221
|
|
610
|
-
|
611
|
-
|
222
|
+
# add object identification attribute keys to dynamic attributes white list
|
223
|
+
MobyUtil::DynamicAttributeFilter.instance.add_attributes( object_attributes_hash.keys )
|
612
224
|
|
613
|
-
|
614
|
-
|
225
|
+
child_objects = identify_object( rules ).collect{ | test_object_xml |
|
226
|
+
|
227
|
+
# create parent application test object if none defined in rules; most likely the call is originated from SUT#child, but not by using SUT#application
|
228
|
+
unless identification_directives.has_key?( :__parent_application ) || rules.has_key?( :parent_application )
|
229
|
+
|
230
|
+
# retrieve application test object xml element
|
231
|
+
application_test_object_xml = TDriver::TestObjectAdapter.retrieve_parent_application( test_object_xml )
|
232
|
+
|
233
|
+
unless application_test_object_xml.nil?
|
234
|
+
|
235
|
+
# retrieve sut object
|
236
|
+
sut = rules[ :parent ].instance_variable_get( :@sut )
|
237
|
+
|
238
|
+
# retrieve test object id from xml
|
239
|
+
object_id = TDriver::TestObjectAdapter.test_object_element_attribute( application_test_object_xml, 'id' ){ nil }.to_i
|
240
|
+
|
241
|
+
# retrieve test object name from xml
|
242
|
+
object_name = TDriver::TestObjectAdapter.test_object_element_attribute( application_test_object_xml, 'name' ){ nil }.to_s
|
243
|
+
|
244
|
+
# retrieve test object type from xml
|
245
|
+
object_type = TDriver::TestObjectAdapter.test_object_element_attribute( application_test_object_xml, 'type' ){ nil }.to_s
|
246
|
+
|
247
|
+
# calculate object cache hash key
|
248
|
+
hash_key = TDriver::TestObjectAdapter.test_object_hash( object_id, object_type, object_name )
|
249
|
+
|
250
|
+
parent_cache = sut.instance_variable_get( :@child_object_cache )
|
615
251
|
|
616
|
-
|
617
|
-
|
618
|
-
|
619
|
-
|
620
|
-
|
621
|
-
|
622
|
-
|
623
|
-
|
252
|
+
# get cached test object from parents child objects cache if found; if not found from cache pass newly created object as is
|
253
|
+
if parent_cache.has_object?( hash_key )
|
254
|
+
|
255
|
+
rules[ :parent_application ] = parent_cache[ hash_key ]
|
256
|
+
|
257
|
+
else
|
258
|
+
|
259
|
+
# create application test object
|
260
|
+
rules[ :parent_application ] = make_test_object(
|
261
|
+
|
262
|
+
:parent => sut,
|
263
|
+
:parent_application => nil,
|
264
|
+
:xml_object => application_test_object_xml
|
265
|
+
|
266
|
+
)
|
267
|
+
|
268
|
+
end
|
624
269
|
|
625
|
-
|
626
|
-
:__find_all_children => true,
|
270
|
+
else
|
627
271
|
|
628
|
-
|
629
|
-
|
272
|
+
# could not retrieve parent application object
|
273
|
+
rules[ :parent_application ] = nil
|
274
|
+
|
275
|
+
end
|
630
276
|
|
631
|
-
|
632
|
-
|
633
|
-
|
634
|
-
|
277
|
+
# store application test object to new test object
|
278
|
+
rules[ :parent_application ].instance_variable_set( :@parent_application, rules[ :parent_application ] )
|
279
|
+
|
280
|
+
end
|
635
281
|
|
636
|
-
# make search params
|
637
|
-
:__search_params => get_parent_params( parent ).push( make_object_search_params( object_attributes_hash ) ),
|
638
|
-
|
639
|
-
# test object identificator to be used
|
640
|
-
:__test_object_identificator => MobyBase::TestObjectIdentificator.new( object_attributes_hash )
|
641
|
-
|
642
|
-
)
|
643
|
-
|
644
|
-
# add object identification attribute keys to dynamic attributes white list
|
645
|
-
MobyUtil::DynamicAttributeFilter.instance.add_attributes( object_attributes_hash.keys )
|
646
|
-
|
647
|
-
child_objects = identify_object( object_attributes_hash, identification_directives, rules ).collect{ | test_object_xml |
|
648
|
-
|
649
282
|
# create new test object
|
650
283
|
make_test_object(
|
651
284
|
|
652
|
-
#
|
653
|
-
:
|
654
|
-
|
655
|
-
# parent object to t_o
|
656
|
-
:parent => identification_directives[ :__parent ],
|
285
|
+
# test objects parent test object
|
286
|
+
:parent => rules[ :parent ],
|
657
287
|
|
658
|
-
#
|
659
|
-
:
|
288
|
+
# test objects parent application
|
289
|
+
:parent_application => rules[ :parent_application ],
|
660
290
|
|
661
|
-
# test object
|
662
|
-
:
|
291
|
+
# xml element to test object
|
292
|
+
:xml_object => test_object_xml,
|
663
293
|
|
294
|
+
# object identification attributes
|
664
295
|
:object_attributes_hash => object_attributes_hash
|
665
296
|
|
666
297
|
)
|
@@ -672,85 +303,16 @@ module MobyBase
|
|
672
303
|
|
673
304
|
end
|
674
305
|
|
675
|
-
|
676
|
-
|
677
|
-
if creation_attributes[ :type ] != 'application'
|
678
|
-
|
679
|
-
object_search_params = creation_attributes.clone
|
680
|
-
|
681
|
-
object_search_params[ :className ] = object_search_params.delete( :type ) if creation_attributes.has_key?( :type )
|
682
|
-
object_search_params[ :objectName ] = object_search_params.delete( :name ) if creation_attributes.has_key?( :name )
|
683
|
-
|
684
|
-
object_search_params
|
685
|
-
|
686
|
-
else
|
687
|
-
|
688
|
-
{}
|
689
|
-
|
690
|
-
end
|
691
|
-
|
692
|
-
end
|
693
|
-
|
694
|
-
def get_parent_params( test_object )
|
695
|
-
|
696
|
-
unless [ 'application', 'sut' ].include?( test_object.type )
|
697
|
-
|
698
|
-
search_params = []
|
699
|
-
|
700
|
-
search_params.concat( get_parent_params( test_object.parent ) ) if test_object.parent
|
701
|
-
search_params.concat( [ :className => test_object.type, :tasId => test_object.id ] ) #if test_object
|
702
|
-
|
703
|
-
search_params
|
704
|
-
|
705
|
-
else
|
706
|
-
|
707
|
-
[]
|
708
|
-
|
709
|
-
end
|
710
|
-
|
711
|
-
end
|
712
|
-
|
713
|
-
private
|
714
|
-
|
715
|
-
def list_matching_test_objects( matches )
|
716
|
-
|
717
|
-
matches.collect{ | object |
|
718
|
-
|
719
|
-
path = [ object.attribute( 'type' ) ]
|
720
|
-
|
721
|
-
while object.attribute( 'type' ) != 'application' do
|
722
|
-
|
723
|
-
# object/objects/object/../..
|
724
|
-
object = object.parent.parent
|
725
|
-
|
726
|
-
path << object.attribute( 'type' )
|
727
|
-
|
728
|
-
end
|
729
|
-
|
730
|
-
path.reverse.join( '.' )
|
731
|
-
|
732
|
-
}.sort
|
733
|
-
|
734
|
-
end
|
735
|
-
|
736
|
-
# TODO: parent application test object should be passed to get_test_objects
|
737
|
-
def get_layout_direction( sut )
|
738
|
-
|
739
|
-
sut.xml_data.at_xpath('*//object[@type="application"]/attributes/attribute[@name="layoutDirection"]/value/text()').to_s || 'LeftToRight'
|
740
|
-
|
741
|
-
end
|
742
|
-
|
306
|
+
# TODO: document me
|
743
307
|
def make_test_object( rules )
|
744
|
-
|
745
|
-
# get test object factory object from hash
|
746
|
-
test_object_factory = rules[ :test_object_factory ]
|
747
|
-
|
748
|
-
# get sut object from hash
|
749
|
-
sut = rules[ :sut ]
|
750
|
-
|
308
|
+
|
751
309
|
# get parent object from hash
|
752
|
-
parent = rules[ :parent]
|
310
|
+
parent = rules[ :parent ]
|
311
|
+
|
312
|
+
# retrieve sut object
|
313
|
+
sut = parent.instance_variable_get( :@sut )
|
753
314
|
|
315
|
+
# xml object element
|
754
316
|
xml_object = rules[ :xml_object ]
|
755
317
|
|
756
318
|
# retrieve attributes
|
@@ -768,8 +330,8 @@ module MobyBase
|
|
768
330
|
object_type = TDriver::TestObjectAdapter.test_object_element_attribute( xml_object, 'type' ){ nil }.to_s
|
769
331
|
|
770
332
|
# retrieve test object type from xml
|
771
|
-
|
772
|
-
|
333
|
+
env = TDriver::TestObjectAdapter.test_object_element_attribute( xml_object, 'env' ){ $parameters[ sut.id ][ :env ] }.to_s
|
334
|
+
|
773
335
|
else
|
774
336
|
|
775
337
|
# defaults - refactor this
|
@@ -779,10 +341,10 @@ module MobyBase
|
|
779
341
|
|
780
342
|
object_id = 0
|
781
343
|
|
782
|
-
env =
|
344
|
+
env = $parameters[ sut.id ][ :env ].to_s
|
783
345
|
|
784
346
|
end
|
785
|
-
|
347
|
+
|
786
348
|
# calculate object cache hash key
|
787
349
|
hash_key = TDriver::TestObjectAdapter.test_object_hash( object_id, object_type, object_name )
|
788
350
|
|
@@ -799,28 +361,34 @@ module MobyBase
|
|
799
361
|
test_object.xml_data = xml_object
|
800
362
|
|
801
363
|
else
|
802
|
-
|
364
|
+
|
803
365
|
# create test object
|
804
|
-
test_object = MobyBase::TestObject.new(
|
366
|
+
test_object = MobyBase::TestObject.new( self, sut, parent, xml_object )
|
805
367
|
|
806
|
-
#
|
807
|
-
|
368
|
+
#test_object.instance_variable_set( :@object_behaviours, [] )
|
369
|
+
|
370
|
+
# apply all test object related behaviours unless object type is 'application'
|
371
|
+
object_type << ';*' unless object_type == 'application'
|
808
372
|
|
809
373
|
# apply behaviours to test object
|
810
|
-
|
811
|
-
|
812
|
-
|
813
|
-
:
|
814
|
-
:
|
815
|
-
:
|
816
|
-
|
374
|
+
MobyBase::BehaviourFactory.instance.apply_behaviour!(
|
375
|
+
|
376
|
+
:object => test_object,
|
377
|
+
:object_type => [ *object_type.split(';') ],
|
378
|
+
:input_type => [ '*', sut.input.to_s ],
|
379
|
+
:env => [ '*', *env.to_s.split(";") ],
|
380
|
+
:version => [ '*', sut.ui_version.to_s ]
|
817
381
|
|
382
|
+
)
|
818
383
|
# create child accessors
|
819
384
|
TDriver::TestObjectAdapter.create_child_accessors!( xml_object, test_object )
|
820
385
|
|
821
|
-
# set given parent in rules hash as parent object
|
386
|
+
# set given parent in rules hash as parent object for new child test object
|
822
387
|
test_object.instance_variable_set( :@parent, parent )
|
823
388
|
|
389
|
+
# set given application test object in rules hash as parent application for new child test object
|
390
|
+
test_object.instance_variable_set( :@parent_application, rules[ :parent_application ] )
|
391
|
+
|
824
392
|
# add created test object to parents child objects cache
|
825
393
|
parent_cache.add_object( test_object )
|
826
394
|
|
@@ -845,6 +413,88 @@ module MobyBase
|
|
845
413
|
|
846
414
|
end
|
847
415
|
|
416
|
+
# create test object search parameters for find_objects service
|
417
|
+
def make_object_search_params( test_object, creation_attributes )
|
418
|
+
|
419
|
+
result = get_parent_params( test_object ).push( get_object_params( creation_attributes ) )
|
420
|
+
|
421
|
+
# TODO: review find_objects controller
|
422
|
+
# workaround? return empty hash if no search params were
|
423
|
+
result == [{}] ? {} : result
|
424
|
+
|
425
|
+
end
|
426
|
+
|
427
|
+
private
|
428
|
+
|
429
|
+
# TODO: document me
|
430
|
+
def get_object_params( creation_attributes )
|
431
|
+
|
432
|
+
if creation_attributes[ :type ] != 'application'
|
433
|
+
|
434
|
+
object_search_params = creation_attributes.clone
|
435
|
+
|
436
|
+
object_search_params[ :className ] = object_search_params.delete( :type ) if creation_attributes.has_key?( :type )
|
437
|
+
object_search_params[ :objectName ] = object_search_params.delete( :name ) if creation_attributes.has_key?( :name )
|
438
|
+
|
439
|
+
object_search_params
|
440
|
+
|
441
|
+
else
|
442
|
+
|
443
|
+
{}
|
444
|
+
|
445
|
+
end
|
446
|
+
|
447
|
+
end
|
448
|
+
|
449
|
+
# TODO: document me
|
450
|
+
def get_parent_params( test_object )
|
451
|
+
|
452
|
+
unless [ 'application', 'sut' ].include?( test_object.type )
|
453
|
+
|
454
|
+
search_params = []
|
455
|
+
|
456
|
+
search_params.concat( get_parent_params( test_object.parent ) ) if test_object.parent
|
457
|
+
search_params.concat( [ :className => test_object.type, :tasId => test_object.id ] ) #if test_object
|
458
|
+
|
459
|
+
search_params
|
460
|
+
|
461
|
+
else
|
462
|
+
|
463
|
+
[]
|
464
|
+
|
465
|
+
end
|
466
|
+
|
467
|
+
end
|
468
|
+
|
469
|
+
# TODO: document me
|
470
|
+
def list_matching_test_objects( matches )
|
471
|
+
|
472
|
+
matches.collect{ | object |
|
473
|
+
|
474
|
+
path = [ object.attribute( 'type' ) ]
|
475
|
+
|
476
|
+
while object.attribute( 'type' ) != 'application' do
|
477
|
+
|
478
|
+
# object/objects/object/../..
|
479
|
+
object = object.parent.parent
|
480
|
+
|
481
|
+
path << object.attribute( 'type' )
|
482
|
+
|
483
|
+
end
|
484
|
+
|
485
|
+
path.reverse.join( '.' )
|
486
|
+
|
487
|
+
}.sort
|
488
|
+
|
489
|
+
end
|
490
|
+
|
491
|
+
# TODO: document me
|
492
|
+
def list_matching_test_objects_as_list( matches )
|
493
|
+
|
494
|
+
list_matching_test_objects( matches ).each_with_index.collect{ | object, object_index | "%3s) %s" % [ object_index + 1, object ] }.join( "\n" )
|
495
|
+
|
496
|
+
end
|
497
|
+
|
848
498
|
public # deprecated methods
|
849
499
|
|
850
500
|
def set_timeout( new_timeout )
|
@@ -868,9 +518,8 @@ module MobyBase
|
|
868
518
|
end
|
869
519
|
|
870
520
|
# enable hoo./base/test_object/factory.rb:king for performance measurement & debug logging
|
871
|
-
|
521
|
+
TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
|
872
522
|
|
873
523
|
end # TestObjectFactory
|
874
524
|
|
875
525
|
end # MobyBase
|
876
|
-
|