testability-driver 0.9.2 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/tdriver/base/behaviour/behaviours/object_behaviour_composition.rb +1 -1
- data/lib/tdriver/base/behaviour/behaviours/object_behaviour_description.rb +11 -7
- data/lib/tdriver/base/behaviour/behaviours/object_composition.rb +8 -0
- data/lib/tdriver/base/behaviour/factory.rb +229 -209
- data/lib/tdriver/base/errors.rb +3 -0
- data/lib/tdriver/base/state_object.rb +11 -20
- data/lib/tdriver/base/sut/controller.rb +4 -4
- data/lib/tdriver/base/sut/factory.rb +205 -170
- data/lib/tdriver/base/sut/generic/behaviours/application.rb +256 -174
- data/lib/tdriver/base/sut/generic/behaviours/find.rb +17 -11
- data/lib/tdriver/base/sut/generic/behaviours/flash_behaviour.rb +57 -66
- data/lib/tdriver/base/sut/generic/behaviours/sut.rb +578 -497
- data/lib/tdriver/base/sut/generic/behaviours/switchbox_behaviour.rb +41 -15
- data/lib/tdriver/base/sut/generic/behaviours/verification.rb +48 -19
- data/lib/tdriver/base/sut/generic/commands/fixture.rb +47 -0
- data/lib/tdriver/base/sut/generic/commands/key_sequence.rb +25 -13
- data/lib/tdriver/base/sut/generic/commands/screen_capture.rb +16 -10
- data/lib/tdriver/base/sut/generic/plugin.rb +9 -3
- data/lib/tdriver/base/sut/sut.rb +41 -33
- data/lib/tdriver/base/test_object/abstract.rb +26 -3
- data/lib/tdriver/base/test_object/adapter.rb +399 -0
- data/lib/tdriver/base/test_object/behaviours/syncronization.rb +56 -14
- data/lib/tdriver/base/test_object/behaviours/test_object.rb +663 -197
- data/lib/tdriver/base/test_object/cache.rb +132 -0
- data/lib/tdriver/base/test_object/factory.rb +677 -426
- data/lib/tdriver/base/test_object/factory_new.rb +202 -0
- data/lib/tdriver/base/test_object/identificator.rb +24 -17
- data/lib/tdriver/base/test_object/loader.rb +9 -3
- data/lib/tdriver/base/test_object/verification.rb +181 -0
- data/lib/tdriver/loader.rb +1 -1
- data/lib/tdriver/report/report.rb +2 -0
- data/lib/tdriver/report/report_api.rb +4 -4
- data/lib/tdriver/report/report_creator.rb +29 -3
- data/lib/tdriver/report/report_data_presentation.rb +7 -3
- data/lib/tdriver/report/report_execution_statistics.rb +80 -21
- data/lib/tdriver/report/report_javascript.rb +192 -0
- data/lib/tdriver/report/report_test_case_run.rb +22 -0
- data/lib/tdriver/report/report_test_run.rb +62 -55
- data/lib/tdriver/report/report_writer.rb +57 -56
- data/lib/tdriver/tdriver.rb +14 -41
- data/lib/tdriver/util/common/error.rb +1 -0
- data/lib/tdriver/util/common/exceptions.rb +12 -0
- data/lib/tdriver/util/common/file.rb +12 -6
- data/lib/tdriver/util/common/gem.rb +2 -1
- data/lib/tdriver/util/common/hash.rb +152 -0
- data/lib/tdriver/util/common/kernel.rb +49 -34
- data/lib/tdriver/util/common/loader.rb +21 -17
- data/lib/tdriver/util/common/numeric.rb +39 -0
- data/lib/tdriver/util/common/object.rb +115 -0
- data/lib/tdriver/util/common/string.rb +55 -2
- data/lib/tdriver/util/dbaccess/dbaccess.rb +194 -161
- data/lib/tdriver/util/dynamic_attribute_filter.rb +6 -0
- data/lib/tdriver/util/hooking.rb +2 -2
- data/lib/tdriver/util/loader.rb +2 -2
- data/lib/tdriver/util/localisation/localisation.rb +277 -18
- data/lib/tdriver/util/logger.rb +142 -13
- data/lib/tdriver/util/parameter/parameter_hash.rb +8 -5
- data/lib/tdriver/util/parameter/parameter_xml.rb +18 -2
- data/lib/tdriver/util/recorder.rb +17 -12
- data/lib/tdriver/util/user_data/user_data.rb +3 -2
- data/lib/tdriver/util/{video_rec.rb → video_utils.rb} +136 -16
- data/lib/tdriver/util/xml/abstraction.rb +7 -0
- data/lib/tdriver/util/xml/attribute.rb +32 -0
- data/lib/tdriver/util/xml/loader.rb +8 -2
- data/lib/tdriver/util/xml/nil_node.rb +95 -0
- data/lib/tdriver/util/xml/parsers/nokogiri/abstraction.rb +46 -7
- data/lib/tdriver/util/xml/parsers/nokogiri/attribute.rb +19 -9
- data/lib/tdriver/util/xml/parsers/nokogiri/document.rb +1 -1
- data/lib/tdriver/util/xml/parsers/nokogiri/element.rb +13 -1
- data/lib/tdriver/util/xml/parsers/nokogiri/loader.rb +6 -0
- data/lib/tdriver/util/xml/parsers/nokogiri/nodeset.rb +27 -15
- data/lib/tdriver/util/xml/parsers/nokogiri/text.rb +57 -0
- data/lib/tdriver/util/xml/text.rb +32 -0
- data/lib/tdriver/util/xml/xml.rb +35 -22
- data/lib/tdriver/version.rb +1 -1
- data/lib/tdriver-devtools/behaviour/xml/rdoc_behaviour_xml_generator.rb +41 -34
- data/lib/tdriver-devtools/doc/generate.rb +31 -6
- data/lib/tdriver-devtools/doc/xslt/template.xsl +46 -25
- data/lib/tdriver-devtools/tests/feature_tests/example/behaviour_example.rb +100 -0
- data/lib/tdriver-devtools/tests/feature_tests/update +1 -1
- data/lib/tdriver.rb +0 -3
- data/xml/behaviours/generic.xml +1 -1
- data/xml/defaults/generic.xml +4 -90
- data/xml/templates/generic.xml +33 -25
- metadata +21 -29
- data/lib/tdriver-devtools/behaviour/xml_generator/example/flick-example.rb +0 -245
- data/lib/tdriver-devtools/behaviour/xml_generator/example/sut.rb +0 -964
- data/lib/tdriver-devtools/behaviour/xml_generator/generate.rb +0 -68
- data/lib/tdriver-devtools/behaviour/xml_generator/lib/custom_rdoc_generator.rb +0 -1865
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.argument.default.template +0 -1
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.argument.template +0 -3
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.argument_type.template +0 -4
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.exception.template +0 -4
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.method.arguments.template +0 -4
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.method.deprecated.template +0 -3
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.method.exceptions.template +0 -3
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.method.info.template +0 -1
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.method.returns.template +0 -3
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.method.tables.template +0 -3
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.method.template +0 -12
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.returns.template +0 -5
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.table.item.template +0 -1
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.table.row.template +0 -2
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.table.template +0 -7
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.template +0 -14
- data/lib/tdriver-devtools/behaviour/xml_generator/update +0 -3
- data/lib/tdriver-devtools/tests/feature_tests/example/flick-example.rb +0 -233
- data/lib/tdriver-devtools/tests/feature_tests/example/impl.rb +0 -194
@@ -17,11 +17,10 @@
|
|
17
17
|
##
|
18
18
|
############################################################################
|
19
19
|
|
20
|
-
|
21
20
|
# Find behaviour
|
22
21
|
# Methods for finding test objects on the suttest objet state
|
23
22
|
module MobyBehaviour
|
24
|
-
|
23
|
+
|
25
24
|
# == description
|
26
25
|
# This module contains generic find behaviour
|
27
26
|
#
|
@@ -45,12 +44,12 @@ module MobyBehaviour
|
|
45
44
|
module Find
|
46
45
|
|
47
46
|
include MobyBehaviour::Behaviour
|
48
|
-
|
47
|
+
# == nodoc
|
49
48
|
# == description
|
50
49
|
# Finds a child test_object given its name and type and returns it as a reference
|
51
50
|
#
|
52
51
|
# == arguments
|
53
|
-
#
|
52
|
+
# attributes
|
54
53
|
# Hash
|
55
54
|
# description: one or more attributes defining the rules for the test object search. Must not be empty.
|
56
55
|
# example: { :name => 'oneButton' }
|
@@ -63,27 +62,34 @@ module MobyBehaviour
|
|
63
62
|
#
|
64
63
|
# == exceptions
|
65
64
|
# TypeError
|
66
|
-
# description:
|
67
|
-
#
|
65
|
+
# description: Wrong argument type %s for attributes (expected Hash)
|
66
|
+
#
|
67
|
+
# ArgumentError
|
68
|
+
# description: Attributes hash must not be empty
|
69
|
+
#
|
68
70
|
# == info
|
69
71
|
# Same as calling child method.
|
70
|
-
def find (
|
72
|
+
def find ( attributes = {} )
|
71
73
|
|
72
74
|
begin
|
73
75
|
|
74
|
-
|
76
|
+
attributes.check_type( Hash, "Wrong argument type $1 for attributes (expected $2)" )
|
77
|
+
|
78
|
+
attributes.not_empty( 'Attributes hash must not be empty' )
|
75
79
|
|
76
|
-
|
80
|
+
#raise ArgumentError.new( 'Attributes hash must not be empty' ) if attributes.empty?
|
81
|
+
|
82
|
+
search_result = child( attributes )
|
77
83
|
|
78
84
|
rescue Exception => e
|
79
85
|
|
80
|
-
MobyUtil::Logger.instance.log "behaviour" , "FAIL;Failed to find test object.;#{id.to_s};sut;{};find;" << (
|
86
|
+
MobyUtil::Logger.instance.log "behaviour" , "FAIL;Failed to find test object.;#{id.to_s};sut;{};find;" << ( attributes.kind_of?( Hash ) ? attributes.inspect : attributes.class.to_s )
|
81
87
|
|
82
88
|
Kernel::raise e
|
83
89
|
|
84
90
|
end
|
85
91
|
|
86
|
-
MobyUtil::Logger.instance.log "behaviour" , "PASS;Test object found.;#{id.to_s};sut;{};application;" <<
|
92
|
+
MobyUtil::Logger.instance.log "behaviour" , "PASS;Test object found.;#{id.to_s};sut;{};application;" << attributes.inspect
|
87
93
|
|
88
94
|
search_result
|
89
95
|
end
|
@@ -43,45 +43,41 @@ module MobyBehaviour
|
|
43
43
|
include MobyBehaviour::Behaviour
|
44
44
|
|
45
45
|
# == description
|
46
|
-
# Instructs the sut to start the flash operation with default TDriver parameters
|
47
|
-
#
|
48
|
-
#
|
49
|
-
# timeout in seconds between the switchbox commands:
|
50
|
-
# [code]<parameter name="timeout_between_command_sequence" value="25" />[/code]
|
51
|
-
# commands you want to be executed before flash:
|
52
|
-
# [code]<parameter name="switchbox_commands_before_flash" value="" />[/code]
|
53
|
-
# flash commands before flash:
|
54
|
-
# [code]<parameter name="commands_before_flash" value="" />[/code]
|
55
|
-
# intial flash command:
|
56
|
-
# [code]<parameter name="flash_command" value="" />[/code]
|
57
|
-
# timeout in seconds before executing the commands during flash:
|
58
|
-
# <parameter name="timeout_before_executing_commands_during_flash" value="20" />
|
59
|
-
# commands you want to be executed during flash:
|
60
|
-
# <parameter name="switchbox_commands_during_flash" value="" />
|
61
|
-
# optional flash parameters:
|
62
|
-
# <parameter name="optional_parameters_after_flashing" value="" />
|
63
|
-
# images to flash:
|
64
|
-
# <parameter name="flash_images" value="" />
|
65
|
-
# need to wait for the flash process to finish:
|
66
|
-
# <parameter name="sleep_time_after_flash_command" value="70" />
|
67
|
-
# flash command after flash:
|
68
|
-
# <parameter name="command_after_flash" value="" />
|
69
|
-
# commands for switchbox after failed flash:
|
70
|
-
# <parameter name="switchbox_commands_after_failed_flash" value="" />
|
71
|
-
# commands after failed flash:
|
72
|
-
# <parameter name="commands_after_failed_flash" value="" />
|
73
|
-
# If no error then no string is displayed:
|
74
|
-
# <parameter name="flash_command_success_string" value="" />
|
75
|
-
# commands you want to be executed after flash:
|
76
|
-
# <parameter name="switchbox_commands_after_flash" value="" />
|
46
|
+
# Instructs the sut to start the flash operation with default TDriver parameters
|
47
|
+
#
|
48
|
+
#
|
77
49
|
# == arguments
|
78
50
|
# == returns
|
51
|
+
# Boolean
|
52
|
+
# description: Indicating that did flashing success
|
53
|
+
# example: true
|
79
54
|
# == exceptions
|
80
55
|
# BehaviourError
|
81
56
|
# description: If mandatory parameters are missing
|
82
57
|
# BehaviourError
|
83
58
|
# description: If flashing is failed
|
84
|
-
#
|
59
|
+
#
|
60
|
+
# == tables
|
61
|
+
# flash_prameters
|
62
|
+
# title: Flash parameters
|
63
|
+
# description: Flash parameters for sut
|
64
|
+
# |Parameter|Description|Example|
|
65
|
+
# |:flash_attempts|How many times TDriver will attempt to flash the device|<parameter name="flash_attempts" value="2" />|
|
66
|
+
# |:timeout_between_command_sequence|Timeout in seconds between the switchbox commands|<parameter name="timeout_between_command_sequence" value="25" />|
|
67
|
+
# |:switchbox_commands_before_flash|Commands you want to be executed before flash|<parameter name="switchbox_commands_before_flash" value="" />|
|
68
|
+
# |:commands_before_flash|Flash commands before flash|<parameter name="commands_before_flash" value="" />|
|
69
|
+
# |:flash_command|Intial flash command|<parameter name="flash_command" value="" />|
|
70
|
+
# |:timeout_before_executing_commands_during_flash|Timeout in seconds before executing the commands during flash|<parameter name="timeout_before_executing_commands_during_flash" value="20" />|
|
71
|
+
# |:switchbox_commands_during_flash|Commands you want to be executed during flash|<parameter name="switchbox_commands_during_flash" value="" />|
|
72
|
+
# |:optional_parameters_after_flashing|Optional flash parameters|<parameter name="optional_parameters_after_flashing" value="" />|
|
73
|
+
# |:flash_images|Images to flash|<parameter name="flash_images" value="" />|
|
74
|
+
# |:sleep_time_after_flash_command|Wait time for the flash process to finish|<parameter name="sleep_time_after_flash_command" value="70" />|
|
75
|
+
# |:command_after_flash|Flash command after flash|<parameter name="command_after_flash" value="" />|
|
76
|
+
# |:switchbox_commands_after_failed_flash|Commands for switchbox after failed flash|<parameter name="switchbox_commands_after_failed_flash" value="" />|
|
77
|
+
# |:commands_after_failed_flash|Commands after failed flash|<parameter name="commands_after_failed_flash" value="" />|
|
78
|
+
# |:flash_command_success_string|If no error then no string is displayed|<parameter name="flash_command_success_string" value="" />|
|
79
|
+
# |:switchbox_commands_after_flash|Commands you want to be executed after flash|<parameter name="switchbox_commands_after_flash" value="" />|
|
80
|
+
|
85
81
|
def flash()
|
86
82
|
|
87
83
|
flash_images
|
@@ -89,49 +85,43 @@ module MobyBehaviour
|
|
89
85
|
end
|
90
86
|
|
91
87
|
# == description
|
92
|
-
# Instructs the sut to start the flash operation with
|
93
|
-
#
|
94
|
-
# <parameter name="flash_attempts" value="2" />
|
95
|
-
# timeout in seconds between the switchbox commands:
|
96
|
-
# <parameter name="timeout_between_command_sequence" value="25" />
|
97
|
-
# commands you want to be executed before flash:
|
98
|
-
# <parameter name="switchbox_commands_before_flash" value="" />
|
99
|
-
# flash commands before flash:
|
100
|
-
# <parameter name="commands_before_flash" value="" />
|
101
|
-
# intial flash command:
|
102
|
-
# <parameter name="flash_command" value="" />
|
103
|
-
# timeout in seconds before executing the commands during flash:
|
104
|
-
# <parameter name="timeout_before_executing_commands_during_flash" value="20" />
|
105
|
-
# commands you want to be executed during flash:
|
106
|
-
# <parameter name="switchbox_commands_during_flash" value="" />
|
107
|
-
# optional flash parameters:
|
108
|
-
# <parameter name="optional_parameters_after_flashing" value="" />
|
109
|
-
# images to flash:
|
110
|
-
# <parameter name="flash_images" value="" />
|
111
|
-
# need to wait for the flash process to finish:
|
112
|
-
# <parameter name="sleep_time_after_flash_command" value="70" />
|
113
|
-
# flash command after flash:
|
114
|
-
# <parameter name="command_after_flash" value="" />
|
115
|
-
# commands for switchbox after failed flash:
|
116
|
-
# <parameter name="switchbox_commands_after_failed_flash" value="" />
|
117
|
-
# commands after failed flash:
|
118
|
-
# <parameter name="commands_after_failed_flash" value="" />
|
119
|
-
# If no error then no string is displayed:
|
120
|
-
# <parameter name="flash_command_success_string" value="" />
|
121
|
-
# commands you want to be executed after flash:
|
122
|
-
# <parameter name="switchbox_commands_after_flash" value="" />
|
88
|
+
# Instructs the sut to start the flash operation with the configured flash files
|
89
|
+
#
|
123
90
|
# == arguments
|
124
91
|
# flash_files
|
125
92
|
# String
|
126
93
|
# description: The location of the software image file
|
127
94
|
# example: "C:/images/flash_image.img"
|
128
95
|
# == returns
|
96
|
+
# Boolean
|
97
|
+
# description: Indicating that did flashing success
|
98
|
+
# example: true
|
129
99
|
# == raises
|
130
100
|
# BehaviourError If mandatory parameters are missing
|
131
101
|
# BehaviourError If flashing is failed
|
132
102
|
# === examples
|
133
103
|
# @sut.flash_images("C:/path/image_file.img")
|
134
|
-
|
104
|
+
# == tables
|
105
|
+
# flash_prameters
|
106
|
+
# title: Flash parameters
|
107
|
+
# description: Flash parameters for sut
|
108
|
+
# |Parameter|Description|Example|
|
109
|
+
# |:flash_attempts|How many times TDriver will attempt to flash the device|<parameter name="flash_attempts" value="2" />|
|
110
|
+
# |:timeout_between_command_sequence|Timeout in seconds between the switchbox commands|<parameter name="timeout_between_command_sequence" value="25" />|
|
111
|
+
# |:switchbox_commands_before_flash|Commands you want to be executed before flash|<parameter name="switchbox_commands_before_flash" value="" />|
|
112
|
+
# |:commands_before_flash|Flash commands before flash|<parameter name="commands_before_flash" value="" />|
|
113
|
+
# |:flash_command|Intial flash command|<parameter name="flash_command" value="" />|
|
114
|
+
# |:timeout_before_executing_commands_during_flash|Timeout in seconds before executing the commands during flash|<parameter name="timeout_before_executing_commands_during_flash" value="20" />|
|
115
|
+
# |:switchbox_commands_during_flash|Commands you want to be executed during flash|<parameter name="switchbox_commands_during_flash" value="" />|
|
116
|
+
# |:optional_parameters_after_flashing|Optional flash parameters|<parameter name="optional_parameters_after_flashing" value="" />|
|
117
|
+
# |:flash_images|Images to flash|<parameter name="flash_images" value="" />|
|
118
|
+
# |:sleep_time_after_flash_command|Wait time for the flash process to finish|<parameter name="sleep_time_after_flash_command" value="70" />|
|
119
|
+
# |:command_after_flash|Flash command after flash|<parameter name="command_after_flash" value="" />|
|
120
|
+
# |:switchbox_commands_after_failed_flash|Commands for switchbox after failed flash|<parameter name="switchbox_commands_after_failed_flash" value="" />|
|
121
|
+
# |:commands_after_failed_flash|Commands after failed flash|<parameter name="commands_after_failed_flash" value="" />|
|
122
|
+
# |:flash_command_success_string|If no error then no string is displayed|<parameter name="flash_command_success_string" value="" />|
|
123
|
+
# |:switchbox_commands_after_flash|Commands you want to be executed after flash|<parameter name="switchbox_commands_after_flash" value="" />|
|
124
|
+
def flash_images(flash_files = nil)
|
135
125
|
file, line = caller.first.split(":")
|
136
126
|
|
137
127
|
begin
|
@@ -221,12 +211,13 @@ module MobyBehaviour
|
|
221
211
|
flash_command="#{str_flash_command} #{flash_files} #{str_optional_parameters}"
|
222
212
|
|
223
213
|
#start flashing
|
224
|
-
result=start_flashing(flash_command)
|
214
|
+
result = start_flashing( flash_command )
|
215
|
+
|
225
216
|
Kernel::raise MobyBase::BehaviourError.new("flash_images", "Flashing failed") if result.to_s == 'false'
|
226
217
|
|
227
218
|
end
|
228
219
|
|
229
|
-
|
220
|
+
private
|
230
221
|
|
231
222
|
def execute_command_sequence(command_sequence)
|
232
223
|
|
@@ -38,7 +38,7 @@ module MobyBehaviour
|
|
38
38
|
# *
|
39
39
|
#
|
40
40
|
# == objects
|
41
|
-
#
|
41
|
+
# sut
|
42
42
|
#
|
43
43
|
module SUT
|
44
44
|
|
@@ -47,38 +47,50 @@ module MobyBehaviour
|
|
47
47
|
# == nodoc
|
48
48
|
attr_accessor(
|
49
49
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
50
|
+
:dump_count, # number of UI dump requests done to current SUT
|
51
|
+
:current_application_id, # id of the current appication if set
|
52
|
+
:input, # the input method used for interacting with this sut as a symbol, eg. :key or :touch.
|
53
|
+
:refresh_tries, # number of retries for ui dump on error case
|
54
|
+
:refresh_timeout # timeout between timeout retry
|
55
55
|
|
56
|
-
|
56
|
+
)
|
57
57
|
|
58
58
|
# == nodoc
|
59
59
|
attr_reader(
|
60
60
|
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
61
|
+
:xml_data, # sut xml_data
|
62
|
+
:x_path, # x_path pattern for xml_data
|
63
|
+
:ui_type, # type of the UI used on the sut, ie. s60, qt, windows
|
64
|
+
:ui_version, # version of the ui used on the sut, ie 3.2.3
|
65
|
+
:frozen, # flag that tells if the ui dump getting is disabled
|
66
|
+
:xml_data_crc, # crc of the previous ui state message
|
67
|
+
:verify_blocks # verify blocks
|
68
68
|
|
69
|
-
|
69
|
+
)
|
70
70
|
|
71
|
-
|
72
71
|
# == description
|
73
72
|
# Connects selected SUT according to configuration in tdriver_parameters.xml.
|
74
|
-
#
|
73
|
+
# == arguments
|
74
|
+
# id
|
75
|
+
# Symbol
|
76
|
+
# description: SUT id
|
77
|
+
# example: :sut_qt
|
78
|
+
# == returns
|
79
|
+
# Boolean
|
80
|
+
# description: Determines if SUT is connected
|
81
|
+
# example: true
|
75
82
|
def connect( id )
|
76
83
|
|
77
84
|
@_sutController.connect( id )
|
78
85
|
|
79
86
|
end
|
80
87
|
|
81
|
-
#
|
88
|
+
# == description
|
89
|
+
# Disconnects the current SUT
|
90
|
+
# == returns
|
91
|
+
# Boolean
|
92
|
+
# description: Determines if SUT is connected
|
93
|
+
# example: false
|
82
94
|
# == examples
|
83
95
|
# @sut.disconnect
|
84
96
|
def disconnect
|
@@ -87,16 +99,26 @@ module MobyBehaviour
|
|
87
99
|
|
88
100
|
end
|
89
101
|
|
102
|
+
# == description
|
90
103
|
# Retrieves the total amount of data received in bytes
|
104
|
+
# == returns
|
105
|
+
# Fixnum
|
106
|
+
# description: Total amount of data received in bytes
|
107
|
+
# example: 65535
|
91
108
|
# == examples
|
92
109
|
# @sut.disconnect
|
93
110
|
def received_data
|
94
|
-
|
111
|
+
|
95
112
|
@_sutController.received_bytes
|
96
113
|
|
97
114
|
end
|
98
115
|
|
116
|
+
# == description
|
99
117
|
# Retrieves the total amount of data sent in bytes
|
118
|
+
# == returns
|
119
|
+
# Fixnum
|
120
|
+
# description: Total amount of data sent in bytes
|
121
|
+
# example: 65535
|
100
122
|
# == examples
|
101
123
|
# @sut.sent_data
|
102
124
|
def sent_data
|
@@ -105,19 +127,35 @@ module MobyBehaviour
|
|
105
127
|
|
106
128
|
end
|
107
129
|
|
108
|
-
#
|
109
|
-
#
|
130
|
+
# == description
|
131
|
+
# Function to disable taking UI dumps from target for a moment. This method might be deprecated in future release.\n
|
132
|
+
# \n
|
133
|
+
# [b]NOTE:[/b] Remember to enable ui dumps again using unfreeze!
|
134
|
+
# == returns
|
135
|
+
# NilClass
|
136
|
+
# description: -
|
137
|
+
# example: -
|
110
138
|
def freeze
|
111
139
|
|
112
140
|
@frozen = true
|
113
141
|
|
142
|
+
nil
|
143
|
+
|
114
144
|
end
|
115
145
|
|
116
|
-
#
|
146
|
+
# == description
|
147
|
+
# Function to enable taking ui dumps from target. This method might be deprecated in future release.\n
|
148
|
+
# \n
|
149
|
+
# == returns
|
150
|
+
# NilClass
|
151
|
+
# description: -
|
152
|
+
# example: -
|
117
153
|
def unfreeze
|
118
154
|
|
119
155
|
@frozen = false
|
120
156
|
|
157
|
+
nil
|
158
|
+
|
121
159
|
end
|
122
160
|
|
123
161
|
# == nodoc
|
@@ -131,41 +169,52 @@ module MobyBehaviour
|
|
131
169
|
|
132
170
|
end
|
133
171
|
|
134
|
-
#
|
172
|
+
# == nodoc
|
173
|
+
# == description
|
174
|
+
# Force to use user defined ui state (e.g. for debugging purposes). Freezes the SUT xml_data, until unfreezed or set to nil.
|
135
175
|
#
|
136
|
-
#
|
137
|
-
#
|
138
|
-
#
|
139
|
-
#
|
140
|
-
#
|
141
|
-
#
|
142
|
-
|
143
|
-
#
|
144
|
-
#
|
176
|
+
# == arguments
|
177
|
+
# xml
|
178
|
+
# String
|
179
|
+
# description: Freeze SUT XML data with given XML string
|
180
|
+
# example: "<tasMessage>.....</tasMessage>"
|
181
|
+
# MobyUtil::XML::Element
|
182
|
+
# description: Freeze SUT XML data with given XML element
|
183
|
+
# example: -
|
184
|
+
# NilClass
|
185
|
+
# description: Unfreeze SUT XML data
|
186
|
+
# example: nil
|
187
|
+
#
|
188
|
+
# == returns
|
189
|
+
# NilClass
|
190
|
+
# description: This method doesn't return anything
|
191
|
+
# example: -
|
192
|
+
#
|
193
|
+
# == exception
|
194
|
+
# TypeError
|
195
|
+
# description: Wrong argument type %s for XML (expected MobyUtil::XML::Element, String or NilClass)
|
145
196
|
def xml_data=( xml )
|
146
197
|
|
198
|
+
xml.check_type( [ MobyUtil::XML::Element, String, NilClass ], "Wrong argument type $1 for XML (expected $2)" )
|
199
|
+
|
147
200
|
if xml.kind_of?( MobyUtil::XML::Element )
|
148
201
|
|
149
202
|
@xml_data = xml
|
203
|
+
@frozen = true
|
150
204
|
|
151
205
|
elsif xml.kind_of?( String )
|
152
206
|
|
153
207
|
@xml_data = MobyUtil::XML.parse_string( xml ).root
|
208
|
+
@frozen = true
|
154
209
|
|
155
|
-
elsif xml.
|
210
|
+
elsif xml.kind_of?( NilClass )
|
156
211
|
|
157
212
|
@xml_data = nil
|
158
|
-
|
159
213
|
@frozen = false
|
160
214
|
|
161
|
-
else
|
162
|
-
|
163
|
-
Kernel::raise ArgumentError.new( "Unexpected argument type (%s) for xml, expected: %s" % [ xml.class, "MobyUtil::XML::Element or String"] )
|
164
|
-
|
165
215
|
end
|
166
|
-
|
167
|
-
|
168
|
-
@frozen = true unless xml.nil?
|
216
|
+
|
217
|
+
nil
|
169
218
|
|
170
219
|
end
|
171
220
|
|
@@ -180,50 +229,50 @@ module MobyBehaviour
|
|
180
229
|
if !@frozen && ( @_previous_refresh.nil? || ( current_time - @_previous_refresh ).to_f > @refresh_interval )
|
181
230
|
|
182
231
|
MobyUtil::Retryable.while(
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
#use find_object if set on and the method exists
|
189
|
-
if MobyUtil::Parameter[ @id ][ :use_find_object, 'false' ] == 'true' and self.methods.include?('find_object')
|
190
|
-
new_xml_data, crc = find_object(refresh_args.clone, creation_attributes)
|
191
|
-
else
|
192
|
-
app_command = MobyCommand::Application.new(
|
193
|
-
:State,
|
194
|
-
( refresh_args[ :FullName ] || refresh_args[ :name ] ),
|
195
|
-
refresh_args[ :id ],
|
196
|
-
self
|
197
|
-
)
|
198
|
-
#store in case needed
|
199
|
-
app_command.refresh_args(refresh_args)
|
200
|
-
new_xml_data, crc = execute_command( app_command )
|
201
|
-
end
|
202
|
-
|
203
|
-
|
204
|
-
# remove timestamp from the beginning of tasMessage, parse if not same as previous ui state
|
205
|
-
if ( xml_data_no_timestamp = new_xml_data.split( ">", 2 ).last ) != @last_xml_data
|
206
|
-
|
207
|
-
@xml_data, @childs_updated = MobyUtil::XML.parse_string( new_xml_data ).root, false
|
208
|
-
|
209
|
-
@last_xml_data = xml_data_no_timestamp
|
210
|
-
|
211
|
-
end
|
212
|
-
|
213
|
-
|
214
|
-
# if ( @xml_data_crc == 0 || crc != @xml_data_crc || crc.nil? )
|
215
|
-
# @xml_data, @xml_data_crc, @childs_updated = MobyUtil::XML.parse_string( new_xml_data ).root, crc, false
|
216
|
-
|
217
|
-
# end
|
218
|
-
|
219
|
-
@dump_count += 1
|
220
|
-
|
221
|
-
@_previous_refresh = current_time
|
232
|
+
:tries => @refresh_tries,
|
233
|
+
:interval => @refresh_interval,
|
234
|
+
:unless => [ MobyBase::ControllerNotFoundError, MobyBase::CommandNotFoundError, MobyBase::ApplicationNotAvailableError ]
|
235
|
+
) {
|
222
236
|
|
223
|
-
|
237
|
+
#use find_object if set on and the method exists
|
238
|
+
if MobyUtil::Parameter[ @id ][ :use_find_object, 'false' ] == 'true' and self.respond_to?('find_object') # self.methods.include?('find_object')
|
224
239
|
|
225
|
-
|
226
|
-
|
240
|
+
new_xml_data, crc = find_object( refresh_args.clone, creation_attributes )
|
241
|
+
|
242
|
+
else
|
243
|
+
|
244
|
+
app_command = MobyCommand::Application.new(
|
245
|
+
:State,
|
246
|
+
refresh_args[ :FullName ] || refresh_args[ :name ],
|
247
|
+
refresh_args[ :id ],
|
248
|
+
self
|
249
|
+
)
|
250
|
+
|
251
|
+
#store in case needed
|
252
|
+
app_command.refresh_args( refresh_args )
|
253
|
+
|
254
|
+
new_xml_data, crc = execute_command( app_command )
|
255
|
+
|
256
|
+
end
|
257
|
+
|
258
|
+
# remove timestamp from the beginning of tasMessage, parse if not same as previous ui state
|
259
|
+
#if ( xml_data_no_timestamp = new_xml_data.split( ">", 2 ).last ) != @last_xml_data
|
260
|
+
|
261
|
+
@xml_data, @childs_updated = MobyUtil::XML.parse_string( new_xml_data ).root, false
|
262
|
+
|
263
|
+
#@last_xml_data = xml_data_no_timestamp
|
264
|
+
|
265
|
+
#end
|
266
|
+
|
267
|
+
#if ( @xml_data_crc == 0 || crc != @xml_data_crc || crc.nil? )
|
268
|
+
# @xml_data, @xml_data_crc, @childs_updated = MobyUtil::XML.parse_string( new_xml_data ).root, crc, false
|
269
|
+
#end
|
270
|
+
|
271
|
+
@dump_count += 1
|
272
|
+
|
273
|
+
@_previous_refresh = current_time
|
274
|
+
|
275
|
+
}
|
227
276
|
|
228
277
|
end
|
229
278
|
|
@@ -233,109 +282,107 @@ module MobyBehaviour
|
|
233
282
|
|
234
283
|
end
|
235
284
|
|
236
|
-
#
|
237
|
-
#
|
238
|
-
#
|
239
|
-
# and associates self as child object's parent.
|
285
|
+
# TODO: merge TestObject#child and SUT#child
|
286
|
+
# == description
|
287
|
+
# Creates a child test object from this SUT. SUT object will be associated as child test objects parent.\n
|
240
288
|
#
|
241
|
-
# NOTE:
|
242
|
-
#
|
243
|
-
#
|
244
|
-
#
|
289
|
+
# [b]NOTE:[/b] Subsequent calls to TestObject#child( rule ) always returns reference to same Testobject:\n
|
290
|
+
# [code]a = sut.child( :type => 'Button', :text => '1' )
|
291
|
+
# b = sut.child( :type => 'Button', :text => '1' )
|
292
|
+
# a.eql?( b ) # => true[/code]
|
293
|
+
#
|
294
|
+
# == arguments
|
295
|
+
# attributes
|
296
|
+
# Hash
|
297
|
+
# description: Hash object holding information for identifying which child to create
|
298
|
+
# example: { :type => "application" }
|
245
299
|
#
|
246
|
-
# == params
|
247
|
-
# hash_rule:: Hash object holding information for identifying which child to create, eg. :type => :application
|
248
300
|
# == returns
|
249
|
-
# TestObject
|
250
|
-
|
301
|
+
# TestObject
|
302
|
+
# description: New child test object or reference to existing child
|
303
|
+
# example: -
|
304
|
+
def child( attributes )
|
251
305
|
|
252
|
-
|
306
|
+
###############################################################################################################
|
307
|
+
#
|
308
|
+
# NOTICE: Please do not add anything unnessecery to this method, it might cause a major performance impact
|
309
|
+
#
|
310
|
+
|
311
|
+
# verify attributes argument format
|
312
|
+
attributes.check_type( Hash, "Wrong argument type $1 for attributes (expected $2)" )
|
313
|
+
|
314
|
+
# store original hash
|
315
|
+
creation_hash = attributes.clone
|
253
316
|
|
254
|
-
|
317
|
+
identification_directives = creation_hash.strip_dynamic_attributes!
|
255
318
|
|
256
|
-
|
257
|
-
|
319
|
+
# raise exception if wrong value type given for ;__logging
|
320
|
+
identification_directives[ :__logging ].check_type(
|
321
|
+
|
322
|
+
[ TrueClass, FalseClass ],
|
323
|
+
|
324
|
+
"Wrong value type $1 for :__logging test object creation directive (expected $2)"
|
325
|
+
|
326
|
+
) if identification_directives.has_key?( :__logging )
|
327
|
+
|
328
|
+
# disable logging if requested, remove pair from creation_hash
|
329
|
+
MobyUtil::Logger.instance.push_enabled( identification_directives[ :__logging ] || TDriver.logger.enabled )
|
258
330
|
|
259
331
|
begin
|
260
332
|
|
261
|
-
|
262
|
-
child_test_object = @test_object_factory.
|
333
|
+
# TODO: refactor me
|
334
|
+
child_test_object = @test_object_factory.get_test_objects(
|
335
|
+
|
336
|
+
# current object as parent, can be either TestObject or SUT
|
337
|
+
:parent => self,
|
338
|
+
|
339
|
+
# test object identification hash
|
340
|
+
:object_attributes_hash => creation_hash,
|
341
|
+
|
342
|
+
:identification_directives => identification_directives
|
343
|
+
|
344
|
+
)
|
263
345
|
|
264
346
|
rescue MobyBase::MultipleTestObjectsIdentifiedError => exception
|
265
347
|
|
266
|
-
MobyUtil::Logger.instance.log "behaviour", "FAIL;Multiple child objects matched criteria.;#{ id };sut;{};child;#{
|
348
|
+
MobyUtil::Logger.instance.log "behaviour", "FAIL;Multiple child objects matched criteria.;#{ id };sut;{};child;#{ attributes.inspect }"
|
349
|
+
|
267
350
|
Kernel::raise exception
|
268
351
|
|
269
352
|
rescue MobyBase::TestObjectNotFoundError => exception
|
270
353
|
|
271
|
-
MobyUtil::Logger.instance.log "behaviour", "FAIL;The child object could not be found.;#{ id };sut;{};child;#{
|
354
|
+
MobyUtil::Logger.instance.log "behaviour", "FAIL;The child object could not be found.;#{ id };sut;{};child;#{ attributes.inspect }"
|
355
|
+
|
272
356
|
Kernel::raise exception
|
273
357
|
|
274
358
|
rescue Exception => exception
|
275
359
|
|
276
|
-
MobyUtil::Logger.instance.log "behaviour", "FAIL;Failed when trying to find child object.;#{ id };sut;{};child;#{
|
360
|
+
MobyUtil::Logger.instance.log "behaviour", "FAIL;Failed when trying to find child object.;#{ id };sut;{};child;#{ attributes.inspect }"
|
361
|
+
|
277
362
|
Kernel::raise exception
|
278
363
|
|
279
364
|
ensure
|
280
365
|
|
281
|
-
|
282
|
-
MobyUtil::Logger.instance.
|
366
|
+
# restore original logger state
|
367
|
+
MobyUtil::Logger.instance.pop_enabled
|
283
368
|
|
284
369
|
end
|
285
370
|
|
286
|
-
# return
|
287
|
-
child_test_object.add_parent( self )
|
288
|
-
|
289
|
-
# Type information is stored in a separate member, not in the Hash
|
290
|
-
creation_hash.delete( :type )
|
291
|
-
|
292
|
-
@_child_object_cache.each_value do | _child |
|
293
|
-
|
294
|
-
if _child.eql?( child_test_object )
|
295
|
-
|
296
|
-
# Update the attributes that were used to create the child object.
|
297
|
-
#_child.creation_attributes = creation_hash
|
298
|
-
|
299
|
-
_child.instance_eval("@creation_attributes = #{ creation_hash.inspect }")
|
300
|
-
|
301
|
-
return _child
|
302
|
-
|
303
|
-
end
|
304
|
-
|
305
|
-
end
|
306
|
-
|
307
|
-
=begin
|
308
|
-
@_child_objects.each do | _child |
|
309
|
-
|
310
|
-
if _child.eql? child_test_object
|
311
|
-
|
312
|
-
# Update the attributes that were used to create the child object.
|
313
|
-
_child.creation_attributes = creation_hash
|
314
|
-
return _child
|
315
|
-
|
316
|
-
end
|
317
|
-
|
318
|
-
end
|
319
|
-
=end
|
320
|
-
# Store the attributes that were used to create the child object.
|
321
|
-
child.creation_attributes = creation_hash
|
322
|
-
|
323
|
-
add_child( child_test_object )
|
324
|
-
|
371
|
+
# return child test object
|
325
372
|
child_test_object
|
326
373
|
|
327
374
|
end
|
328
375
|
|
329
|
-
|
376
|
+
# == description
|
330
377
|
# Returns a StateObject containing the current state of this test object as XML.
|
331
378
|
# The state object is static and thus is not refreshed or synchronized etc.
|
332
379
|
# == returns
|
333
|
-
# StateObject
|
380
|
+
# StateObject
|
381
|
+
# description: State of this test object
|
382
|
+
# example: -
|
334
383
|
# == exceptions
|
335
384
|
# RuntimeError
|
336
|
-
#
|
337
|
-
# == example
|
338
|
-
# sut_state = @sut.state #get the state object for the sut
|
385
|
+
# description: If the XML source for the object is not in initialized
|
339
386
|
def state
|
340
387
|
|
341
388
|
# refresh if xml data is empty
|
@@ -343,16 +390,12 @@ module MobyBehaviour
|
|
343
390
|
|
344
391
|
Kernel::raise RuntimeError.new( "Can not create state object of SUT with id '%s', no XML content or SUT not initialized properly." % @id ) if @xml_data.empty?
|
345
392
|
|
346
|
-
MobyBase::StateObject.new(
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
).root,
|
353
|
-
self
|
354
|
-
|
355
|
-
)
|
393
|
+
MobyBase::StateObject.new(
|
394
|
+
MobyUtil::XML.parse_string(
|
395
|
+
"<sut name='sut' type='sut' id='%s'><objects>%s</objects></sut>" % [ @id, xml_data.xpath("tasInfo/object").collect{ | element | element.to_s }.join ]
|
396
|
+
).root,
|
397
|
+
self
|
398
|
+
)
|
356
399
|
|
357
400
|
end
|
358
401
|
|
@@ -371,17 +414,20 @@ module MobyBehaviour
|
|
371
414
|
# example: -
|
372
415
|
#
|
373
416
|
# == exceptions
|
374
|
-
#
|
375
|
-
#
|
417
|
+
# TypeError
|
418
|
+
# description: Wrong argument type %s for attributes (expected Hash)
|
419
|
+
#
|
376
420
|
def application( attributes = {} )
|
377
421
|
|
378
422
|
begin
|
379
423
|
|
380
|
-
|
424
|
+
attributes.check_type( Hash, "Wrong argument type $1 for attributes (expected $2)" )
|
425
|
+
|
381
426
|
get_default_app = attributes.empty?
|
427
|
+
|
382
428
|
attributes[ :type ] = 'application'
|
383
|
-
current_application_id = nil if attributes[ :id ].nil?
|
384
429
|
|
430
|
+
@current_application_id = nil if attributes[ :id ].nil?
|
385
431
|
|
386
432
|
app_child = child( attributes )
|
387
433
|
|
@@ -406,13 +452,13 @@ module MobyBehaviour
|
|
406
452
|
# Hash
|
407
453
|
# description:
|
408
454
|
# Options to be used for screen capture. See [link="#capture_options_table"]Options table[/link] for valid keys
|
409
|
-
# example: ( :
|
455
|
+
# example: ( :filename => "output.png" )
|
410
456
|
#
|
411
457
|
# == tables
|
412
458
|
# capture_options_table
|
413
459
|
# title: Options table
|
414
460
|
# |Key|Type|Description|Example|Required|
|
415
|
-
# |:
|
461
|
+
# |:filename|String|Store output binary to this file. Absolute or relative path supported.|:filename => "screen_shots/output.png"|Yes|
|
416
462
|
#
|
417
463
|
# == returns
|
418
464
|
# NilClass
|
@@ -420,33 +466,53 @@ module MobyBehaviour
|
|
420
466
|
# example: -
|
421
467
|
#
|
422
468
|
# == exceptions
|
469
|
+
# TypeError
|
470
|
+
# description: Wrong argument type %s (expected Hash)
|
471
|
+
#
|
423
472
|
# ArgumentError
|
424
|
-
# description:
|
473
|
+
# description: Output filename (:filename) not defined in argument hash
|
425
474
|
#
|
426
475
|
# ArgumentError
|
427
|
-
#
|
476
|
+
# description: Wrong argument type %s for output filename (expected String)
|
428
477
|
#
|
429
478
|
# ArgumentError
|
430
|
-
# description:
|
479
|
+
# description: Output filename must not be empty string
|
431
480
|
#
|
432
481
|
def capture_screen( arguments )
|
433
482
|
|
434
483
|
begin
|
435
484
|
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
485
|
+
# raise exception with default message if wrong argument type given
|
486
|
+
arguments.check_type( Hash, "Wrong argument type $1 (expected $2)" )
|
487
|
+
|
488
|
+
# legacy support: support also :Filename
|
489
|
+
arguments[ :filename ] = arguments.delete( :Filename ) if arguments.has_key?( :Filename )
|
490
|
+
|
491
|
+
# raise exception with default message if hash doesn't contain required key
|
492
|
+
arguments.require_key( :filename, "Output filename ($1) not defined in argument hash" )
|
493
|
+
|
494
|
+
# verify that filename is type of String
|
495
|
+
arguments[ :filename ].check_type( String, "Wrong argument type $1 for output filename (expected $2)" )
|
496
|
+
|
497
|
+
# verify that filename is not empty string
|
498
|
+
arguments[ :filename ].not_empty( "Output filename must not be empty string" )
|
440
499
|
|
441
|
-
|
442
|
-
|
443
|
-
image_binary = execute_command( screen_capture_command_object )
|
500
|
+
# create screen capture command object
|
501
|
+
command = MobyCommand::ScreenCapture.new()
|
444
502
|
|
445
|
-
|
503
|
+
command.redraw = arguments[ :Redraw ] if arguments[ :Redraw ]
|
504
|
+
|
505
|
+
# execute command and write binary to file
|
506
|
+
File.open( File.expand_path( arguments[ :filename ] ), 'wb:binary' ){ | file |
|
507
|
+
|
508
|
+
file << execute_command( command )
|
509
|
+
|
510
|
+
}
|
446
511
|
|
447
512
|
rescue Exception => e
|
448
513
|
|
449
|
-
MobyUtil::Logger.instance.log "behaviour" , "FAIL;Failed to capture screen.;#{id.to_s};sut;{};capture_screen;" << (arguments.kind_of?( Hash ) ? arguments.inspect : arguments.class.to_s )
|
514
|
+
MobyUtil::Logger.instance.log "behaviour" , "FAIL;Failed to capture screen.;#{id.to_s};sut;{};capture_screen;" << ( arguments.kind_of?( Hash ) ? arguments.inspect : arguments.class.to_s )
|
515
|
+
|
450
516
|
Kernel::raise e
|
451
517
|
|
452
518
|
end
|
@@ -457,47 +523,61 @@ module MobyBehaviour
|
|
457
523
|
|
458
524
|
end
|
459
525
|
|
526
|
+
# == description
|
460
527
|
# Instructs the SUT to start the specified application if it is not currenly being executed
|
461
528
|
# The application will also be brought to the foregound.
|
462
|
-
#
|
463
|
-
#
|
464
|
-
#
|
465
|
-
#
|
466
|
-
#
|
467
|
-
#
|
468
|
-
#
|
469
|
-
#
|
470
|
-
#
|
471
|
-
#
|
472
|
-
#
|
473
|
-
#
|
474
|
-
#
|
475
|
-
#
|
476
|
-
#
|
477
|
-
#
|
529
|
+
#
|
530
|
+
# == arguments
|
531
|
+
# target
|
532
|
+
# Hash
|
533
|
+
# description: used to indetify the application to be executed. All symbols defined in the hash must match with the launched application. See application [link="#run_hash_arguments"]run argument hash keys[/link] table.
|
534
|
+
# example: { :name => 'calculator' }
|
535
|
+
#
|
536
|
+
# == tables
|
537
|
+
# run_hash_arguments
|
538
|
+
# title: Run argument hash keys
|
539
|
+
# description: The following symbols can be defined in the hash, at least one them must be defined.
|
540
|
+
# |Key|Type|Description|Example|
|
541
|
+
# |:uid|String or Integer|Unique ID of the application|{ :uid => 268458181 }|
|
542
|
+
# |:name|String|Executable name of the application|{ :name => 'calculator' }|
|
543
|
+
# |:arguments|String|Comma separated list of arguments passed to application when starting|{ :arguments => '--nogui,-v' }|
|
544
|
+
#
|
545
|
+
# == returns
|
546
|
+
# TestObject
|
547
|
+
# description: Test object of the started application
|
548
|
+
# example: -
|
549
|
+
#
|
550
|
+
# == exceptions
|
551
|
+
# TypeError
|
552
|
+
# description: Wrong argument type %s for run method (expected Hash)
|
553
|
+
#
|
554
|
+
# ArgumentError
|
555
|
+
# description: Required key :uid or :name not found from argument hash
|
556
|
+
#
|
557
|
+
# VerificationError
|
558
|
+
# description: If no application test object can be found after starting the application, or the found object does not match the launched application
|
559
|
+
#
|
478
560
|
def run( target )
|
479
561
|
|
480
562
|
begin
|
563
|
+
|
481
564
|
# set the refresh interval to zero while the application is launched
|
482
565
|
#orig_interval = MobyUtil::Parameter[ @id ][ :refresh_interval ]
|
483
566
|
#MobyUtil::Parameter[ @id ][ :refresh_interval ] = '0'
|
484
567
|
|
485
568
|
# raise exception if argument type other than hash
|
486
|
-
|
569
|
+
target.check_type( Hash, "Wrong argument type $1 for run method (expected $2)" )
|
487
570
|
|
488
|
-
# default value for keys
|
571
|
+
# default value for missing keys
|
489
572
|
target.default = nil
|
490
573
|
|
491
|
-
|
574
|
+
# raise exception if :uid or :name not found from hash
|
575
|
+
target.require_key( [ :uid, :name ], "Required key :uid or :name not found from argument hash" )
|
492
576
|
|
493
|
-
|
494
|
-
# ArgumentError is raised by MobyCommnand::Application if the parameters are not valid
|
495
|
-
sleep_time = target[ :sleep_after_launch ].to_i #( target[ :sleep_after_launch ] == nil ? 0 : target[ :sleep_after_launch ].to_i)
|
577
|
+
sleep_time = target[ :sleep_after_launch ].to_i
|
496
578
|
|
497
|
-
#Kernel::raise ArgumentError.new( "Sleep time need to be Integer >= 0" ) unless sleep_time.kind_of? Numeric #instance_of?( Fixnum )
|
498
579
|
Kernel::raise ArgumentError.new( "Sleep time need to be >= 0" ) unless sleep_time >= 0
|
499
580
|
|
500
|
-
|
501
581
|
# try to find an existing app with the current arguments
|
502
582
|
if target[ :try_attach ]
|
503
583
|
|
@@ -506,36 +586,52 @@ module MobyBehaviour
|
|
506
586
|
# either ID or NAME have been passed to identify the application
|
507
587
|
# raise exception if more than one app has been found for this id/name
|
508
588
|
# otherwhise attempt to get the application test object
|
589
|
+
|
509
590
|
app_info = find_app(app_list, {:id => target[ :uid ]}) if target[ :uid ] != nil
|
510
591
|
app_info = find_app(app_list, {:name => target[ :name ]}) unless app_info
|
511
592
|
app = self.application(:id => app_info.id) if app_info
|
593
|
+
|
512
594
|
if app
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
595
|
+
|
596
|
+
begin
|
597
|
+
|
598
|
+
app.bring_to_foreground
|
599
|
+
|
600
|
+
rescue Exception => e
|
601
|
+
|
602
|
+
MobyUtil::Logger.instance.log "WARNING", "Could not bring app to foreground"
|
603
|
+
|
604
|
+
end
|
605
|
+
|
606
|
+
return app
|
607
|
+
|
519
608
|
end
|
609
|
+
|
520
610
|
end
|
521
611
|
|
522
612
|
if ( target[ :start_command ] != nil )
|
613
|
+
|
523
614
|
Kernel::raise MobyBase::BehaviourError.new("Run", "Failed to load execute_shell_method") unless self.respond_to?("execute_shell_command")
|
615
|
+
|
524
616
|
execute_shell_command( target[ :start_command ], :detached => "true" )
|
617
|
+
|
525
618
|
else
|
526
|
-
run_command = MobyCommand::Application.new(
|
527
|
-
:Run,
|
528
|
-
target[ :name ],
|
529
|
-
target[ :uid ],
|
530
|
-
self,
|
531
|
-
target[ :arguments ],
|
532
|
-
target[ :environment ],
|
533
|
-
target[ :events_to_listen ],
|
534
|
-
target[ :signals_to_listen ]
|
535
|
-
)
|
536
619
|
|
537
620
|
# execute the application control service request
|
538
|
-
execute_command(
|
621
|
+
execute_command(
|
622
|
+
|
623
|
+
MobyCommand::Application.new(
|
624
|
+
:Run,
|
625
|
+
target[ :name ],
|
626
|
+
target[ :uid ],
|
627
|
+
self,
|
628
|
+
target[ :arguments ],
|
629
|
+
target[ :environment ],
|
630
|
+
target[ :events_to_listen ],
|
631
|
+
target[ :signals_to_listen ]
|
632
|
+
)
|
633
|
+
|
634
|
+
)
|
539
635
|
|
540
636
|
end
|
541
637
|
|
@@ -545,22 +641,16 @@ module MobyBehaviour
|
|
545
641
|
|
546
642
|
sleep sleep_time if sleep_time > 0
|
547
643
|
|
548
|
-
|
549
|
-
#PKI: one refresh might not be enough as application launch takes more time sometimes
|
550
|
-
#PKI: added artificial wait for now until this has been refactored
|
551
|
-
|
552
|
-
expected_attributes = Hash.new
|
553
|
-
|
554
|
-
expected_attributes[ :type ] = 'application'
|
644
|
+
expected_attributes = { :type => 'application' }
|
555
645
|
|
556
646
|
expected_attributes[ :id ] = target[ :uid ] unless target[ :uid ].nil?
|
647
|
+
|
557
648
|
expected_attributes[ :FullName ] = target[ :name ] unless target[ :name ].nil?
|
558
649
|
|
559
650
|
error_details = target[ :name ].nil? ? "" : "name: " << target[ :name ].to_s
|
560
|
-
|
561
651
|
error_details << ( error_details.empty? ? "" : ", ") << "id: " << target[ :uid ].to_s if !target[ :uid ].nil?
|
562
652
|
|
563
|
-
if(
|
653
|
+
if( !expected_attributes[ :FullName ].nil? )
|
564
654
|
|
565
655
|
if( expected_attributes[ :FullName ].include?('/') )
|
566
656
|
|
@@ -589,10 +679,10 @@ module MobyBehaviour
|
|
589
679
|
begin
|
590
680
|
|
591
681
|
self.wait_child(
|
592
|
-
|
593
|
-
|
594
|
-
|
595
|
-
|
682
|
+
expected_attributes,
|
683
|
+
MobyUtil::Parameter[ @id ][ :application_synchronization_timeout, '5' ].to_f,
|
684
|
+
MobyUtil::Parameter[ @id ][ :application_synchronization_retry_interval, '0.5' ].to_f
|
685
|
+
)
|
596
686
|
|
597
687
|
rescue MobyBase::SyncTimeoutError
|
598
688
|
|
@@ -611,10 +701,6 @@ module MobyBehaviour
|
|
611
701
|
|
612
702
|
Kernel::raise MobyBase::BehaviourError.new("Run", "Failed to launch application")
|
613
703
|
|
614
|
-
#MobyBase::Error.raise( :BehaviourErrorOccured, "Run", "Failed to launch application", e.message )
|
615
|
-
#Kernel::raise behaviour_runtime_error("Run", "Failed to launch application", e.message, e.backtrace)
|
616
|
-
#Kernel::raise e
|
617
|
-
|
618
704
|
end
|
619
705
|
|
620
706
|
MobyUtil::Logger.instance.log "behaviour" , "PASS;The application was launched successfully.;#{id.to_s};sut;{};run;" << target.inspect
|
@@ -648,7 +734,7 @@ module MobyBehaviour
|
|
648
734
|
# |:LongPress|Holds a key as long_press_timeout specifies in tdriver_parameters.xml. Please note also long_press_interval (Only for S60)|MobyCommand::KeySequence.new( :kApp, :LongPress )|
|
649
735
|
#
|
650
736
|
# == arguments
|
651
|
-
#
|
737
|
+
# value
|
652
738
|
# Symbol
|
653
739
|
# description: one of the key symbols defined in /tdriver/keymaps/
|
654
740
|
# example: @sut.press_key(:kDown)
|
@@ -662,38 +748,29 @@ module MobyBehaviour
|
|
662
748
|
# example: -
|
663
749
|
#
|
664
750
|
# == exceptions
|
665
|
-
#
|
666
|
-
# description:
|
751
|
+
# TypeError
|
752
|
+
# description: Wrong argument type $1 for press_key (expected $2)
|
667
753
|
#
|
668
|
-
def press_key(
|
754
|
+
def press_key( value )
|
669
755
|
|
670
756
|
begin
|
671
757
|
|
672
|
-
|
673
|
-
|
674
|
-
sequence = MobyCommand::KeySequence.new( symbol_or_sequence )
|
675
|
-
|
676
|
-
elsif symbol_or_sequence.instance_of? MobyCommand::KeySequence
|
677
|
-
|
678
|
-
sequence = symbol_or_sequence
|
758
|
+
value.check_type( [ Symbol, MobyCommand::KeySequence ], "Wrong argument type $1 for press_key (expected $2)" )
|
679
759
|
|
680
|
-
|
681
|
-
|
682
|
-
raise ArgumentError.new('Data not of type Symbol or MobyController::KeySequence.')
|
683
|
-
|
684
|
-
end
|
760
|
+
sequence = value.kind_of?( Symbol ) ? MobyCommand::KeySequence.new( value ) : value
|
685
761
|
|
686
762
|
sequence.set_sut( self )
|
763
|
+
|
687
764
|
execute_command( sequence )
|
688
765
|
|
689
766
|
rescue Exception => e
|
690
767
|
|
691
|
-
MobyUtil::Logger.instance.log "behaviour" , "FAIL;Failed to press key(s).;#{id.to_s};sut;{};press_key;#{
|
768
|
+
MobyUtil::Logger.instance.log "behaviour" , "FAIL;Failed to press key(s).;#{id.to_s};sut;{};press_key;#{ value }"
|
692
769
|
Kernel::raise e
|
693
770
|
|
694
771
|
end
|
695
772
|
|
696
|
-
MobyUtil::Logger.instance.log "behaviour" , "PASS;Successfully pressed key(s).;#{id.to_s};sut;{};press_key;#{
|
773
|
+
MobyUtil::Logger.instance.log "behaviour" , "PASS;Successfully pressed key(s).;#{id.to_s};sut;{};press_key;#{ value }"
|
697
774
|
|
698
775
|
nil
|
699
776
|
|
@@ -705,29 +782,29 @@ module MobyBehaviour
|
|
705
782
|
#
|
706
783
|
# == arguments
|
707
784
|
# *arguments
|
708
|
-
#
|
785
|
+
# String
|
709
786
|
# description: Optional argument which is the name of parameter.
|
710
787
|
# example: 'new_parameter'
|
711
788
|
# Symbol
|
712
789
|
# description: Optional argument which is the name of parameter.
|
713
|
-
#
|
790
|
+
# example: :product
|
714
791
|
#
|
715
792
|
# == returns
|
716
793
|
# String
|
717
|
-
#
|
718
|
-
#
|
794
|
+
# description: Value matching the parameter name given as argument
|
795
|
+
# example: 'testability-driver-qt-sut-plugin'
|
719
796
|
#
|
720
797
|
# MobyUtil::ParameterHash
|
721
|
-
#
|
798
|
+
# description: Hash of values, if no arguments is specified
|
722
799
|
# example: { :value => '1', :inner_hash => { :another_value => 100 } }
|
723
800
|
#
|
724
801
|
# == exceptions
|
725
802
|
# ParameterNotFoundError
|
726
|
-
#
|
803
|
+
# description: If the parameter with the given name does not exist
|
727
804
|
#
|
728
805
|
# == example
|
729
|
-
# parameter_hash = @sut.parameter
|
730
|
-
# value = @sut.parameter[:product]
|
806
|
+
# parameter_hash = @sut.parameter #returns the hash of all sut parameters
|
807
|
+
# value = @sut.parameter[:product] #returns the value for parameter 'product' for this particular sut
|
731
808
|
# value = @sut.parameter['non_existing_parameter'] #raises exception that 'non_existing_parameter' was not found
|
732
809
|
# value = sut.parameter['non_existing_parameter', 'default'] #returns default value if given parameter is not found
|
733
810
|
# sut.parameter[:new_parameter] ='new_value' # set the value of parameter 'product' for this particular sut
|
@@ -747,185 +824,191 @@ module MobyBehaviour
|
|
747
824
|
|
748
825
|
end
|
749
826
|
|
750
|
-
|
751
|
-
|
752
|
-
|
753
|
-
|
754
|
-
|
755
|
-
|
756
|
-
|
757
|
-
|
758
|
-
|
759
|
-
|
760
|
-
|
761
|
-
|
762
|
-
|
763
|
-
|
764
|
-
|
765
|
-
|
766
|
-
|
767
|
-
|
768
|
-
|
769
|
-
|
770
|
-
|
771
|
-
|
772
|
-
|
773
|
-
|
774
|
-
|
775
|
-
|
776
|
-
|
777
|
-
|
778
|
-
|
779
|
-
|
780
|
-
|
781
|
-
|
782
|
-
|
783
|
-
|
784
|
-
|
785
|
-
|
786
|
-
|
787
|
-
|
788
|
-
|
789
|
-
|
790
|
-
|
791
|
-
|
792
|
-
|
793
|
-
|
794
|
-
|
795
|
-
|
796
|
-
|
797
|
-
|
798
|
-
|
799
|
-
|
800
|
-
|
801
|
-
|
802
|
-
|
803
|
-
|
804
|
-
|
805
|
-
|
806
|
-
|
807
|
-
|
808
|
-
|
809
|
-
|
810
|
-
|
811
|
-
|
812
|
-
|
813
|
-
|
814
|
-
|
815
|
-
|
816
|
-
|
817
|
-
|
818
|
-
|
819
|
-
|
820
|
-
|
821
|
-
|
822
|
-
|
823
|
-
|
824
|
-
|
825
|
-
|
826
|
-
|
827
|
-
|
828
|
-
|
829
|
-
|
830
|
-
|
831
|
-
|
832
|
-
|
833
|
-
|
834
|
-
|
835
|
-
|
836
|
-
|
837
|
-
|
838
|
-
|
839
|
-
|
840
|
-
|
841
|
-
|
842
|
-
|
843
|
-
|
844
|
-
|
845
|
-
|
846
|
-
|
847
|
-
|
848
|
-
|
849
|
-
|
850
|
-
|
851
|
-
|
852
|
-
|
853
|
-
|
854
|
-
|
855
|
-
|
856
|
-
|
857
|
-
|
858
|
-
|
859
|
-
|
860
|
-
|
861
|
-
|
862
|
-
|
863
|
-
|
864
|
-
|
865
|
-
|
866
|
-
|
867
|
-
|
868
|
-
|
869
|
-
|
870
|
-
|
871
|
-
|
872
|
-
|
873
|
-
|
874
|
-
|
875
|
-
|
876
|
-
|
877
|
-
|
878
|
-
|
879
|
-
|
880
|
-
|
881
|
-
|
882
|
-
|
883
|
-
|
884
|
-
|
885
|
-
|
886
|
-
|
887
|
-
|
888
|
-
|
889
|
-
|
890
|
-
|
891
|
-
|
892
|
-
|
893
|
-
|
894
|
-
|
895
|
-
|
896
|
-
|
897
|
-
|
898
|
-
|
899
|
-
|
900
|
-
|
901
|
-
|
902
|
-
|
903
|
-
|
904
|
-
|
905
|
-
|
906
|
-
|
907
|
-
|
908
|
-
|
909
|
-
|
910
|
-
|
911
|
-
|
912
|
-
|
913
|
-
|
914
|
-
|
915
|
-
|
916
|
-
|
917
|
-
|
918
|
-
|
919
|
-
|
920
|
-
|
921
|
-
|
922
|
-
|
923
|
-
|
924
|
-
|
925
|
-
|
926
|
-
|
927
|
-
|
928
|
-
|
827
|
+
# == description
|
828
|
+
# Wrapper function to return translated string for this SUT to read the values from localisation database.
|
829
|
+
#
|
830
|
+
# == arguments
|
831
|
+
# logical_name
|
832
|
+
# String
|
833
|
+
# description: Logical name (LNAME) of the item to be translated. If prefix for User Information or Operator Data are used then the appropiate retrieve methods will be called
|
834
|
+
# example: "txt_button_ok"
|
835
|
+
# Symbol
|
836
|
+
# description: Symbol form of the logical name (LNAME) of the item to be translated.
|
837
|
+
# example: :txt_button_ok
|
838
|
+
#
|
839
|
+
# file_name
|
840
|
+
# String
|
841
|
+
# description: Optional FNAME search argument for the translation
|
842
|
+
# example: "agenda"
|
843
|
+
# default: nil
|
844
|
+
#
|
845
|
+
# plurality
|
846
|
+
# String
|
847
|
+
# description: Optional PLURALITY search argument for the translation
|
848
|
+
# example: "a" or "singular"
|
849
|
+
# default: nil
|
850
|
+
#
|
851
|
+
# numerus
|
852
|
+
# String
|
853
|
+
# description: Optional numeral replacement of an '%Ln | %1' tag on the translated string
|
854
|
+
# example: "1"
|
855
|
+
# default: nil
|
856
|
+
# Integer
|
857
|
+
# description: Optional numeral replacement of an '%Ln | %1' tag on the translated string
|
858
|
+
# example: 1
|
859
|
+
# Array
|
860
|
+
# description: Optional numeral replacements for multiple '%L1 | %1, %L2 | %2, ...' tags on the translated string
|
861
|
+
# example: [ 3, 2]
|
862
|
+
#
|
863
|
+
# lengthvariant
|
864
|
+
# String
|
865
|
+
# description: Optional LENGTHVAR search argument for the translation (1-9)
|
866
|
+
# example: "1"
|
867
|
+
# default: nil
|
868
|
+
#
|
869
|
+
# == returns
|
870
|
+
# String
|
871
|
+
# description: Translation matching the logical_name
|
872
|
+
# example: "Ok"
|
873
|
+
# Array
|
874
|
+
# description: If multiple translations have been found for the search conditions an Array with all Strings be returned
|
875
|
+
# example: ["Ok", "OK"]
|
876
|
+
#
|
877
|
+
# == exceptions
|
878
|
+
# LanguageNotFoundError
|
879
|
+
# description: In case language is not found
|
880
|
+
#
|
881
|
+
# LogicalNameNotFoundError
|
882
|
+
# description: In case no logical name is not found for current language
|
883
|
+
#
|
884
|
+
# SqlError
|
885
|
+
# description: In case there are problems with the database connectivity
|
886
|
+
#
|
887
|
+
def translate( logical_name, file_name = nil, plurality = nil, numerus = nil, lengthvariant = nil )
|
888
|
+
Kernel::raise LogicalNameNotFoundError.new("Logical name is nil") if logical_name.nil?
|
889
|
+
translation_type = "localisation"
|
890
|
+
|
891
|
+
# Check for User Information prefix( "uif_...")
|
892
|
+
MobyUtil::Parameter[ :user_data_logical_string_identifier, 'uif_' ].split('|').each do |identifier|
|
893
|
+
if logical_name.to_s.index(identifier)==0
|
894
|
+
translation_type="user_data"
|
895
|
+
end
|
896
|
+
end
|
897
|
+
|
898
|
+
# Check for Operator Data prefix( "operator_...")
|
899
|
+
MobyUtil::Parameter[ :operator_data_logical_string_identifier, 'operator_' ].split('|').each do |identifier|
|
900
|
+
if logical_name.to_s.index(identifier)==0
|
901
|
+
translation_type="operator_data"
|
902
|
+
end
|
903
|
+
end
|
904
|
+
|
905
|
+
case translation_type
|
906
|
+
when "user_data"
|
907
|
+
get_user_information( logical_name )
|
908
|
+
|
909
|
+
when "operator_data"
|
910
|
+
get_operator_data( logical_name )
|
911
|
+
|
912
|
+
when "localisation"
|
913
|
+
language=nil
|
914
|
+
if ( MobyUtil::Parameter[ self.id ][:read_lang_from_app]=='true')
|
915
|
+
#read localeName app
|
916
|
+
language=self.application.attribute("localeName")
|
917
|
+
#determine the language from the locale
|
918
|
+
language=language.split('_')[0].to_s if (language!=nil && !language.empty?)
|
919
|
+
else
|
920
|
+
language=MobyUtil::Parameter[ self.id ][ :language ]
|
921
|
+
end
|
922
|
+
Kernel::raise LanguageNotFoundError.new("Language cannot be determind to perform translation") if (language==nil || language.empty?)
|
923
|
+
translation = MobyUtil::Localisation.translation( logical_name, language,
|
924
|
+
MobyUtil::Parameter[ self.id ][ :localisation_server_database_tablename ], file_name, plurality, lengthvariant )
|
925
|
+
if translation.kind_of? String and !numerus.nil?
|
926
|
+
if numerus.kind_of? Array
|
927
|
+
translation.gsub!(/%[L]?(\d)/){|s| numerus[($1.to_i) -1] }
|
928
|
+
elsif numerus.kind_of? String or numerus.kind_of? Integer
|
929
|
+
translation.gsub!(/%(Ln|1)/){|s| numerus.to_s}
|
930
|
+
end
|
931
|
+
elsif translation.kind_of? Array and !numerus.nil?
|
932
|
+
translation.each do |trans|
|
933
|
+
if numerus.kind_of? Array
|
934
|
+
trans.gsub!(/%[L]?(\d)/){|s| numerus[($1.to_i) -1] }
|
935
|
+
elsif numerus.kind_of? String or numerus.kind_of? Integer
|
936
|
+
trans.gsub!(/%(Ln|1)/){|s| numerus.to_s}
|
937
|
+
end
|
938
|
+
end
|
939
|
+
end
|
940
|
+
translation
|
941
|
+
end
|
942
|
+
end
|
943
|
+
|
944
|
+
# == description
|
945
|
+
# Wrapper function to retrieve user information for this SUT from the user information database.
|
946
|
+
#
|
947
|
+
# == arguments
|
948
|
+
# user_data_lname
|
949
|
+
# String
|
950
|
+
# description: Logical name (LNAME) of the user information item to be retrieved.
|
951
|
+
# example: "uif_first_name"
|
952
|
+
# Symbol
|
953
|
+
# description: Symbol form of the logical name (LNAME) of the user information item to be retrieved.
|
954
|
+
# example: :uif_first_name
|
955
|
+
#
|
956
|
+
# == returns
|
957
|
+
# String
|
958
|
+
# description: User data string
|
959
|
+
# example: "Ivan"
|
960
|
+
# Array
|
961
|
+
# description: Array of Strings when multiple user data strings found.
|
962
|
+
# example: ["Ivan", "Manolo"]
|
963
|
+
#
|
964
|
+
# == exceptions
|
965
|
+
# UserDataNotFoundError
|
966
|
+
# description: In case the desired user data is not found
|
967
|
+
#
|
968
|
+
# UserDataColumnNotFoundError
|
969
|
+
# description: In case the desired data column name to be used for the output is not found
|
970
|
+
#
|
971
|
+
# SqlError
|
972
|
+
# description: In case there are problems with the database connectivity
|
973
|
+
#
|
974
|
+
def get_user_information( user_data_lname )
|
975
|
+
language = MobyUtil::Parameter[ self.id ][ :language ]
|
976
|
+
table_name = MobyUtil::Parameter[ self.id ][ :user_data_server_database_tablename ]
|
977
|
+
MobyUtil::UserData.retrieve( user_data_lname, language, table_name )
|
978
|
+
end
|
979
|
+
|
980
|
+
# == description
|
981
|
+
# Wrapper function to retrieve operator data for this SUT from the operator data database.
|
982
|
+
#
|
983
|
+
# == arguments
|
984
|
+
# operator_data_lname
|
985
|
+
# String
|
986
|
+
# description: Logical name (LNAME) of the operator data item to be retrieved.
|
987
|
+
# example: "operator_welcome_message"
|
988
|
+
# Symbol
|
989
|
+
# description: Symbol form of the logical name (LNAME) of the operator data item to be retrieved.
|
990
|
+
# example: :operator_welcome_message
|
991
|
+
#
|
992
|
+
# == returns
|
993
|
+
# String
|
994
|
+
# description: User data string
|
995
|
+
# example: "Welcome to Orange"
|
996
|
+
#
|
997
|
+
# == exceptions
|
998
|
+
# OperatorDataNotFoundError
|
999
|
+
# description: In case the desired operator data is not found
|
1000
|
+
#
|
1001
|
+
# OperatorDataColumnNotFoundError
|
1002
|
+
# description: In case the desired data column name to be used for the output is not found
|
1003
|
+
#
|
1004
|
+
# SqlError
|
1005
|
+
# description: In case there are problems with the database connectivity
|
1006
|
+
#
|
1007
|
+
def get_operator_data( operator_data_lname )
|
1008
|
+
operator = MobyUtil::Parameter[ self.id ][ :operator_selected ]
|
1009
|
+
table_name = MobyUtil::Parameter[ self.id ][ :operator_data_server_database_tablename]
|
1010
|
+
MobyUtil::OperatorData.retrieve( operator_data_lname, operator, table_name )
|
1011
|
+
end
|
929
1012
|
|
930
1013
|
# == nodoc
|
931
1014
|
# Function to update all children of current SUT
|
@@ -940,13 +1023,12 @@ module MobyBehaviour
|
|
940
1023
|
|
941
1024
|
unless @childs_updated
|
942
1025
|
|
943
|
-
@
|
1026
|
+
@child_object_cache.each_object{ | test_object |
|
944
1027
|
|
945
1028
|
test_object.update( @xml_data )
|
946
1029
|
|
947
1030
|
}
|
948
1031
|
|
949
|
-
|
950
1032
|
end
|
951
1033
|
|
952
1034
|
@childs_updated = true
|
@@ -1001,26 +1083,25 @@ module MobyBehaviour
|
|
1001
1083
|
|
1002
1084
|
@verify_blocks << MobyUtil::VerifyBlock.new( block,expected, message, 0, MobyUtil::KernelHelper.find_source( caller( 3 ).first.to_s ) )
|
1003
1085
|
|
1086
|
+
nil
|
1087
|
+
|
1004
1088
|
end
|
1005
1089
|
|
1006
1090
|
# == description
|
1007
1091
|
# Clears all verification blocks added to the sut through verify_always() method and
|
1008
1092
|
# verify_blocks configuration parameter in the tdriver parameters file
|
1009
1093
|
#
|
1010
|
-
# == arguments
|
1011
|
-
#
|
1012
1094
|
# == returns
|
1013
1095
|
# Array
|
1014
|
-
# description:
|
1015
|
-
#
|
1016
|
-
# == exceptions
|
1017
|
-
#
|
1096
|
+
# description: Empty array
|
1097
|
+
# example: []
|
1018
1098
|
def clear_verify_blocks
|
1019
1099
|
|
1020
1100
|
@verify_blocks = []
|
1021
1101
|
|
1022
1102
|
end
|
1023
1103
|
|
1104
|
+
# == nodoc
|
1024
1105
|
def get_application_id
|
1025
1106
|
|
1026
1107
|
orig_frozen = @frozen;
|
@@ -1047,8 +1128,9 @@ module MobyBehaviour
|
|
1047
1128
|
|
1048
1129
|
end
|
1049
1130
|
|
1050
|
-
|
1131
|
+
private
|
1051
1132
|
|
1133
|
+
# TODO: document me
|
1052
1134
|
def fetch_references( xml )
|
1053
1135
|
|
1054
1136
|
pids = []
|
@@ -1064,7 +1146,7 @@ module MobyBehaviour
|
|
1064
1146
|
|
1065
1147
|
nodes.each { | element |
|
1066
1148
|
|
1067
|
-
pid = element.
|
1149
|
+
pid = element.at_xpath('//attribute[@name = "uri"]/value/text()').content #[ 0 ].to_s
|
1068
1150
|
|
1069
1151
|
if pid.nil? or pid.empty? or pid.to_i <= 0 # invalid reference
|
1070
1152
|
|
@@ -1078,7 +1160,7 @@ module MobyBehaviour
|
|
1078
1160
|
y_abs = xml.xpath( '//object[@type = "TDriverRef"]/../../attributes/attribute[@name ="y_absolute"]/value/text()' )[ idx - 1 ]
|
1079
1161
|
|
1080
1162
|
# window size
|
1081
|
-
winSize = xml.
|
1163
|
+
winSize = xml.at_xpath( "//objects/object[@type = 'MainWindow']/attributes/attribute[@name ='size']/value/text()" ).content #[ 0 ].to_s
|
1082
1164
|
|
1083
1165
|
# ref-ref parent does not know x coordinate, use the grandparent xys
|
1084
1166
|
x_prev = x_abs.to_s unless x_abs.nil?
|
@@ -1090,56 +1172,56 @@ module MobyBehaviour
|
|
1090
1172
|
|
1091
1173
|
begin
|
1092
1174
|
|
1093
|
-
|
1094
|
-
|
1095
|
-
|
1096
|
-
|
1097
|
-
|
1098
|
-
|
1099
|
-
|
1100
|
-
|
1101
|
-
|
1102
|
-
|
1103
|
-
|
1104
|
-
|
1105
|
-
|
1106
|
-
|
1107
|
-
|
1108
|
-
|
1109
|
-
|
1110
|
-
|
1111
|
-
|
1112
|
-
|
1113
|
-
|
1114
|
-
|
1115
|
-
|
1116
|
-
|
1117
|
-
|
1118
|
-
|
1119
|
-
|
1120
|
-
|
1121
|
-
|
1175
|
+
subdata =
|
1176
|
+
MobyUtil::XML.parse_string(
|
1177
|
+
execute_command(
|
1178
|
+
MobyCommand::Application.new(
|
1179
|
+
:State,
|
1180
|
+
nil,
|
1181
|
+
pid,
|
1182
|
+
self,
|
1183
|
+
nil,
|
1184
|
+
nil,
|
1185
|
+
nil,
|
1186
|
+
nil,
|
1187
|
+
{
|
1188
|
+
'x_parent_absolute' => x_prev,
|
1189
|
+
'y_parent_absolute' => y_prev,
|
1190
|
+
'embedded' => 'true',
|
1191
|
+
'parent_size' => winSize
|
1192
|
+
}
|
1193
|
+
)
|
1194
|
+
)[ 0 ]
|
1195
|
+
)
|
1196
|
+
|
1197
|
+
child = subdata.root.xpath('//object')[0]
|
1198
|
+
|
1199
|
+
# Remove the attribute with the pid retrieval was not successful.
|
1200
|
+
# (server returns the previous hit if not found)
|
1201
|
+
if child.attribute('id' ) != pid
|
1202
|
+
|
1203
|
+
element.remove
|
1122
1204
|
|
1123
|
-
|
1205
|
+
else
|
1124
1206
|
|
1125
|
-
|
1126
|
-
|
1207
|
+
# Remove the application layer
|
1208
|
+
objs = child.xpath( '/tasMessage/tasInfo/object/objects/*' )
|
1127
1209
|
|
1128
|
-
|
1210
|
+
if !objs.nil?
|
1129
1211
|
|
1130
|
-
|
1212
|
+
objs.each { | el | element.add_previous_sibling( el ) }
|
1131
1213
|
|
1132
|
-
|
1214
|
+
element.remove
|
1133
1215
|
|
1134
|
-
|
1216
|
+
end
|
1135
1217
|
|
1136
|
-
|
1218
|
+
end
|
1137
1219
|
|
1138
1220
|
rescue RuntimeError => e
|
1139
1221
|
|
1140
|
-
|
1222
|
+
raise e unless e.message.include? "no longer available"
|
1141
1223
|
|
1142
|
-
|
1224
|
+
return xml
|
1143
1225
|
|
1144
1226
|
end
|
1145
1227
|
|
@@ -1193,11 +1275,10 @@ module MobyBehaviour
|
|
1193
1275
|
|
1194
1276
|
@frozen = false
|
1195
1277
|
|
1196
|
-
@
|
1278
|
+
@child_object_cache = TDriver::TestObjectCache.new
|
1197
1279
|
|
1198
1280
|
@current_application_id = nil
|
1199
1281
|
|
1200
|
-
|
1201
1282
|
@dump_count = 0
|
1202
1283
|
|
1203
1284
|
# default values
|
@@ -1218,9 +1299,9 @@ module MobyBehaviour
|
|
1218
1299
|
@refresh_interval = MobyUtil::Parameter[ @id ][ :refresh_interval, @refresh_interval ].to_f
|
1219
1300
|
|
1220
1301
|
end
|
1221
|
-
|
1302
|
+
|
1222
1303
|
@last_xml_data = nil
|
1223
|
-
|
1304
|
+
|
1224
1305
|
ruby_file = MobyUtil::Parameter[ @id ][ :verify_blocks ]
|
1225
1306
|
|
1226
1307
|
@verify_blocks = []
|
@@ -1240,7 +1321,7 @@ module MobyBehaviour
|
|
1240
1321
|
|
1241
1322
|
end
|
1242
1323
|
|
1243
|
-
|
1324
|
+
public # deprecated
|
1244
1325
|
|
1245
1326
|
|
1246
1327
|
# == nodoc
|
@@ -1253,7 +1334,7 @@ module MobyBehaviour
|
|
1253
1334
|
# == raises
|
1254
1335
|
# someException:: If Dump does not conform to the tasMessage schema error is raised
|
1255
1336
|
def get_ui_dump( refresh_args = {} )
|
1256
|
-
|
1337
|
+
|
1257
1338
|
#$stderr.puts "warning: SUT#get_ui_dump is deprecated, please use SUT#refresh_ui_dump instead."
|
1258
1339
|
|
1259
1340
|
refresh_ui_dump refresh_args, {}
|