testability-driver 1.2.1 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/tdriver-devtools +0 -0
- data/ext/native_extensions.c +165 -6
- data/lib/tdriver-devtools/behaviour/old/xml/update +0 -0
- data/lib/tdriver-devtools/behaviour/xml/generate.rb +0 -0
- data/lib/tdriver-devtools/behaviour/xml/rdoc_behaviour_xml_generator.rb +15 -1
- data/lib/tdriver-devtools/doc/update +0 -0
- data/lib/tdriver-devtools/doc/xslt/template.xsl +24 -14
- data/lib/tdriver-devtools/doc/xslt/update +0 -0
- data/lib/tdriver-devtools/tdriver-devtools.rb +0 -0
- data/lib/tdriver-devtools/tests/feature_tests/update +0 -0
- data/lib/tdriver/base/behaviour/{behaviour.rb → abstract.rb} +3 -6
- data/lib/tdriver/base/behaviour/behaviours/object_abstract.rb +107 -0
- data/lib/tdriver/base/behaviour/behaviours/object_behaviour_composition.rb +2 -2
- data/lib/tdriver/base/behaviour/behaviours/object_behaviour_description.rb +47 -37
- data/lib/tdriver/base/behaviour/factory.rb +260 -382
- data/lib/tdriver/base/behaviour/loader.rb +22 -4
- data/lib/tdriver/base/controller/abstraction.rb +56 -0
- data/lib/tdriver/base/controller/loader.rb +21 -0
- data/lib/tdriver/base/loader.rb +3 -1
- data/lib/tdriver/base/sut/controller.rb +91 -74
- data/lib/tdriver/base/sut/factory.rb +8 -8
- data/lib/tdriver/base/sut/generic/behaviours/agent.rb +77 -0
- data/lib/tdriver/base/sut/generic/behaviours/sut.rb +116 -96
- data/lib/tdriver/base/sut/generic/commands/agent.rb +43 -0
- data/lib/tdriver/base/sut/sut.rb +10 -8
- data/lib/tdriver/base/test_object/abstract.rb +25 -24
- data/lib/tdriver/base/test_object/adapter.rb +67 -44
- data/lib/tdriver/base/test_object/behaviours/test_object.rb +79 -20
- data/lib/tdriver/base/test_object/factory.rb +45 -15
- data/lib/tdriver/base/test_object/xml/adapter.rb +80 -57
- data/lib/tdriver/env.rb +0 -0
- data/lib/tdriver/loader.rb +0 -0
- data/lib/tdriver/matti.rb +0 -0
- data/lib/tdriver/report/error_recovery/tdriver_error_recovery.rb +1 -0
- data/lib/tdriver/report/report.rb +2 -1
- data/lib/tdriver/report/report_crash_file_capture.rb +12 -0
- data/lib/tdriver/report/report_creator.rb +6 -2
- data/lib/tdriver/report/report_execution_statistics.rb +27 -11
- data/lib/tdriver/report/report_graph_generator.rb +59 -0
- data/lib/tdriver/report/report_test_case_run.rb +34 -2
- data/lib/tdriver/report/report_writer.rb +12 -0
- data/lib/tdriver/tdriver.rb +12 -1
- data/lib/tdriver/util/agent/loader.rb +22 -0
- data/lib/tdriver/util/agent/service.rb +107 -0
- data/lib/tdriver/util/common/crc16.rb +17 -10
- data/lib/tdriver/util/common/hash.rb +4 -1
- data/lib/tdriver/util/common/kernel.rb +11 -0
- data/lib/tdriver/util/common/numeric.rb +48 -0
- data/lib/tdriver/util/common/object.rb +5 -2
- data/lib/tdriver/util/common/string.rb +8 -1
- data/lib/tdriver/util/filters/attribute_filter.rb +121 -0
- data/lib/tdriver/util/filters/loader.rb +29 -0
- data/lib/tdriver/util/fixture/loader.rb +22 -0
- data/lib/tdriver/util/fixture/service.rb +157 -0
- data/lib/tdriver/util/loader.rb +8 -2
- data/lib/tdriver/util/logger/logger.rb +12 -6
- data/lib/tdriver/util/other/config.rb +0 -0
- data/lib/tdriver/util/parameter/parameter.rb +221 -152
- data/lib/tdriver/util/plugin/error.rb +0 -0
- data/lib/tdriver/util/video/camera_linux.rb +36 -22
- data/lib/tdriver/util/xml/parsers/nokogiri/abstraction.rb +3 -13
- data/lib/tdriver/util/xml/parsers/nokogiri/node.rb +13 -8
- data/lib/tdriver/util/xml/parsers/nokogiri/nodeset.rb +51 -9
- data/lib/tdriver/util/xml/xml.rb +4 -2
- data/lib/tdriver/verify/verify.rb +280 -621
- data/lib/tdriver/version.rb +1 -1
- data/xml/behaviours/generic.xml +34 -0
- data/xml/templates/generic.xml +20 -3
- metadata +168 -240
- data/lib/tdriver-devtools/tests/feature_tests/output/application_closable_0x3f.feature +0 -10
- data/lib/tdriver-devtools/tests/feature_tests/output/application_close.feature +0 -15
- data/lib/tdriver-devtools/tests/feature_tests/output/application_environment.feature +0 -10
- data/lib/tdriver-devtools/tests/feature_tests/output/application_executable_name.feature +0 -10
- data/lib/tdriver-devtools/tests/feature_tests/output/application_uid.feature +0 -10
- data/lib/tdriver-devtools/tests/feature_tests/output/created.rid +0 -1
- data/lib/tdriver-devtools/tests/feature_tests/output/find_find.feature +0 -15
- data/lib/tdriver-devtools/tests/feature_tests/output/flash_behaviour_flash.feature +0 -10
- data/lib/tdriver-devtools/tests/feature_tests/output/flash_behaviour_flash_images.feature +0 -15
- data/lib/tdriver-devtools/tests/feature_tests/output/sut_application.feature +0 -15
- data/lib/tdriver-devtools/tests/feature_tests/output/sut_capture_screen.feature +0 -10
- data/lib/tdriver-devtools/tests/feature_tests/output/sut_child.feature +0 -10
- data/lib/tdriver-devtools/tests/feature_tests/output/sut_clear_verify_blocks.feature +0 -10
- data/lib/tdriver-devtools/tests/feature_tests/output/sut_connect.feature +0 -10
- data/lib/tdriver-devtools/tests/feature_tests/output/sut_controller_execution_order.feature +0 -10
- data/lib/tdriver-devtools/tests/feature_tests/output/sut_controller_execution_order_0x3d.feature +0 -10
- data/lib/tdriver-devtools/tests/feature_tests/output/sut_current_application_id.feature +0 -15
- data/lib/tdriver-devtools/tests/feature_tests/output/sut_disconnect.feature +0 -10
- data/lib/tdriver-devtools/tests/feature_tests/output/sut_dump_count.feature +0 -15
- data/lib/tdriver-devtools/tests/feature_tests/output/sut_freeze.feature +0 -10
- data/lib/tdriver-devtools/tests/feature_tests/output/sut_frozen.feature +0 -10
- data/lib/tdriver-devtools/tests/feature_tests/output/sut_get_application_id.feature +0 -10
- data/lib/tdriver-devtools/tests/feature_tests/output/sut_get_object.feature +0 -10
- data/lib/tdriver-devtools/tests/feature_tests/output/sut_get_operator_data.feature +0 -10
- data/lib/tdriver-devtools/tests/feature_tests/output/sut_get_ui_dump.feature +0 -15
- data/lib/tdriver-devtools/tests/feature_tests/output/sut_get_user_information.feature +0 -10
- data/lib/tdriver-devtools/tests/feature_tests/output/sut_input.feature +0 -15
- data/lib/tdriver-devtools/tests/feature_tests/output/sut_parameter.feature +0 -15
- data/lib/tdriver-devtools/tests/feature_tests/output/sut_press_key.feature +0 -10
- data/lib/tdriver-devtools/tests/feature_tests/output/sut_received_data.feature +0 -10
- data/lib/tdriver-devtools/tests/feature_tests/output/sut_refresh.feature +0 -20
- data/lib/tdriver-devtools/tests/feature_tests/output/sut_refresh_timeout.feature +0 -15
- data/lib/tdriver-devtools/tests/feature_tests/output/sut_refresh_tries.feature +0 -15
- data/lib/tdriver-devtools/tests/feature_tests/output/sut_refresh_ui_dump.feature +0 -20
- data/lib/tdriver-devtools/tests/feature_tests/output/sut_run.feature +0 -10
- data/lib/tdriver-devtools/tests/feature_tests/output/sut_sent_data.feature +0 -10
- data/lib/tdriver-devtools/tests/feature_tests/output/sut_state.feature +0 -10
- data/lib/tdriver-devtools/tests/feature_tests/output/sut_translate.feature +0 -30
- data/lib/tdriver-devtools/tests/feature_tests/output/sut_ui_type.feature +0 -10
- data/lib/tdriver-devtools/tests/feature_tests/output/sut_ui_version.feature +0 -10
- data/lib/tdriver-devtools/tests/feature_tests/output/sut_unfreeze.feature +0 -10
- data/lib/tdriver-devtools/tests/feature_tests/output/sut_update.feature +0 -10
- data/lib/tdriver-devtools/tests/feature_tests/output/sut_verify_always.feature +0 -20
- data/lib/tdriver-devtools/tests/feature_tests/output/sut_verify_blocks.feature +0 -10
- data/lib/tdriver-devtools/tests/feature_tests/output/sut_x_path.feature +0 -10
- data/lib/tdriver-devtools/tests/feature_tests/output/sut_xml_data.feature +0 -10
- data/lib/tdriver-devtools/tests/feature_tests/output/sut_xml_data_0x3d.feature +0 -10
- data/lib/tdriver-devtools/tests/feature_tests/output/sut_xml_data_crc.feature +0 -10
- data/lib/tdriver-devtools/tests/feature_tests/output/switchbox_behaviour_power_down.feature +0 -10
- data/lib/tdriver-devtools/tests/feature_tests/output/switchbox_behaviour_power_status.feature +0 -10
- data/lib/tdriver-devtools/tests/feature_tests/output/switchbox_behaviour_power_up.feature +0 -10
- data/lib/tdriver-devtools/tests/feature_tests/output/switchbox_behaviour_reset.feature +0 -10
- data/lib/tdriver-devtools/tests/feature_tests/output/verification_test_object_exists_0x3f.feature +0 -15
- data/lib/tdriver/base/behaviour/factory_new.rb +0 -409
- data/lib/tdriver/base/test_object/identificator.rb +0 -518
- data/lib/tdriver/util/filters/dynamic_attributes.rb +0 -189
@@ -0,0 +1,43 @@
|
|
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 TDriver.
|
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 MobyCommand
|
21
|
+
|
22
|
+
class AgentCommand < MobyCommand::CommandData
|
23
|
+
|
24
|
+
attr_accessor :parameters
|
25
|
+
|
26
|
+
# == description
|
27
|
+
# Agent command holds the required parameters to execute a agent information queries in the target.
|
28
|
+
# == arguments
|
29
|
+
# params
|
30
|
+
# Hash
|
31
|
+
# description: Hash for holding the parameters need by the agent information query operation.
|
32
|
+
# example: {}
|
33
|
+
def initialize( parameters = {} )
|
34
|
+
|
35
|
+
parameters.check_type Hash, 'wrong argument type $1 for agent service command object (expected $2)'
|
36
|
+
|
37
|
+
@parameters = parameters
|
38
|
+
|
39
|
+
end
|
40
|
+
|
41
|
+
end # AgentCommand
|
42
|
+
|
43
|
+
end # MobyCommand
|
data/lib/tdriver/base/sut/sut.rb
CHANGED
@@ -23,17 +23,17 @@ module MobyBase
|
|
23
23
|
class SUT
|
24
24
|
|
25
25
|
attr_accessor(
|
26
|
-
:id,
|
27
|
-
:ui_type,
|
28
|
-
:ui_version,
|
29
|
-
:input
|
30
|
-
:type # type of object ("SUT"), used when applying behaviour
|
26
|
+
:id, # id of current SUT
|
27
|
+
:ui_type, # ui type
|
28
|
+
:ui_version, # ui version
|
29
|
+
:input # the input method used for interacting with this sut as a symbol, eg. :key or :touch.
|
31
30
|
)
|
32
31
|
|
33
|
-
#added for now
|
34
32
|
attr_reader(
|
35
|
-
|
36
|
-
|
33
|
+
:type, # type of object ("SUT"), used when applying behaviour
|
34
|
+
:environment, # sut environment from parameters file
|
35
|
+
:test_object_adapter # test object adapter -- added for now?
|
36
|
+
)
|
37
37
|
|
38
38
|
# Initialize SUT by giving references to the used controller and test object factory
|
39
39
|
# == params
|
@@ -68,6 +68,8 @@ module MobyBase
|
|
68
68
|
|
69
69
|
@object_behaviours = []
|
70
70
|
|
71
|
+
@environment = $parameters[ sut_id ][ :env ]
|
72
|
+
|
71
73
|
@forced_xml = false
|
72
74
|
|
73
75
|
end
|
@@ -41,26 +41,28 @@ module MobyBase
|
|
41
41
|
# verify that given argument is type of hash
|
42
42
|
options.check_type Hash, 'wrong argument type $1 for TestObject#new (expected $2)'
|
43
43
|
|
44
|
-
# verify that required keys is found from options hash and initialize the test object with these values
|
45
|
-
@
|
46
|
-
@test_object_adapter = options.require_key( :test_object_adapter )
|
47
|
-
@creation_attributes = options.require_key( :creation_attributes )
|
44
|
+
# verify that required keys is found from options hash and initialize the test object with these values
|
45
|
+
@sut = options.require_key :sut
|
48
46
|
|
49
|
-
@
|
47
|
+
@test_object_factory = options.require_key :test_object_factory
|
48
|
+
@test_object_adapter = options.require_key :test_object_adapter
|
49
|
+
@creation_attributes = options.require_key :creation_attributes
|
50
50
|
|
51
|
-
|
51
|
+
# verify that parent object and parent application is given in options hash
|
52
|
+
@parent = options.require_key :parent
|
53
|
+
@parent_application = options.require_key :parent_application
|
52
54
|
|
53
|
-
|
54
|
-
@
|
55
|
-
|
56
|
-
# apply xml object if given; test object type, id and name are retrieved from the xml
|
57
|
-
self.xml_data = options[ :xml_object ] if options.has_key?( :xml_object )
|
55
|
+
# store sut id
|
56
|
+
@sut_id = @sut.instance_variable_get :@id
|
58
57
|
|
59
58
|
# initialize cache object
|
60
|
-
@child_object_cache
|
59
|
+
@child_object_cache = TDriver::TestObjectCache.new
|
61
60
|
|
62
61
|
# empty test object behaviours list
|
63
|
-
@object_behaviours
|
62
|
+
@object_behaviours = []
|
63
|
+
|
64
|
+
# apply xml object if given; test object type, id and name are retrieved from the xml
|
65
|
+
__send__ :xml_data=, options[ :xml_object ] if options.has_key?( :xml_object )
|
64
66
|
|
65
67
|
end
|
66
68
|
|
@@ -75,7 +77,7 @@ module MobyBase
|
|
75
77
|
# nothing
|
76
78
|
def eql?( test_object )
|
77
79
|
|
78
|
-
|
80
|
+
__send__ :==, test_object
|
79
81
|
|
80
82
|
end
|
81
83
|
|
@@ -95,9 +97,9 @@ module MobyBase
|
|
95
97
|
def ==( test_object )
|
96
98
|
|
97
99
|
#return false unless test_object.instance_of?( MobyBase::TestObject )
|
98
|
-
#return false unless
|
99
|
-
#return false unless
|
100
|
-
#return false unless
|
100
|
+
#return false unless @type == test_object.type
|
101
|
+
#return false unless @id == test_object.id
|
102
|
+
#return false unless @name == test_object.name
|
101
103
|
#return true
|
102
104
|
|
103
105
|
# optimized version
|
@@ -112,11 +114,10 @@ module MobyBase
|
|
112
114
|
# Fixnum:: hash number representing current TestObject
|
113
115
|
def hash
|
114
116
|
|
115
|
-
|
116
117
|
#result = 17
|
117
|
-
#result = result * 37 +
|
118
|
-
#result = result * 37 +
|
119
|
-
#result = result * 37 +
|
118
|
+
#result = result * 37 + @id.to_i
|
119
|
+
#result = result * 37 + @hash
|
120
|
+
#result = result * 37 + @hash
|
120
121
|
#return result
|
121
122
|
|
122
123
|
# optimized version
|
@@ -131,17 +132,17 @@ module MobyBase
|
|
131
132
|
# should not be used normally. Thus, not documented.
|
132
133
|
def <=>( test_object )
|
133
134
|
|
134
|
-
#self_type =
|
135
|
+
#self_type = @type
|
135
136
|
#other_type = test_object.type
|
136
137
|
#return -1 if self_type < other_type
|
137
138
|
#return 1 if self_type > other_type
|
138
139
|
|
139
|
-
#self_name =
|
140
|
+
#self_name = @name
|
140
141
|
#other_name = test_object.name
|
141
142
|
#return -1 if self_name < other_name
|
142
143
|
#return 1 if self_name > other_name
|
143
144
|
|
144
|
-
#self_id =
|
145
|
+
#self_id = @id
|
145
146
|
#other_id = test_object.id
|
146
147
|
#return -1 if self_id < other_id
|
147
148
|
#return 1 if self_id > other_id
|
@@ -87,6 +87,40 @@ module TDriver
|
|
87
87
|
|
88
88
|
end # xpath_attributes
|
89
89
|
|
90
|
+
#merges elements from the nodeset, used in hybrid app situations
|
91
|
+
def create_merged_element(nodeset, environments, close_element=true)
|
92
|
+
merged_element_set = false
|
93
|
+
|
94
|
+
merged_xml = ""
|
95
|
+
|
96
|
+
nodeset.each{ | object |
|
97
|
+
|
98
|
+
# only one top element
|
99
|
+
unless merged_element_set
|
100
|
+
|
101
|
+
# retrieve object attributes
|
102
|
+
attributes = object.attributes
|
103
|
+
|
104
|
+
# merge env to attributes hash
|
105
|
+
attributes['env'] = environments.join(';')
|
106
|
+
|
107
|
+
# add application object xml element to new xml string
|
108
|
+
merged_xml << "<object #{ hash_to_element_attributes( attributes ) }>"
|
109
|
+
|
110
|
+
# merged element is now set, no need to do it again
|
111
|
+
merged_element_set = true
|
112
|
+
|
113
|
+
end
|
114
|
+
|
115
|
+
# append all found elements
|
116
|
+
object.xpath('./*').each{ | object | merged_xml << object.to_s }
|
117
|
+
}
|
118
|
+
merged_xml << "</object>" if close_element and merged_element_set
|
119
|
+
merged_xml
|
120
|
+
end
|
121
|
+
|
122
|
+
|
123
|
+
|
90
124
|
# TODO: document me
|
91
125
|
def initialize_class
|
92
126
|
|
@@ -425,50 +459,53 @@ module TDriver
|
|
425
459
|
|
426
460
|
# TODO: document me
|
427
461
|
def self.test_object_attributes( source_data, inclusive_filter = [] )
|
428
|
-
|
462
|
+
|
429
463
|
# convert all keys to lowercase
|
430
464
|
inclusive_filter.collect!{ | key | key.to_s.downcase } unless inclusive_filter.empty?
|
431
|
-
|
465
|
+
|
432
466
|
# return hash of test object attributes
|
433
|
-
Hash
|
467
|
+
object_attributes=Hash.new
|
434
468
|
|
435
|
-
# iterate each attribute and collect name and value
|
436
|
-
source_data.xpath( 'attributes/attribute/value' ).collect{ | value |
|
469
|
+
# iterate each attribute and collect name and value
|
470
|
+
source_data.xpath( 'attributes/attribute/value' ).collect{ | value |
|
437
471
|
|
438
472
|
# retrieve attribute name
|
439
473
|
name = value.parent.attribute('name').to_s
|
440
474
|
|
441
475
|
# collect attribute elements name and content
|
442
476
|
unless inclusive_filter.empty?
|
443
|
-
|
444
|
-
[
|
445
|
-
|
477
|
+
|
478
|
+
object_attributes[name]=value.content if inclusive_filter.include?( name.downcase )
|
479
|
+
|
446
480
|
else
|
447
481
|
|
448
482
|
# pass the attribute pair - no filtering done
|
449
|
-
[
|
450
|
-
|
483
|
+
if object_attributes[name]
|
484
|
+
object_attributes[name]="#{object_attributes[name]},#{value.content}"
|
485
|
+
else
|
486
|
+
object_attributes[name]=value.content
|
487
|
+
end
|
488
|
+
|
451
489
|
end
|
452
490
|
|
453
491
|
}
|
454
492
|
|
455
|
-
|
493
|
+
object_attributes
|
456
494
|
|
457
495
|
end
|
458
496
|
|
459
497
|
# TODO: document me
|
460
498
|
def self.application_layout_direction( sut )
|
461
499
|
|
462
|
-
# temporary fix until testobject will be associated to parent application object
|
463
|
-
|
464
|
-
|
465
|
-
#
|
466
|
-
|
467
|
-
|
500
|
+
# temporary fix until testobject will be associated to parent application object; add 'layoutDirection' to dynamic attributes filtering whitelist...
|
501
|
+
TDriver::AttributeFilter.add_attribute( 'layoutDirection' ){
|
502
|
+
|
503
|
+
# this block will be executed if attribute was not in filter list
|
504
|
+
|
468
505
|
# temporary fix: ... and refresh sut to retrieve updated xml data
|
469
506
|
sut.refresh
|
470
|
-
|
471
|
-
|
507
|
+
|
508
|
+
}
|
472
509
|
|
473
510
|
# TODO: parent application test object should be passed to get_test_objects; TestObjectAdapter#test_object_attribute( @app.xml_data, 'layoutDirection')
|
474
511
|
( sut.xml_data.at_xpath('*//object[@type="application"]/attributes/attribute[@name="layoutDirection"]/value/text()').content || 'LeftToRight' ).to_s
|
@@ -642,32 +679,18 @@ module TDriver
|
|
642
679
|
# collect environment values
|
643
680
|
environments = document_root.xpath('/tasMessage/tasInfo/object[@type="application"]/@env').collect{ | attribute | attribute.to_s }
|
644
681
|
|
645
|
-
#
|
646
|
-
nodeset
|
647
|
-
|
648
|
-
|
649
|
-
|
650
|
-
|
651
|
-
|
652
|
-
|
653
|
-
# retrieve object attributes
|
654
|
-
attributes = object.attributes
|
655
|
-
|
656
|
-
# merge env to attributes hash
|
657
|
-
attributes['env'] = environments.join(';')
|
658
|
-
|
659
|
-
# add application object xml element to new xml string
|
660
|
-
new_xml << "<object #{ hash_to_element_attributes( attributes ) }>"
|
661
|
-
|
662
|
-
# application element is now set, no need to do it again
|
663
|
-
application_element_set = true
|
664
|
-
|
665
|
-
end
|
682
|
+
#limit to apps
|
683
|
+
nodeset = document_root.xpath('/tasMessage/tasInfo/object[@type="application"]')
|
684
|
+
close_vkb = false
|
685
|
+
if nodeset.count > 0
|
686
|
+
new_xml << create_merged_element(nodeset, environments, false)
|
687
|
+
close_vkb = true
|
688
|
+
end
|
666
689
|
|
667
|
-
|
668
|
-
|
669
|
-
|
670
|
-
|
690
|
+
# do the same to the vkbs
|
691
|
+
environments = document_root.xpath('/tasMessage/tasInfo/object[@type="vkb_app"]/@env').collect{ | attribute | attribute.to_s }
|
692
|
+
nodeset = document_root.xpath('/tasMessage/tasInfo/object[@type="vkb_app"]')
|
693
|
+
new_xml << create_merged_element(nodeset, environments, close_vkb)
|
671
694
|
|
672
695
|
# multiple applications found, return merged application xml
|
673
696
|
new_xml << "</object></tasInfo></tasMessage>"
|
@@ -76,6 +76,7 @@ module MobyBehaviour
|
|
76
76
|
|
77
77
|
end
|
78
78
|
|
79
|
+
=begin
|
79
80
|
# == description
|
80
81
|
# Determines if the current test object is of type 'application'
|
81
82
|
# == returns
|
@@ -87,6 +88,7 @@ module MobyBehaviour
|
|
87
88
|
@type == 'application'
|
88
89
|
|
89
90
|
end
|
91
|
+
=end
|
90
92
|
|
91
93
|
# == description
|
92
94
|
# Return all test object attributes
|
@@ -250,12 +252,24 @@ module MobyBehaviour
|
|
250
252
|
# @sut.refresh might have a side effect that changes the @_active instance variable.
|
251
253
|
# === raises
|
252
254
|
# TestObjectNotFoundError:: if TestObject is not identified within synch timeout.
|
253
|
-
def refresh( refresh_args =
|
254
|
-
|
255
|
-
refresh_args = @creation_attributes if refresh_args.nil?
|
255
|
+
def refresh( refresh_args = {} )
|
256
256
|
|
257
257
|
refresh_args.check_type Hash, "wrong argument type $1 for #{ application? ? 'application' : 'test object' } refresh attributes (expected $2)"
|
258
258
|
|
259
|
+
if refresh_args.blank?
|
260
|
+
|
261
|
+
if application?
|
262
|
+
|
263
|
+
refresh_args = { :name => @name, :id => @id }
|
264
|
+
|
265
|
+
else
|
266
|
+
|
267
|
+
refresh_args = { :name => @parent_application.name, :id => @parent_application.id }
|
268
|
+
|
269
|
+
end
|
270
|
+
|
271
|
+
end
|
272
|
+
|
259
273
|
@sut.refresh(
|
260
274
|
|
261
275
|
refresh_args, @test_object_factory.make_object_search_params( parent, @creation_attributes )
|
@@ -265,6 +279,8 @@ module MobyBehaviour
|
|
265
279
|
# update childs if required, returns true or false
|
266
280
|
update( xml_data )
|
267
281
|
|
282
|
+
nil
|
283
|
+
|
268
284
|
end
|
269
285
|
|
270
286
|
# == nodoc
|
@@ -313,7 +329,15 @@ module MobyBehaviour
|
|
313
329
|
|
314
330
|
# return application object or nil if no parent found
|
315
331
|
# Does is make sense to return nil - should n't all test objects belong to an application? Maybe throw exception if application not found
|
316
|
-
|
332
|
+
begin
|
333
|
+
|
334
|
+
@sut.child( :type => 'application' )
|
335
|
+
|
336
|
+
rescue
|
337
|
+
|
338
|
+
nil
|
339
|
+
|
340
|
+
end
|
317
341
|
|
318
342
|
end
|
319
343
|
|
@@ -326,11 +350,17 @@ module MobyBehaviour
|
|
326
350
|
# puts @app.Node( :name => 'Node1' ).get_application_id() #print the application id, this should print @app.id
|
327
351
|
def get_application_id
|
328
352
|
|
329
|
-
|
353
|
+
if @parent_application
|
354
|
+
|
355
|
+
@parent_application.id
|
356
|
+
|
357
|
+
else
|
358
|
+
|
359
|
+
# workaround
|
360
|
+
# What about the case when get_application returns nil? This line will throw an exception in that case.
|
361
|
+
get_application.id
|
330
362
|
|
331
|
-
|
332
|
-
# What about the case when get_application returns nil? This line will throw an exception in that case.
|
333
|
-
get_application.id
|
363
|
+
end
|
334
364
|
|
335
365
|
end
|
336
366
|
|
@@ -402,8 +432,24 @@ module MobyBehaviour
|
|
402
432
|
def child( attributes )
|
403
433
|
|
404
434
|
# verify attributes argument format
|
405
|
-
attributes.check_type
|
406
|
-
|
435
|
+
attributes.check_type [ Hash, String, Symbol, Regexp, Array ], "wrong argument type $1 for attributes (expected $2)"
|
436
|
+
|
437
|
+
# set rules hash to empty Hash if rules hash is not type of Hash
|
438
|
+
unless attributes.kind_of?( Hash )
|
439
|
+
|
440
|
+
# pass empty rules hash if no argument given, otherwise assume value to be object name
|
441
|
+
if attributes.blank?
|
442
|
+
|
443
|
+
attributes = {}
|
444
|
+
|
445
|
+
else
|
446
|
+
|
447
|
+
attributes = { :name => attributes }
|
448
|
+
|
449
|
+
end
|
450
|
+
|
451
|
+
end
|
452
|
+
|
407
453
|
get_child_objects( attributes )
|
408
454
|
|
409
455
|
end
|
@@ -504,19 +550,19 @@ module MobyBehaviour
|
|
504
550
|
if @env != previous_environment
|
505
551
|
|
506
552
|
# remove cached behaviour module
|
507
|
-
|
553
|
+
TDriver::BehaviourFactory.reset_cache
|
508
554
|
|
509
555
|
# apply only application behaviours if test object is type of 'application'
|
510
556
|
object_type = ( @type == "application" ? [ @type ] : [ '*', @type ] )
|
511
557
|
|
512
558
|
# reapply behaviours to test object if environment value has changed
|
513
|
-
|
559
|
+
TDriver::BehaviourFactory.apply_behaviour(
|
514
560
|
|
515
|
-
:object
|
516
|
-
:object_type
|
517
|
-
:input_type
|
518
|
-
:env
|
519
|
-
:version
|
561
|
+
:object => self,
|
562
|
+
:object_type => object_type,
|
563
|
+
:input_type => [ '*', @sut.input.to_s ],
|
564
|
+
:env => [ '*', *@env.to_s.split(";") ],
|
565
|
+
:version => [ '*', @sut.ui_version.to_s ]
|
520
566
|
|
521
567
|
)
|
522
568
|
|
@@ -577,7 +623,20 @@ module MobyBehaviour
|
|
577
623
|
rules_hash = method_arguments.first
|
578
624
|
|
579
625
|
# set rules hash to empty Hash if rules hash is not type of Hash
|
580
|
-
|
626
|
+
unless rules_hash.kind_of?( Hash )
|
627
|
+
|
628
|
+
# pass empty rules hash if no argument given, otherwise assume value to be object name
|
629
|
+
if rules_hash.blank?
|
630
|
+
|
631
|
+
rules_hash = {}
|
632
|
+
|
633
|
+
else
|
634
|
+
|
635
|
+
rules_hash = { :name => rules_hash }
|
636
|
+
|
637
|
+
end
|
638
|
+
|
639
|
+
end
|
581
640
|
|
582
641
|
# set test object type
|
583
642
|
rules_hash[ :type ] = method_id.to_s
|
@@ -674,7 +733,7 @@ module MobyBehaviour
|
|
674
733
|
# TODO: refactor me
|
675
734
|
child_test_object = @test_object_factory.get_test_objects(
|
676
735
|
|
677
|
-
# current
|
736
|
+
# current object as parent, can be either TestObject or SUT
|
678
737
|
:parent => self,
|
679
738
|
|
680
739
|
# pass parent application
|
@@ -862,7 +921,7 @@ module MobyBehaviour
|
|
862
921
|
if ( attempt == 1 )
|
863
922
|
|
864
923
|
# add to attribute filter
|
865
|
-
|
924
|
+
TDriver::AttributeFilter.add_attribute( name )
|
866
925
|
|
867
926
|
# refresh test object ui state
|
868
927
|
refresh
|