testability-driver 0.9.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README +1 -0
- data/bin/start_app_perf +199 -0
- data/bin/tdriver-devtools +3 -0
- data/config/sut_parameters.rb +39 -0
- data/ext/extconf.rb +67 -0
- data/ext/native_extensions.c +70 -0
- data/lib/matti.rb +30 -0
- data/lib/tdriver-devtools/behaviour/old/xml/example/flick-example.rb +223 -0
- data/lib/tdriver-devtools/behaviour/old/xml/example/impl.rb_invalid +194 -0
- data/lib/tdriver-devtools/behaviour/old/xml/generate_behaviour_xml.rb +95 -0
- data/lib/tdriver-devtools/behaviour/old/xml/lib/tdriver_generator.rb +722 -0
- data/lib/tdriver-devtools/behaviour/old/xml/qdoc_generator.rb +321 -0
- data/lib/tdriver-devtools/behaviour/old/xml/templates/behaviour.method.template +43 -0
- data/lib/tdriver-devtools/behaviour/old/xml/templates/behaviour.module.template +54 -0
- data/lib/tdriver-devtools/behaviour/old/xml/templates/behaviour.xml.argument.template +7 -0
- data/lib/tdriver-devtools/behaviour/old/xml/templates/behaviour.xml.argument_type.template +7 -0
- data/lib/tdriver-devtools/behaviour/old/xml/templates/behaviour.xml.exception.template +5 -0
- data/lib/tdriver-devtools/behaviour/old/xml/templates/behaviour.xml.howto.line.template +2 -0
- data/lib/tdriver-devtools/behaviour/old/xml/templates/behaviour.xml.howto.template +5 -0
- data/lib/tdriver-devtools/behaviour/old/xml/templates/behaviour.xml.method.template +23 -0
- data/lib/tdriver-devtools/behaviour/old/xml/templates/behaviour.xml.template +14 -0
- data/lib/tdriver-devtools/behaviour/old/xml/update +3 -0
- data/lib/tdriver-devtools/behaviour/xml/generate.rb +88 -0
- data/lib/tdriver-devtools/behaviour/xml/rdoc_behaviour_xml_generator.rb +1924 -0
- data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.argument.default.template +1 -0
- data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.argument.template +3 -0
- data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.argument_type.template +4 -0
- data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.exception.template +4 -0
- data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.method.arguments.template +4 -0
- data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.method.deprecated.template +3 -0
- data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.method.exceptions.template +3 -0
- data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.method.info.template +1 -0
- data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.method.returns.template +3 -0
- data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.method.tables.template +3 -0
- data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.method.template +12 -0
- data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.returns.template +5 -0
- data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.table.item.template +1 -0
- data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.table.row.template +2 -0
- data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.table.template +8 -0
- data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.template +14 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/example/flick-example.rb +245 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/example/sut.rb +964 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/generate.rb +68 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/lib/custom_rdoc_generator.rb +1865 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.argument.default.template +1 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.argument.template +3 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.argument_type.template +4 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.exception.template +4 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.method.arguments.template +4 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.method.deprecated.template +3 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.method.exceptions.template +3 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.method.info.template +1 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.method.returns.template +3 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.method.tables.template +3 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.method.template +12 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.returns.template +5 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.table.item.template +1 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.table.row.template +2 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.table.template +7 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.template +14 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/update +3 -0
- data/lib/tdriver-devtools/doc/behaviour_xml/QtExampleGestureBehaviour.xml +138 -0
- data/lib/tdriver-devtools/doc/behaviour_xml/created.rid +1 -0
- data/lib/tdriver-devtools/doc/behaviour_xml/tdriver.hash +1 -0
- data/lib/tdriver-devtools/doc/feature_xml/qt_widget_hold.feature.xml +9 -0
- data/lib/tdriver-devtools/doc/feature_xml/qt_widget_tap.feature.xml +9 -0
- data/lib/tdriver-devtools/doc/generate.rb +892 -0
- data/lib/tdriver-devtools/doc/update +1 -0
- data/lib/tdriver-devtools/doc/xslt/html.rb +7 -0
- data/lib/tdriver-devtools/doc/xslt/template.xsl +1861 -0
- data/lib/tdriver-devtools/doc/xslt/update +3 -0
- data/lib/tdriver-devtools/plugin/placeholder.txt +1 -0
- data/lib/tdriver-devtools/tdriver-devtools.rb +404 -0
- data/lib/tdriver-devtools/tests/feature_tests/example/flick-example.rb +233 -0
- data/lib/tdriver-devtools/tests/feature_tests/example/impl.rb +194 -0
- data/lib/tdriver-devtools/tests/feature_tests/generate.rb +82 -0
- data/lib/tdriver-devtools/tests/feature_tests/lib/custom_rdoc_generator.rb +468 -0
- data/lib/tdriver-devtools/tests/feature_tests/templates/feature_attribute.template +5 -0
- data/lib/tdriver-devtools/tests/feature_tests/templates/feature_method.template +5 -0
- data/lib/tdriver-devtools/tests/feature_tests/templates/scenario_attribute.template +5 -0
- data/lib/tdriver-devtools/tests/feature_tests/templates/scenario_method.template +5 -0
- data/lib/tdriver-devtools/tests/feature_tests/update +3 -0
- data/lib/tdriver.rb +26 -0
- data/lib/tdriver/base/behaviour/behaviour.rb +32 -0
- data/lib/tdriver/base/behaviour/behaviours/object_behaviour_composition.rb +94 -0
- data/lib/tdriver/base/behaviour/behaviours/object_behaviour_description.rb +262 -0
- data/lib/tdriver/base/behaviour/behaviours/object_composition.rb +111 -0
- data/lib/tdriver/base/behaviour/factory.rb +380 -0
- data/lib/tdriver/base/behaviour/loader.rb +28 -0
- data/lib/tdriver/base/command_data/command_data.rb +51 -0
- data/lib/tdriver/base/command_data/loader.rb +25 -0
- data/lib/tdriver/base/errors.rb +131 -0
- data/lib/tdriver/base/loader.rb +38 -0
- data/lib/tdriver/base/state_object.rb +270 -0
- data/lib/tdriver/base/sut/adapter.rb +28 -0
- data/lib/tdriver/base/sut/controller.rb +119 -0
- data/lib/tdriver/base/sut/factory.rb +287 -0
- data/lib/tdriver/base/sut/generic/behaviours/application.rb +243 -0
- data/lib/tdriver/base/sut/generic/behaviours/controller.rb +67 -0
- data/lib/tdriver/base/sut/generic/behaviours/find.rb +96 -0
- data/lib/tdriver/base/sut/generic/behaviours/flash_behaviour.rb +346 -0
- data/lib/tdriver/base/sut/generic/behaviours/sut.rb +1268 -0
- data/lib/tdriver/base/sut/generic/behaviours/switchbox_behaviour.rb +182 -0
- data/lib/tdriver/base/sut/generic/behaviours/verification.rb +119 -0
- data/lib/tdriver/base/sut/generic/commands/application.rb +219 -0
- data/lib/tdriver/base/sut/generic/commands/key_sequence.rb +82 -0
- data/lib/tdriver/base/sut/generic/commands/screen_capture.rb +58 -0
- data/lib/tdriver/base/sut/generic/plugin.rb +96 -0
- data/lib/tdriver/base/sut/loader.rb +35 -0
- data/lib/tdriver/base/sut/sut.rb +67 -0
- data/lib/tdriver/base/test_object/abstract.rb +179 -0
- data/lib/tdriver/base/test_object/behaviours/syncronization.rb +94 -0
- data/lib/tdriver/base/test_object/behaviours/test_object.rb +787 -0
- data/lib/tdriver/base/test_object/factory.rb +618 -0
- data/lib/tdriver/base/test_object/identificator.rb +511 -0
- data/lib/tdriver/base/test_object/loader.rb +37 -0
- data/lib/tdriver/env.rb +21 -0
- data/lib/tdriver/loader.rb +36 -0
- data/lib/tdriver/matti.rb +35 -0
- data/lib/tdriver/report/error_recovery/tdriver_custom_error_recovery.rb +83 -0
- data/lib/tdriver/report/error_recovery/tdriver_error_recovery.rb +158 -0
- data/lib/tdriver/report/error_recovery/tdriver_error_recovery_settings.rb +98 -0
- data/lib/tdriver/report/report.rb +47 -0
- data/lib/tdriver/report/report_api.rb +207 -0
- data/lib/tdriver/report/report_combine.rb +86 -0
- data/lib/tdriver/report/report_crash_file_capture.rb +167 -0
- data/lib/tdriver/report/report_creator.rb +571 -0
- data/lib/tdriver/report/report_cucumber.rb +158 -0
- data/lib/tdriver/report/report_cucumber_listener.rb +337 -0
- data/lib/tdriver/report/report_cucumber_reporter.rb +335 -0
- data/lib/tdriver/report/report_data_presentation.rb +152 -0
- data/lib/tdriver/report/report_data_table.rb +64 -0
- data/lib/tdriver/report/report_execution_statistics.rb +284 -0
- data/lib/tdriver/report/report_file_capture.rb +159 -0
- data/lib/tdriver/report/report_grouping.rb +539 -0
- data/lib/tdriver/report/report_junit_xml.rb +147 -0
- data/lib/tdriver/report/report_rspec.rb +108 -0
- data/lib/tdriver/report/report_test_case_run.rb +621 -0
- data/lib/tdriver/report/report_test_run.rb +1286 -0
- data/lib/tdriver/report/report_test_unit.rb +175 -0
- data/lib/tdriver/report/report_writer.rb +1405 -0
- data/lib/tdriver/tdriver.rb +158 -0
- data/lib/tdriver/util/common.rb +24 -0
- data/lib/tdriver/util/common/array.rb +39 -0
- data/lib/tdriver/util/common/crc16.rb +100 -0
- data/lib/tdriver/util/common/environment.rb +153 -0
- data/lib/tdriver/util/common/error.rb +39 -0
- data/lib/tdriver/util/common/file.rb +315 -0
- data/lib/tdriver/util/common/gem.rb +108 -0
- data/lib/tdriver/util/common/kernel.rb +189 -0
- data/lib/tdriver/util/common/loader.rb +39 -0
- data/lib/tdriver/util/common/retryable.rb +98 -0
- data/lib/tdriver/util/common/string.rb +77 -0
- data/lib/tdriver/util/dbaccess/dbaccess.rb +188 -0
- data/lib/tdriver/util/dbaccess/dbconnection.rb +41 -0
- data/lib/tdriver/util/dbaccess/error.rb +35 -0
- data/lib/tdriver/util/dbaccess/loader.rb +29 -0
- data/lib/tdriver/util/dynamic_attribute_filter.rb +182 -0
- data/lib/tdriver/util/hooking.rb +434 -0
- data/lib/tdriver/util/loader.rb +65 -0
- data/lib/tdriver/util/localisation.rb +24 -0
- data/lib/tdriver/util/localisation/error.rb +32 -0
- data/lib/tdriver/util/localisation/loader.rb +28 -0
- data/lib/tdriver/util/localisation/localisation.rb +479 -0
- data/lib/tdriver/util/logger.rb +377 -0
- data/lib/tdriver/util/operator_data/error.rb +29 -0
- data/lib/tdriver/util/operator_data/loader.rb +26 -0
- data/lib/tdriver/util/operator_data/operator_data.rb +93 -0
- data/lib/tdriver/util/other/config.rb +221 -0
- data/lib/tdriver/util/parameter.rb +24 -0
- data/lib/tdriver/util/parameter/error.rb +45 -0
- data/lib/tdriver/util/parameter/loader.rb +37 -0
- data/lib/tdriver/util/parameter/parameter.rb +285 -0
- data/lib/tdriver/util/parameter/parameter_hash.rb +101 -0
- data/lib/tdriver/util/parameter/parameter_template.rb +120 -0
- data/lib/tdriver/util/parameter/parameter_user_api.rb +84 -0
- data/lib/tdriver/util/parameter/parameter_xml.rb +247 -0
- data/lib/tdriver/util/plugin/abstract.rb +60 -0
- data/lib/tdriver/util/plugin/error.rb +25 -0
- data/lib/tdriver/util/plugin/loader.rb +28 -0
- data/lib/tdriver/util/plugin/service.rb +200 -0
- data/lib/tdriver/util/recorder.rb +292 -0
- data/lib/tdriver/util/stats.rb +90 -0
- data/lib/tdriver/util/user_data/error.rb +29 -0
- data/lib/tdriver/util/user_data/loader.rb +26 -0
- data/lib/tdriver/util/user_data/user_data.rb +103 -0
- data/lib/tdriver/util/video_rec.rb +264 -0
- data/lib/tdriver/util/xml/abstraction.rb +47 -0
- data/lib/tdriver/util/xml/builder.rb +54 -0
- data/lib/tdriver/util/xml/document.rb +32 -0
- data/lib/tdriver/util/xml/element.rb +32 -0
- data/lib/tdriver/util/xml/error.rb +46 -0
- data/lib/tdriver/util/xml/loader.rb +46 -0
- data/lib/tdriver/util/xml/nil_element.rb +89 -0
- data/lib/tdriver/util/xml/nodeset.rb +32 -0
- data/lib/tdriver/util/xml/parsers/libxml/libxml.rb +140 -0
- data/lib/tdriver/util/xml/parsers/loader.rb +22 -0
- data/lib/tdriver/util/xml/parsers/nokogiri/abstraction.rb +111 -0
- data/lib/tdriver/util/xml/parsers/nokogiri/attribute.rb +54 -0
- data/lib/tdriver/util/xml/parsers/nokogiri/builder.rb +58 -0
- data/lib/tdriver/util/xml/parsers/nokogiri/document.rb +58 -0
- data/lib/tdriver/util/xml/parsers/nokogiri/element.rb +147 -0
- data/lib/tdriver/util/xml/parsers/nokogiri/loader.rb +42 -0
- data/lib/tdriver/util/xml/parsers/nokogiri/nodeset.rb +187 -0
- data/lib/tdriver/util/xml/xml.rb +170 -0
- data/lib/tdriver/verify/verify.rb +687 -0
- data/lib/tdriver/verify/verify.rb_org +630 -0
- data/lib/tdriver/version.rb +21 -0
- data/xml/behaviours/generic.xml +495 -0
- data/xml/defaults/generic.xml +97 -0
- data/xml/defaults/sut_generic.xml +36 -0
- data/xml/parameters/tdriver_parameters.xml +23 -0
- data/xml/templates/generic.xml +227 -0
- metadata +327 -0
@@ -0,0 +1,1268 @@
|
|
1
|
+
############################################################################
|
2
|
+
##
|
3
|
+
## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
4
|
+
## All rights reserved.
|
5
|
+
## Contact: Nokia Corporation (testabilitydriver@nokia.com)
|
6
|
+
##
|
7
|
+
## This file is part of Testability Driver.
|
8
|
+
##
|
9
|
+
## If you have questions regarding the use of this file, please contact
|
10
|
+
## Nokia at testabilitydriver@nokia.com .
|
11
|
+
##
|
12
|
+
## This library is free software; you can redistribute it and/or
|
13
|
+
## modify it under the terms of the GNU Lesser General Public
|
14
|
+
## License version 2.1 as published by the Free Software Foundation
|
15
|
+
## and appearing in the file LICENSE.LGPL included in the packaging
|
16
|
+
## of this file.
|
17
|
+
##
|
18
|
+
############################################################################
|
19
|
+
|
20
|
+
module MobyBehaviour
|
21
|
+
|
22
|
+
# == description
|
23
|
+
# Describes the behaviour of SUT, aka the methods that can be used to control SUT
|
24
|
+
#
|
25
|
+
# == behaviour
|
26
|
+
# GenericSut
|
27
|
+
#
|
28
|
+
# == requires
|
29
|
+
# *
|
30
|
+
#
|
31
|
+
# == input_type
|
32
|
+
# *
|
33
|
+
#
|
34
|
+
# == sut_type
|
35
|
+
# *
|
36
|
+
#
|
37
|
+
# == sut_version
|
38
|
+
# *
|
39
|
+
#
|
40
|
+
# == objects
|
41
|
+
# *
|
42
|
+
#
|
43
|
+
module SUT
|
44
|
+
|
45
|
+
include MobyBehaviour::Behaviour
|
46
|
+
|
47
|
+
# == nodoc
|
48
|
+
attr_accessor(
|
49
|
+
|
50
|
+
:dump_count, # number of UI dump requests done to current SUT
|
51
|
+
:current_application_id, # id of the current appication if set
|
52
|
+
:input, # the input method used for interacting with this sut as a symbol, eg. :key or :touch.
|
53
|
+
:refresh_tries, # number of retries for ui dump on error case
|
54
|
+
:refresh_timeout # timeout between timeout retry
|
55
|
+
|
56
|
+
)
|
57
|
+
|
58
|
+
# == nodoc
|
59
|
+
attr_reader(
|
60
|
+
|
61
|
+
:xml_data, # sut xml_data
|
62
|
+
:x_path, # x_path pattern for xml_data
|
63
|
+
:ui_type, # type of the UI used on the sut, ie. s60, qt, windows
|
64
|
+
:ui_version, # version of the ui used on the sut, ie 3.2.3
|
65
|
+
:frozen, # flag that tells if the ui dump getting is disabled
|
66
|
+
:xml_data_crc, # crc of the previous ui state message
|
67
|
+
:verify_blocks # verify blocks
|
68
|
+
|
69
|
+
)
|
70
|
+
|
71
|
+
|
72
|
+
# == description
|
73
|
+
# Connects selected SUT according to configuration in tdriver_parameters.xml.
|
74
|
+
#
|
75
|
+
def connect( id )
|
76
|
+
|
77
|
+
@_sutController.connect( id )
|
78
|
+
|
79
|
+
end
|
80
|
+
|
81
|
+
# Retrieves the total amount of data sent in bytes
|
82
|
+
# == examples
|
83
|
+
# @sut.disconnect
|
84
|
+
def disconnect
|
85
|
+
|
86
|
+
@_sutController.disconnect
|
87
|
+
|
88
|
+
end
|
89
|
+
|
90
|
+
# Retrieves the total amount of data received in bytes
|
91
|
+
# == examples
|
92
|
+
# @sut.disconnect
|
93
|
+
def received_data
|
94
|
+
|
95
|
+
@_sutController.received_bytes
|
96
|
+
|
97
|
+
end
|
98
|
+
|
99
|
+
# Retrieves the total amount of data sent in bytes
|
100
|
+
# == examples
|
101
|
+
# @sut.sent_data
|
102
|
+
def sent_data
|
103
|
+
|
104
|
+
@_sutController.sent_bytes
|
105
|
+
|
106
|
+
end
|
107
|
+
|
108
|
+
# function to disable taking ui dumps from target for a moment
|
109
|
+
# user must remember to enable ui dumps again using unfreeze
|
110
|
+
def freeze
|
111
|
+
|
112
|
+
@frozen = true
|
113
|
+
|
114
|
+
end
|
115
|
+
|
116
|
+
# function to enable taking ui dumps from target
|
117
|
+
def unfreeze
|
118
|
+
|
119
|
+
@frozen = false
|
120
|
+
|
121
|
+
end
|
122
|
+
|
123
|
+
# == nodoc
|
124
|
+
# function to get TestObject
|
125
|
+
# TODO: Still under construction. Should be able to create single descendant of the SUT
|
126
|
+
# Then is Should create path (parent-child-child-child...) until reaching the particular TestObject
|
127
|
+
# TODO: Document me when I'm ready
|
128
|
+
def get_object( object_id )
|
129
|
+
|
130
|
+
test_object = @test_object_factory.make( self, MobyBase::TestObjectIdentificator.new( object_id ) )
|
131
|
+
|
132
|
+
end
|
133
|
+
|
134
|
+
# Force to use user defined ui state (e.g. for debugging purposes)
|
135
|
+
#
|
136
|
+
# Freezes the SUT xml_data, until unfreezed or set to nil.
|
137
|
+
# == params
|
138
|
+
# xml:: String, MobyUtil::XML::Element or NilClass
|
139
|
+
# == examples
|
140
|
+
# @sut.xml_data = "<tasMessage>.....</tasMessage>"
|
141
|
+
# @sut.xml_data = xml_element
|
142
|
+
# @sut.xml_data = nil
|
143
|
+
# == raises
|
144
|
+
# ArgumentError:: Unexpected argument type (%s) for xml, expected: %s
|
145
|
+
def xml_data=( xml )
|
146
|
+
|
147
|
+
if xml.kind_of?( MobyUtil::XML::Element )
|
148
|
+
|
149
|
+
@xml_data = xml
|
150
|
+
|
151
|
+
elsif xml.kind_of?( String )
|
152
|
+
|
153
|
+
@xml_data = MobyUtil::XML.parse_string( xml ).root
|
154
|
+
|
155
|
+
elsif xml.nil?
|
156
|
+
|
157
|
+
@xml_data = nil
|
158
|
+
|
159
|
+
@frozen = false
|
160
|
+
|
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
|
+
end
|
166
|
+
|
167
|
+
# freeze sut - xml won't be updated unless unfreezed first
|
168
|
+
@frozen = true unless xml.nil?
|
169
|
+
|
170
|
+
end
|
171
|
+
|
172
|
+
# == nodoc
|
173
|
+
# Function asks for fresh xml ui data from the device and stores the result
|
174
|
+
# == returns
|
175
|
+
# MobyUtil::XML::Element:: xml document containing valid xml fragment describing the current state of the device
|
176
|
+
def refresh_ui_dump( refresh_args = {}, creation_attributes = [] )
|
177
|
+
|
178
|
+
current_time = Time.now
|
179
|
+
|
180
|
+
if !@frozen && ( @_previous_refresh.nil? || ( current_time - @_previous_refresh ).to_f > @refresh_interval )
|
181
|
+
|
182
|
+
MobyUtil::Retryable.while(
|
183
|
+
:tries => @refresh_tries,
|
184
|
+
:interval => @refresh_interval,
|
185
|
+
:unless => [ MobyBase::ControllerNotFoundError, MobyBase::CommandNotFoundError ] ) {
|
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
|
222
|
+
|
223
|
+
}
|
224
|
+
|
225
|
+
|
226
|
+
|
227
|
+
|
228
|
+
end
|
229
|
+
|
230
|
+
@xml_data = fetch_references( @xml_data )
|
231
|
+
|
232
|
+
@xml_data
|
233
|
+
|
234
|
+
end
|
235
|
+
|
236
|
+
# Creates a test object that belongs to this SUT.
|
237
|
+
# Usually it is 'Application' TestObject
|
238
|
+
# Associates child object as current object's child.
|
239
|
+
# and associates self as child object's parent.
|
240
|
+
#
|
241
|
+
# NOTE:
|
242
|
+
# Subsequent calls to SUT#child(rule) always returns reference to same Testobject:
|
243
|
+
# a = sut.child(rule) ; b = sut.child(rule) ; a.equal?( b ); # => true
|
244
|
+
# note the usage of equal? above instead of normally used eql?. Please refer to Ruby manual for more information.
|
245
|
+
#
|
246
|
+
# == params
|
247
|
+
# hash_rule:: Hash object holding information for identifying which child to create, eg. :type => :application
|
248
|
+
# == returns
|
249
|
+
# TestObject:: new child test object or reference to existing child
|
250
|
+
def child( hash_rule )
|
251
|
+
|
252
|
+
creation_hash = hash_rule.clone
|
253
|
+
|
254
|
+
initial_timeout = @test_object_factory.timeout unless ( custom_timeout = creation_hash.delete( :__timeout ) ).nil?
|
255
|
+
|
256
|
+
logging_enabled = MobyUtil::Logger.instance.enabled
|
257
|
+
MobyUtil::Logger.instance.enabled = false if ( creation_hash.delete( :__logging ) == 'false' )
|
258
|
+
|
259
|
+
begin
|
260
|
+
|
261
|
+
@test_object_factory.timeout = custom_timeout unless custom_timeout.nil?
|
262
|
+
child_test_object = @test_object_factory.make( self, MobyBase::TestObjectIdentificator.new( creation_hash ) )
|
263
|
+
|
264
|
+
rescue MobyBase::MultipleTestObjectsIdentifiedError => exception
|
265
|
+
|
266
|
+
MobyUtil::Logger.instance.log "behaviour", "FAIL;Multiple child objects matched criteria.;#{ id };sut;{};child;#{ hash_rule.inspect }"
|
267
|
+
Kernel::raise exception
|
268
|
+
|
269
|
+
rescue MobyBase::TestObjectNotFoundError => exception
|
270
|
+
|
271
|
+
MobyUtil::Logger.instance.log "behaviour", "FAIL;The child object could not be found.;#{ id };sut;{};child;#{ hash_rule.inspect }"
|
272
|
+
Kernel::raise exception
|
273
|
+
|
274
|
+
rescue Exception => exception
|
275
|
+
|
276
|
+
MobyUtil::Logger.instance.log "behaviour", "FAIL;Failed when trying to find child object.;#{ id };sut;{};child;#{ hash_rule.inspect }"
|
277
|
+
Kernel::raise exception
|
278
|
+
|
279
|
+
ensure
|
280
|
+
|
281
|
+
@test_object_factory.timeout = initial_timeout unless custom_timeout.nil?
|
282
|
+
MobyUtil::Logger.instance.enabled = logging_enabled
|
283
|
+
|
284
|
+
end
|
285
|
+
|
286
|
+
# return already existing child TestObject so that there is references to only one TestObject
|
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
|
+
|
325
|
+
child_test_object
|
326
|
+
|
327
|
+
end
|
328
|
+
|
329
|
+
# == description
|
330
|
+
# Returns a StateObject containing the current state of this test object as XML.
|
331
|
+
# The state object is static and thus is not refreshed or synchronized etc.
|
332
|
+
# == returns
|
333
|
+
# StateObject:: State of this test object
|
334
|
+
# == exceptions
|
335
|
+
# RuntimeError
|
336
|
+
# description: If the xml source for the object is not in initialized
|
337
|
+
# == example
|
338
|
+
# sut_state = @sut.state #get the state object for the sut
|
339
|
+
def state
|
340
|
+
|
341
|
+
# refresh if xml data is empty
|
342
|
+
self.refresh({},{}) if @xml_data.empty?
|
343
|
+
|
344
|
+
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
|
+
|
346
|
+
MobyBase::StateObject.new(
|
347
|
+
|
348
|
+
MobyUtil::XML.parse_string(
|
349
|
+
|
350
|
+
"<sut name='sut' type='sut' id='%s'><objects>%s</objects></sut>" % [ @id, xml_data.xpath("tasInfo/object").collect{ | element | element.to_s }.join ]
|
351
|
+
|
352
|
+
).root,
|
353
|
+
self
|
354
|
+
|
355
|
+
)
|
356
|
+
|
357
|
+
end
|
358
|
+
|
359
|
+
# == description
|
360
|
+
# Returns the current foreground application or one which matches with given attributes rules.
|
361
|
+
#
|
362
|
+
# == arguments
|
363
|
+
# attributes
|
364
|
+
# Hash
|
365
|
+
# description: Hash defining required expected attributes of the application
|
366
|
+
# example: { :name => 'testapp' }
|
367
|
+
#
|
368
|
+
# == returns
|
369
|
+
# MobyBase::TestObject
|
370
|
+
# description: Current foreground application or one that meets hash rules
|
371
|
+
# example: -
|
372
|
+
#
|
373
|
+
# == exceptions
|
374
|
+
# ArgumentError
|
375
|
+
# description: The attributes argument was not a Hash
|
376
|
+
def application( attributes = {} )
|
377
|
+
|
378
|
+
begin
|
379
|
+
|
380
|
+
raise TypeError.new( "Input parameter not of Type: Hash.\nIt is: #{ attributes.class }" ) unless attributes.kind_of?( Hash )
|
381
|
+
get_default_app = attributes.empty?
|
382
|
+
attributes[ :type ] = 'application'
|
383
|
+
current_application_id = nil if attributes[ :id ].nil?
|
384
|
+
|
385
|
+
|
386
|
+
app_child = child( attributes )
|
387
|
+
|
388
|
+
rescue Exception => e
|
389
|
+
|
390
|
+
MobyUtil::Logger.instance.log "behaviour" , "FAIL;Failed to find application.;#{id.to_s};sut;{};application;" << (attributes.kind_of?(Hash) ? attributes.inspect : attributes.class.to_s)
|
391
|
+
Kernel::raise e
|
392
|
+
|
393
|
+
end
|
394
|
+
|
395
|
+
MobyUtil::Logger.instance.log "behaviour" , "PASS;Application found.;#{id.to_s};sut;{};application;" << attributes.inspect
|
396
|
+
|
397
|
+
app_child
|
398
|
+
|
399
|
+
end
|
400
|
+
|
401
|
+
# == description
|
402
|
+
# Screen capture function to take snapshot of SUTs current display view
|
403
|
+
#
|
404
|
+
# == arguments
|
405
|
+
# arguments
|
406
|
+
# Hash
|
407
|
+
# description:
|
408
|
+
# Options to be used for screen capture. See [link="#capture_options_table"]Options table[/link] for valid keys
|
409
|
+
# example: ( :Filename => "c:/screen_shot.png" )
|
410
|
+
#
|
411
|
+
# == tables
|
412
|
+
# capture_options_table
|
413
|
+
# title: Options table
|
414
|
+
# |Key|Type|Description|Example|Required|
|
415
|
+
# |:Filename|String|Filename where file is stored: either absolute path or if no path given uses working directory|:Filename => "c:/screen_shot.png"|Yes|
|
416
|
+
#
|
417
|
+
# == returns
|
418
|
+
# NilClass
|
419
|
+
# description: -
|
420
|
+
# example: -
|
421
|
+
#
|
422
|
+
# == exceptions
|
423
|
+
# ArgumentError
|
424
|
+
# description: Wrong argument type %s (Expected Hash)
|
425
|
+
#
|
426
|
+
# ArgumentError
|
427
|
+
# description: Symbol %s expected in argument(s)
|
428
|
+
#
|
429
|
+
# ArgumentError
|
430
|
+
# description: Invalid string length for output filename: '%s'
|
431
|
+
#
|
432
|
+
def capture_screen( arguments )
|
433
|
+
|
434
|
+
begin
|
435
|
+
|
436
|
+
MobyBase::Error.raise( :WrongArgumentType, arguments.class, "Hash" ) unless arguments.kind_of?( Hash )
|
437
|
+
MobyBase::Error.raise( :ArgumentSymbolExpected, ":Filename" ) unless arguments.include?( :Filename )
|
438
|
+
MobyBase::Error.raise( :WrongArgumentTypeFor, arguments[ :Filename ].class, "output filename", "String" ) unless arguments[:Filename].kind_of?( String )
|
439
|
+
MobyBase::Error.raise( :InvalidStringLengthFor, arguments[ :Filename ].length, "output filename", ">=1" ) unless arguments[:Filename].length > 0
|
440
|
+
|
441
|
+
screen_capture_command_object = MobyCommand::ScreenCapture.new()
|
442
|
+
screen_capture_command_object.redraw = arguments[ :Redraw ] if arguments[ :Redraw ]
|
443
|
+
image_binary = execute_command( screen_capture_command_object )
|
444
|
+
|
445
|
+
File.open( arguments[ :Filename ], 'wb:binary'){ | image_file | image_file << image_binary }
|
446
|
+
|
447
|
+
rescue Exception => e
|
448
|
+
|
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 )
|
450
|
+
Kernel::raise e
|
451
|
+
|
452
|
+
end
|
453
|
+
|
454
|
+
MobyUtil::Logger.instance.log "behaviour" , "PASS;Screen was captured successfully.;#{id.to_s};sut;{};capture_screen;" << arguments.inspect
|
455
|
+
|
456
|
+
nil
|
457
|
+
|
458
|
+
end
|
459
|
+
|
460
|
+
# Instructs the SUT to start the specified application if it is not currenly being executed
|
461
|
+
# The application will also be brought to the foregound.
|
462
|
+
# === params
|
463
|
+
# target:: Hash, used to indetify the application to be executed. All symbols defined in the hash
|
464
|
+
# must match with the launched application.
|
465
|
+
# The following symbols can be defined in the hash, at least one them must be included:
|
466
|
+
# [:uid] = String or Integer, uid of the application (268458181)
|
467
|
+
# [:name] = String, executable name of the application ('Mce.exe')
|
468
|
+
# [:arguments] = Comma separated list of arguments passed to application when starting. ('--nogui,-v')
|
469
|
+
# Examples:
|
470
|
+
# @sut.run(:name => 'Mce.exe')
|
471
|
+
# @sut.run(:name => 'Mce.exe', :uid => 268458181)
|
472
|
+
# @sut.run(:name => 'demoapp.exe', :arguments => '--nogui')
|
473
|
+
# === returns
|
474
|
+
# TestObject:: Test object of the started application
|
475
|
+
# === raises
|
476
|
+
# ArgumentError:: If no Hash is provided as argument or the Hash does not contain at least a valid :uid or :name
|
477
|
+
# VerificationError:: If no application test object can be found after starting the application, or the found object does not match the launched application
|
478
|
+
def run( target )
|
479
|
+
|
480
|
+
begin
|
481
|
+
# set the refresh interval to zero while the application is launched
|
482
|
+
#orig_interval = MobyUtil::Parameter[ @id ][ :refresh_interval ]
|
483
|
+
#MobyUtil::Parameter[ @id ][ :refresh_interval ] = '0'
|
484
|
+
|
485
|
+
# raise exception if argument type other than hash
|
486
|
+
Kernel::raise ArgumentError.new( "Wrong argument type %s) for %s (Expected: %s)" % [ target.class, "run method", "Hash" ]) unless target.instance_of?( Hash )
|
487
|
+
|
488
|
+
# default value for keys that does not exist in hash
|
489
|
+
target.default = nil
|
490
|
+
|
491
|
+
Kernel::raise ArgumentError.new( "Argument hash must contain at least :uid or :name" ) unless target[ :uid ] || target[ :name ]
|
492
|
+
|
493
|
+
# nils are valid arguments here, at least one of :name, :id has been verified to not be nil
|
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)
|
496
|
+
|
497
|
+
#Kernel::raise ArgumentError.new( "Sleep time need to be Integer >= 0" ) unless sleep_time.kind_of? Numeric #instance_of?( Fixnum )
|
498
|
+
Kernel::raise ArgumentError.new( "Sleep time need to be >= 0" ) unless sleep_time >= 0
|
499
|
+
|
500
|
+
|
501
|
+
# try to find an existing app with the current arguments
|
502
|
+
if target[ :try_attach ]
|
503
|
+
|
504
|
+
app_list = MobyBase::StateObject.new( self.list_apps() )
|
505
|
+
|
506
|
+
# either ID or NAME have been passed to identify the application
|
507
|
+
# raise exception if more than one app has been found for this id/name
|
508
|
+
# otherwhise attempt to get the application test object
|
509
|
+
app_info = find_app(app_list, {:id => target[ :uid ]}) if target[ :uid ] != nil
|
510
|
+
app_info = find_app(app_list, {:name => target[ :name ]}) unless app_info
|
511
|
+
app = self.application(:id => app_info.id) if app_info
|
512
|
+
if app
|
513
|
+
begin
|
514
|
+
app.bring_to_foreground
|
515
|
+
rescue Exception => e
|
516
|
+
MobyUtil::Logger.instance.log "WARNING", "Could not bring app to foreground"
|
517
|
+
end
|
518
|
+
return app
|
519
|
+
end
|
520
|
+
end
|
521
|
+
|
522
|
+
if ( target[ :start_command ] != nil )
|
523
|
+
Kernel::raise MobyBase::BehaviourError.new("Run", "Failed to load execute_shell_method") unless self.respond_to?("execute_shell_command")
|
524
|
+
execute_shell_command( target[ :start_command ], :detached => "true" )
|
525
|
+
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
|
+
|
537
|
+
# execute the application control service request
|
538
|
+
execute_command( run_command )
|
539
|
+
|
540
|
+
end
|
541
|
+
|
542
|
+
# do not remove this, unless qttas server & plugin handles the syncronization between plugin registration & first ui state request
|
543
|
+
# first ui dump is requested too early and target/server seems not be ready...
|
544
|
+
#sleep 0.100
|
545
|
+
|
546
|
+
sleep sleep_time if sleep_time > 0
|
547
|
+
|
548
|
+
#TODO: Refresh should be initiated by sut_controller
|
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'
|
555
|
+
|
556
|
+
expected_attributes[ :id ] = target[ :uid ] unless target[ :uid ].nil?
|
557
|
+
expected_attributes[ :FullName ] = target[ :name ] unless target[ :name ].nil?
|
558
|
+
|
559
|
+
error_details = target[ :name ].nil? ? "" : "name: " << target[ :name ].to_s
|
560
|
+
|
561
|
+
error_details << ( error_details.empty? ? "" : ", ") << "id: " << target[ :uid ].to_s if !target[ :uid ].nil?
|
562
|
+
|
563
|
+
if( self.ui_type.downcase.include?( 'qt' ) && !expected_attributes[ :FullName ].nil? )
|
564
|
+
|
565
|
+
if( expected_attributes[ :FullName ].include?('/') )
|
566
|
+
|
567
|
+
app_name = expected_attributes[ :FullName ].split('/')[ expected_attributes[ :FullName ].split( '/' ).size-1 ]
|
568
|
+
app_name.slice!( ".exe" )
|
569
|
+
expected_attributes[ :name ] = app_name
|
570
|
+
|
571
|
+
elsif( expected_attributes[ :FullName ].include?("\\") )
|
572
|
+
|
573
|
+
app_name = expected_attributes[ :FullName ].split("\\")[ expected_attributes[ :FullName ].split( "\\" ).size-1 ]
|
574
|
+
app_name.slice!( ".exe" )
|
575
|
+
expected_attributes[:name] = app_name
|
576
|
+
|
577
|
+
else
|
578
|
+
|
579
|
+
app_name = expected_attributes[ :FullName ]
|
580
|
+
app_name.slice!( ".exe" )
|
581
|
+
expected_attributes[ :name ] = app_name
|
582
|
+
|
583
|
+
end
|
584
|
+
|
585
|
+
expected_attributes.delete( :FullName )
|
586
|
+
|
587
|
+
end
|
588
|
+
|
589
|
+
begin
|
590
|
+
|
591
|
+
self.wait_child(
|
592
|
+
expected_attributes,
|
593
|
+
MobyUtil::Parameter[ @id ][ :application_synchronization_timeout, '5' ].to_f,
|
594
|
+
MobyUtil::Parameter[ @id ][ :application_synchronization_retry_interval, '0.5' ].to_f
|
595
|
+
)
|
596
|
+
|
597
|
+
rescue MobyBase::SyncTimeoutError
|
598
|
+
|
599
|
+
Kernel::raise MobyBase::VerificationError.new("The application (#{ error_details }) was not found on the sut after being launched.")
|
600
|
+
|
601
|
+
end
|
602
|
+
|
603
|
+
# verify run results
|
604
|
+
foreground_app = self.application( expected_attributes )
|
605
|
+
|
606
|
+
Kernel::raise MobyBase::VerificationError.new("No application type test object was found on the device after starting the application.") unless foreground_app.kind_of?( MobyBehaviour::Application )
|
607
|
+
|
608
|
+
rescue Exception => e
|
609
|
+
|
610
|
+
MobyUtil::Logger.instance.log "behaviour", "FAIL;Failed to launch application.;#{id.to_s};sut;{};run;" << ( target.kind_of?( Hash ) ? target.inspect : target.class.to_s )
|
611
|
+
|
612
|
+
Kernel::raise MobyBase::BehaviourError.new("Run", "Failed to launch application")
|
613
|
+
|
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
|
+
end
|
619
|
+
|
620
|
+
MobyUtil::Logger.instance.log "behaviour" , "PASS;The application was launched successfully.;#{id.to_s};sut;{};run;" << target.inspect
|
621
|
+
|
622
|
+
foreground_app
|
623
|
+
|
624
|
+
end
|
625
|
+
|
626
|
+
# == description
|
627
|
+
# Performs a key press or key press sequence to SUT. Key press sequence can contain more complex operations such as holding multiple keys down at the same. Key map file is provided by SUT plugin and is configured in TDriver parameters and/or SUT template XML file (tdriver_parameters.xml).\n
|
628
|
+
# \n
|
629
|
+
# [b]Note for Qt users:[/b]\n
|
630
|
+
# If the focus is not currently on target object you need to use the it's own press_key method or tap it before sending any key press events.
|
631
|
+
#
|
632
|
+
# == tables
|
633
|
+
# press_key_sequences
|
634
|
+
# title: Keypress sequence types
|
635
|
+
# description: Describes different types of keypresses. All types are symbols. The amount of time each key are held and time between presses can be specified in tdriver_parameters.xml: short_press are for "normal" keypresses, while long_press are for keypresses of type :LongPress
|
636
|
+
# |Type|Description|Example|
|
637
|
+
# |:KeyDown|Holds key down on SUT until it is released|MobyCommand::KeySequence.new(:kShift, :KeyDown)|
|
638
|
+
# |:KeyUp|Releases a key that was held down on SUT|MobyCommand::KeySequence.new(:kShift, :KeyUp)|
|
639
|
+
# |: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 )|
|
640
|
+
#
|
641
|
+
# == tables
|
642
|
+
# press_key_sequences_methods
|
643
|
+
# title: Keypress sequence methods
|
644
|
+
# description: Specifies possible altering methods for keysequnces. All keysequences are created with MobyCommand::KeySequence.new
|
645
|
+
# |Type|Description|Example|
|
646
|
+
# |:KeyDown|Holds key down on SUT until it is released|MobyCommand::KeySequence.new(:kShift, :KeyDown)|
|
647
|
+
# |:KeyUp|Releases a key that was held down on SUT|MobyCommand::KeySequence.new(:kShift, :KeyUp)|
|
648
|
+
# |: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
|
+
#
|
650
|
+
# == arguments
|
651
|
+
# symbol_or_sequence
|
652
|
+
# Symbol
|
653
|
+
# description: one of the key symbols defined in /tdriver/keymaps/
|
654
|
+
# example: @sut.press_key(:kDown)
|
655
|
+
# MobyCommand::KeySequence
|
656
|
+
# description: a KeySequence object of key symbols
|
657
|
+
# example: @sut.press_key( MobyCommand::KeySequence.new(:kDown).times!(3).append!(:kLeft) )
|
658
|
+
#
|
659
|
+
# == returns
|
660
|
+
# NilClass
|
661
|
+
# description: -
|
662
|
+
# example: -
|
663
|
+
#
|
664
|
+
# == exceptions
|
665
|
+
# ArgumentError
|
666
|
+
# description: if input not a symbol or not of type MobyCommand::KeySequence
|
667
|
+
#
|
668
|
+
def press_key( symbol_or_sequence )
|
669
|
+
|
670
|
+
begin
|
671
|
+
|
672
|
+
if symbol_or_sequence.instance_of?( Symbol )
|
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
|
679
|
+
|
680
|
+
else
|
681
|
+
|
682
|
+
raise ArgumentError.new('Data not of type Symbol or MobyController::KeySequence.')
|
683
|
+
|
684
|
+
end
|
685
|
+
|
686
|
+
sequence.set_sut( self )
|
687
|
+
execute_command( sequence )
|
688
|
+
|
689
|
+
rescue Exception => e
|
690
|
+
|
691
|
+
MobyUtil::Logger.instance.log "behaviour" , "FAIL;Failed to press key(s).;#{id.to_s};sut;{};press_key;#{ symbol_or_sequence }"
|
692
|
+
Kernel::raise e
|
693
|
+
|
694
|
+
end
|
695
|
+
|
696
|
+
MobyUtil::Logger.instance.log "behaviour" , "PASS;Successfully pressed key(s).;#{id.to_s};sut;{};press_key;#{ symbol_or_sequence }"
|
697
|
+
|
698
|
+
nil
|
699
|
+
|
700
|
+
end
|
701
|
+
|
702
|
+
# == description
|
703
|
+
# Wrapper function to access sut specific parameters.
|
704
|
+
# Parameters for each sut are stored in the parameters xml file under group tag with name attribute matching the SUT id
|
705
|
+
#
|
706
|
+
# == arguments
|
707
|
+
# *arguments
|
708
|
+
# String
|
709
|
+
# description: Optional argument which is the name of parameter.
|
710
|
+
# example: 'new_parameter'
|
711
|
+
# Symbol
|
712
|
+
# description: Optional argument which is the name of parameter.
|
713
|
+
# example: :product
|
714
|
+
#
|
715
|
+
# == returns
|
716
|
+
# String
|
717
|
+
# description: Value matching the parameter name given as argument
|
718
|
+
# example: 'testability-driver-qt-sut-plugin'
|
719
|
+
#
|
720
|
+
# MobyUtil::ParameterHash
|
721
|
+
# description: Hash of values, if no arguments is specified
|
722
|
+
# example: { :value => '1', :inner_hash => { :another_value => 100 } }
|
723
|
+
#
|
724
|
+
# == exceptions
|
725
|
+
# ParameterNotFoundError
|
726
|
+
# description: If the parameter with the given name does not exist
|
727
|
+
#
|
728
|
+
# == example
|
729
|
+
# parameter_hash = @sut.parameter #returns the hash of all sut parameters
|
730
|
+
# value = @sut.parameter[:product] #returns the value for parameter 'product' for this particular sut
|
731
|
+
# value = @sut.parameter['non_existing_parameter'] #raises exception that 'non_existing_parameter' was not found
|
732
|
+
# value = sut.parameter['non_existing_parameter', 'default'] #returns default value if given parameter is not found
|
733
|
+
# sut.parameter[:new_parameter] ='new_value' # set the value of parameter 'product' for this particular sut
|
734
|
+
def parameter( *arguments )
|
735
|
+
|
736
|
+
if ( arguments.count == 0 )
|
737
|
+
|
738
|
+
MobyUtil::ParameterUserAPI.instance[ @id ]
|
739
|
+
|
740
|
+
else
|
741
|
+
|
742
|
+
#$stderr.puts "%s:%s warning: deprecated method usage convention, please use sut#parameter[] instead of sut#parameter()" % ( caller.first || "%s:%s" % [ __FILE__, __LINE__ ] ).split(":")[ 0..1 ]
|
743
|
+
|
744
|
+
MobyUtil::ParameterUserAPI.instance[ @id ][ *arguments ]
|
745
|
+
|
746
|
+
end
|
747
|
+
|
748
|
+
end
|
749
|
+
|
750
|
+
# == description
|
751
|
+
# Wrapper function to return translated string for this SUT to read the values from localisation database.
|
752
|
+
#
|
753
|
+
# == arguments
|
754
|
+
# logical_name
|
755
|
+
# String
|
756
|
+
# 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
|
757
|
+
# example: "txt_button_ok"
|
758
|
+
# Symbol
|
759
|
+
# description: Symbol form of the logical name (LNAME) of the item to be translated.
|
760
|
+
# example: :txt_button_ok
|
761
|
+
#
|
762
|
+
# file_name
|
763
|
+
# String
|
764
|
+
# description: Optional FNAME search argument for the translation
|
765
|
+
# example: "agenda"
|
766
|
+
# default: nil
|
767
|
+
#
|
768
|
+
# plurality
|
769
|
+
# String
|
770
|
+
# description: Optional PLURALITY search argument for the translation
|
771
|
+
# example: "a" or "singular"
|
772
|
+
# default: nil
|
773
|
+
#
|
774
|
+
# numerus
|
775
|
+
# String
|
776
|
+
# description: Optional numeral replacement of '%Ln' tags on translation strings
|
777
|
+
# example: "1"
|
778
|
+
# default: nil
|
779
|
+
# Integer
|
780
|
+
# description: Optional numeral replacement of '%Ln' tags on translation strings
|
781
|
+
# example: 1
|
782
|
+
#
|
783
|
+
# lengthvariant
|
784
|
+
# String
|
785
|
+
# description: Optional LENGTHVAR search argument for the translation (1-9)
|
786
|
+
# example: "1"
|
787
|
+
# default: nil
|
788
|
+
#
|
789
|
+
# == returns
|
790
|
+
# String
|
791
|
+
# description: Translation matching the logical_name
|
792
|
+
# example: "Ok"
|
793
|
+
# Array
|
794
|
+
# description: If multiple translations have been found for the search conditions an Array with all Strings be returned
|
795
|
+
# example: ["Ok", "OK"]
|
796
|
+
#
|
797
|
+
# == exceptions
|
798
|
+
# LanguageNotFoundError
|
799
|
+
# description: In case language is not found
|
800
|
+
#
|
801
|
+
# LogicalNameNotFoundError
|
802
|
+
# description: In case no logical name is not found for current language
|
803
|
+
#
|
804
|
+
# SqlError
|
805
|
+
# description: In case there are problems with the database connectivity
|
806
|
+
#
|
807
|
+
def translate( logical_name, file_name = nil, plurality = nil, numerus = nil, lengthvariant = nil )
|
808
|
+
|
809
|
+
Kernel::raise LogicalNameNotFoundError.new("Logical name is nil") if logical_name.nil?
|
810
|
+
|
811
|
+
translation_type = "localisation"
|
812
|
+
|
813
|
+
# Check for User Information prefix( "uif_...")
|
814
|
+
MobyUtil::Parameter[ :user_data_logical_string_identifier, 'uif_' ].split('|').each do |identifier|
|
815
|
+
if logical_name.to_s.index(identifier)==0
|
816
|
+
translation_type="user_data"
|
817
|
+
end
|
818
|
+
end
|
819
|
+
|
820
|
+
# Check for Operator Data prefix( "operator_...")
|
821
|
+
MobyUtil::Parameter[ :operator_data_logical_string_identifier, 'operator_' ].split('|').each do |identifier|
|
822
|
+
if logical_name.to_s.index(identifier)==0
|
823
|
+
translation_type="operator_data"
|
824
|
+
end
|
825
|
+
end
|
826
|
+
|
827
|
+
case translation_type
|
828
|
+
|
829
|
+
when "user_data"
|
830
|
+
get_user_information( logical_name )
|
831
|
+
|
832
|
+
when "operator_data"
|
833
|
+
get_operator_data( logical_name )
|
834
|
+
|
835
|
+
when "localisation"
|
836
|
+
language=nil
|
837
|
+
if ( MobyUtil::Parameter[ self.id ][:read_lang_from_app]=='true')
|
838
|
+
#read localeName app
|
839
|
+
language=self.application.attribute("localeName")
|
840
|
+
#determine the language from the locale
|
841
|
+
language=language.split('_')[0].to_s if (language!=nil && !language.empty?)
|
842
|
+
else
|
843
|
+
language=MobyUtil::Parameter[ self.id ][ :language ]
|
844
|
+
end
|
845
|
+
Kernel::raise LanguageNotFoundError.new("Language cannot be determind to perform translation") if (language==nil || language.empty?)
|
846
|
+
translation = MobyUtil::Localisation.translation( logical_name, language,
|
847
|
+
MobyUtil::Parameter[ self.id ][ :localisation_server_database_tablename ], file_name,
|
848
|
+
plurality, lengthvariant )
|
849
|
+
|
850
|
+
if translation.kind_of? String and !numerus.nil?
|
851
|
+
translation.gsub!(/%(Ln|1)/){|s| numerus}
|
852
|
+
elsif translation.kind_of? Array and !numerus.nil?
|
853
|
+
translation.each do |trans|
|
854
|
+
trans.gsub!(/%(Ln|1)/){|s| numerus}
|
855
|
+
end
|
856
|
+
end
|
857
|
+
translation
|
858
|
+
end
|
859
|
+
end
|
860
|
+
|
861
|
+
# == description
|
862
|
+
# Wrapper function to retrieve user information for this SUT from the user information database.
|
863
|
+
#
|
864
|
+
# == arguments
|
865
|
+
# user_data_lname
|
866
|
+
# String
|
867
|
+
# description: Logical name (LNAME) of the user information item to be retrieved.
|
868
|
+
# example: "uif_first_name"
|
869
|
+
# Symbol
|
870
|
+
# description: Symbol form of the logical name (LNAME) of the user information item to be retrieved.
|
871
|
+
# example: :uif_first_name
|
872
|
+
#
|
873
|
+
# == returns
|
874
|
+
# String
|
875
|
+
# description: User data string
|
876
|
+
# example: "Ivan"
|
877
|
+
# Array
|
878
|
+
# description: Array of Strings when multiple user data strings found.
|
879
|
+
# example: ["Ivan", "Manolo"]
|
880
|
+
#
|
881
|
+
# == exceptions
|
882
|
+
# UserDataNotFoundError
|
883
|
+
# description: In case the desired user data is not found
|
884
|
+
#
|
885
|
+
# UserDataColumnNotFoundError
|
886
|
+
# description: In case the desired data column name to be used for the output is not found
|
887
|
+
#
|
888
|
+
# SqlError
|
889
|
+
# description: In case there are problems with the database connectivity
|
890
|
+
#
|
891
|
+
def get_user_information( user_data_lname )
|
892
|
+
language = MobyUtil::Parameter[ self.id ][ :language ]
|
893
|
+
table_name = MobyUtil::Parameter[ self.id ][ :user_data_server_database_tablename ]
|
894
|
+
MobyUtil::UserData.retrieve( user_data_lname, language, table_name )
|
895
|
+
end
|
896
|
+
|
897
|
+
# == description
|
898
|
+
# Wrapper function to retrieve operator data for this SUT from the operator data database.
|
899
|
+
#
|
900
|
+
# == arguments
|
901
|
+
# operator_data_lname
|
902
|
+
# String
|
903
|
+
# description: Logical name (LNAME) of the operator data item to be retrieved.
|
904
|
+
# example: "operator_welcome_message"
|
905
|
+
# Symbol
|
906
|
+
# description: Symbol form of the logical name (LNAME) of the operator data item to be retrieved.
|
907
|
+
# example: :operator_welcome_message
|
908
|
+
#
|
909
|
+
# == returns
|
910
|
+
# String
|
911
|
+
# description: User data string
|
912
|
+
# example: "Welcome to Orange"
|
913
|
+
#
|
914
|
+
# == exceptions
|
915
|
+
# OperatorDataNotFoundError
|
916
|
+
# description: In case the desired operator data is not found
|
917
|
+
#
|
918
|
+
# OperatorDataColumnNotFoundError
|
919
|
+
# description: In case the desired data column name to be used for the output is not found
|
920
|
+
#
|
921
|
+
# SqlError
|
922
|
+
# description: In case there are problems with the database connectivity
|
923
|
+
#
|
924
|
+
def get_operator_data( operator_data_lname )
|
925
|
+
operator = MobyUtil::Parameter[ self.id ][ :operator_selected ]
|
926
|
+
table_name = MobyUtil::Parameter[ self.id ][ :operator_data_server_database_tablename]
|
927
|
+
MobyUtil::OperatorData.retrieve( operator_data_lname, operator, table_name )
|
928
|
+
end
|
929
|
+
|
930
|
+
# == nodoc
|
931
|
+
# Function to update all children of current SUT
|
932
|
+
# Iterates on all children of the SUT and calls TestObject#update on all children
|
933
|
+
# === params
|
934
|
+
# === returns
|
935
|
+
# ?
|
936
|
+
# === raises
|
937
|
+
def update
|
938
|
+
|
939
|
+
#@_child_objects.each{ | test_object | test_object.update( @xml_data ) } if !@childs_updated
|
940
|
+
|
941
|
+
unless @childs_updated
|
942
|
+
|
943
|
+
@_child_object_cache.each_value{ | test_object |
|
944
|
+
|
945
|
+
test_object.update( @xml_data )
|
946
|
+
|
947
|
+
}
|
948
|
+
|
949
|
+
|
950
|
+
end
|
951
|
+
|
952
|
+
@childs_updated = true
|
953
|
+
|
954
|
+
end
|
955
|
+
|
956
|
+
# == nodoc
|
957
|
+
def refresh( refresh_args = {}, creation_attributes = {})
|
958
|
+
|
959
|
+
refresh_ui_dump refresh_args, creation_attributes
|
960
|
+
|
961
|
+
# update childs only if ui state is new
|
962
|
+
update if !@childs_updated
|
963
|
+
|
964
|
+
end
|
965
|
+
|
966
|
+
# == description
|
967
|
+
# Verify always is a method for sut that allows constant verifications for the UI state.
|
968
|
+
#
|
969
|
+
# == arguments
|
970
|
+
# expected
|
971
|
+
# Object
|
972
|
+
# description: Ruby object that equals to the return value of the block
|
973
|
+
# example: true
|
974
|
+
#
|
975
|
+
# message
|
976
|
+
# String
|
977
|
+
# description: Message if an error occurs
|
978
|
+
# example: 'Required element was not found'
|
979
|
+
#
|
980
|
+
# &block
|
981
|
+
# Proc
|
982
|
+
# description: Code block to execute.
|
983
|
+
# example: { @sut.xml_data.empty? == false }
|
984
|
+
#
|
985
|
+
# &block#sut
|
986
|
+
# MobyBase::SUT
|
987
|
+
# description:
|
988
|
+
# Current SUT object is passed as block parameter. If the verify block is defined outside the scope of
|
989
|
+
# the current SUT (e.g. the SUT configuration file), this can be used to get a handle to the current SUT.
|
990
|
+
# example: -
|
991
|
+
#
|
992
|
+
# == returns
|
993
|
+
# NilClass
|
994
|
+
# description: This method doesn't pass return value
|
995
|
+
# example: -
|
996
|
+
#
|
997
|
+
# == exceptions
|
998
|
+
# MobyBase::VerificationError
|
999
|
+
# description: If verification failed
|
1000
|
+
def verify_always( expected, message = nil, &block )
|
1001
|
+
|
1002
|
+
@verify_blocks << MobyUtil::VerifyBlock.new( block,expected, message, 0, MobyUtil::KernelHelper.find_source( caller( 3 ).first.to_s ) )
|
1003
|
+
|
1004
|
+
end
|
1005
|
+
|
1006
|
+
# == description
|
1007
|
+
# Clears all verification blocks added to the sut through verify_always() method and
|
1008
|
+
# verify_blocks configuration parameter in the tdriver parameters file
|
1009
|
+
#
|
1010
|
+
# == arguments
|
1011
|
+
#
|
1012
|
+
# == returns
|
1013
|
+
# Array
|
1014
|
+
# description: Now empty array of verification blocks
|
1015
|
+
#
|
1016
|
+
# == exceptions
|
1017
|
+
#
|
1018
|
+
def clear_verify_blocks
|
1019
|
+
|
1020
|
+
@verify_blocks = []
|
1021
|
+
|
1022
|
+
end
|
1023
|
+
|
1024
|
+
def get_application_id
|
1025
|
+
|
1026
|
+
orig_frozen = @frozen;
|
1027
|
+
|
1028
|
+
begin
|
1029
|
+
|
1030
|
+
freeze unless @frozen
|
1031
|
+
|
1032
|
+
ret = self.application.id
|
1033
|
+
|
1034
|
+
unfreeze unless orig_frozen
|
1035
|
+
|
1036
|
+
return ret
|
1037
|
+
|
1038
|
+
rescue
|
1039
|
+
|
1040
|
+
ensure
|
1041
|
+
|
1042
|
+
unfreeze unless orig_frozen
|
1043
|
+
|
1044
|
+
end
|
1045
|
+
|
1046
|
+
'-1'
|
1047
|
+
|
1048
|
+
end
|
1049
|
+
|
1050
|
+
private
|
1051
|
+
|
1052
|
+
def fetch_references( xml )
|
1053
|
+
|
1054
|
+
pids = []
|
1055
|
+
|
1056
|
+
x_prev = ''
|
1057
|
+
y_prev = ''
|
1058
|
+
|
1059
|
+
while true
|
1060
|
+
|
1061
|
+
nodes = xml.xpath( '//object[@type = "TDriverRef"]' )
|
1062
|
+
|
1063
|
+
idx = 1
|
1064
|
+
|
1065
|
+
nodes.each { | element |
|
1066
|
+
|
1067
|
+
pid = element.xpath('//attribute[@name = "uri"]/value/text()')[ 0 ].to_s
|
1068
|
+
|
1069
|
+
if pid.nil? or pid.empty? or pid.to_i <= 0 # invalid reference
|
1070
|
+
|
1071
|
+
element.remove
|
1072
|
+
next
|
1073
|
+
|
1074
|
+
end
|
1075
|
+
|
1076
|
+
# Element parent not supported, so query the parent coords
|
1077
|
+
x_abs = xml.xpath( '//object[@type = "TDriverRef"]/../../attributes/attribute[@name ="x_absolute"]/value/text()' )[ idx - 1 ]
|
1078
|
+
y_abs = xml.xpath( '//object[@type = "TDriverRef"]/../../attributes/attribute[@name ="y_absolute"]/value/text()' )[ idx - 1 ]
|
1079
|
+
|
1080
|
+
# window size
|
1081
|
+
winSize = xml.xpath( "//objects/object[@type = 'MainWindow']/attributes/attribute[@name ='size']/value/text()" )[ 0 ].to_s
|
1082
|
+
|
1083
|
+
# ref-ref parent does not know x coordinate, use the grandparent xys
|
1084
|
+
x_prev = x_abs.to_s unless x_abs.nil?
|
1085
|
+
y_prev = y_abs.to_s unless y_abs.nil?
|
1086
|
+
|
1087
|
+
idx += 1
|
1088
|
+
|
1089
|
+
if !pid.empty?
|
1090
|
+
|
1091
|
+
begin
|
1092
|
+
|
1093
|
+
subdata =
|
1094
|
+
MobyUtil::XML.parse_string(
|
1095
|
+
execute_command(
|
1096
|
+
MobyCommand::Application.new(
|
1097
|
+
:State,
|
1098
|
+
nil,
|
1099
|
+
pid,
|
1100
|
+
self,
|
1101
|
+
nil,
|
1102
|
+
nil,
|
1103
|
+
nil,
|
1104
|
+
nil,
|
1105
|
+
{
|
1106
|
+
'x_parent_absolute' => x_prev,
|
1107
|
+
'y_parent_absolute' => y_prev,
|
1108
|
+
'embedded' => 'true',
|
1109
|
+
'parent_size' => winSize
|
1110
|
+
}
|
1111
|
+
)
|
1112
|
+
)[ 0 ]
|
1113
|
+
)
|
1114
|
+
|
1115
|
+
child = subdata.root.xpath('//object')[0]
|
1116
|
+
|
1117
|
+
# Remove the attribute with the pid retrieval was not successful.
|
1118
|
+
# (server returns the previous hit if not found)
|
1119
|
+
if child.attribute('id' ) != pid
|
1120
|
+
|
1121
|
+
element.remove
|
1122
|
+
|
1123
|
+
else
|
1124
|
+
|
1125
|
+
# Remove the application layer
|
1126
|
+
objs = child.xpath( '/tasMessage/tasInfo/object/objects/*' )
|
1127
|
+
|
1128
|
+
if !objs.nil?
|
1129
|
+
|
1130
|
+
objs.each { | el | element.add_previous_sibling( el ) }
|
1131
|
+
|
1132
|
+
element.remove
|
1133
|
+
|
1134
|
+
end
|
1135
|
+
|
1136
|
+
end
|
1137
|
+
|
1138
|
+
rescue RuntimeError => e
|
1139
|
+
|
1140
|
+
raise e unless e.message.include? "no longer available"
|
1141
|
+
|
1142
|
+
return xml
|
1143
|
+
|
1144
|
+
end
|
1145
|
+
|
1146
|
+
else
|
1147
|
+
|
1148
|
+
return xml
|
1149
|
+
|
1150
|
+
end
|
1151
|
+
|
1152
|
+
}
|
1153
|
+
|
1154
|
+
return xml if nodes.empty?
|
1155
|
+
|
1156
|
+
end
|
1157
|
+
|
1158
|
+
end
|
1159
|
+
|
1160
|
+
def find_app( app_list, search_params )
|
1161
|
+
|
1162
|
+
app_info = nil
|
1163
|
+
|
1164
|
+
begin
|
1165
|
+
|
1166
|
+
app_info = app_list.application( search_params )
|
1167
|
+
|
1168
|
+
rescue MobyBase::TestObjectNotFoundError
|
1169
|
+
|
1170
|
+
app_info = nil
|
1171
|
+
|
1172
|
+
end
|
1173
|
+
|
1174
|
+
app_info
|
1175
|
+
end
|
1176
|
+
|
1177
|
+
# this method will be automatically invoked after module is extended to sut object
|
1178
|
+
def self.extended( target_object )
|
1179
|
+
|
1180
|
+
target_object.instance_exec{
|
1181
|
+
|
1182
|
+
initialize_settings
|
1183
|
+
|
1184
|
+
}
|
1185
|
+
|
1186
|
+
end
|
1187
|
+
|
1188
|
+
def initialize_settings
|
1189
|
+
|
1190
|
+
@xml_data = ""
|
1191
|
+
|
1192
|
+
@x_path = '.'
|
1193
|
+
|
1194
|
+
@frozen = false
|
1195
|
+
|
1196
|
+
@_child_object_cache = {}
|
1197
|
+
|
1198
|
+
@current_application_id = nil
|
1199
|
+
|
1200
|
+
|
1201
|
+
@dump_count = 0
|
1202
|
+
|
1203
|
+
# default values
|
1204
|
+
@input = :key
|
1205
|
+
|
1206
|
+
@refresh_tries = 5
|
1207
|
+
@refresh_interval = 0.5
|
1208
|
+
|
1209
|
+
@childs_updated = false
|
1210
|
+
|
1211
|
+
# id not found from parameters
|
1212
|
+
if MobyUtil::Parameter[ @id, nil ] != nil
|
1213
|
+
|
1214
|
+
@input = MobyUtil::Parameter[ @id ][ :input_type, "key" ].to_sym
|
1215
|
+
|
1216
|
+
@refresh_tries = MobyUtil::Parameter[ @id ][ :ui_state_refresh_tries, @refresh_tries ].to_f
|
1217
|
+
|
1218
|
+
@refresh_interval = MobyUtil::Parameter[ @id ][ :refresh_interval, @refresh_interval ].to_f
|
1219
|
+
|
1220
|
+
end
|
1221
|
+
|
1222
|
+
@last_xml_data = nil
|
1223
|
+
|
1224
|
+
ruby_file = MobyUtil::Parameter[ @id ][ :verify_blocks ]
|
1225
|
+
|
1226
|
+
@verify_blocks = []
|
1227
|
+
|
1228
|
+
if File.exists?( ruby_file )
|
1229
|
+
|
1230
|
+
load ruby_file
|
1231
|
+
|
1232
|
+
SutParameters::VERIFY_BLOCKS.each { | block |
|
1233
|
+
|
1234
|
+
@verify_blocks << block
|
1235
|
+
|
1236
|
+
}
|
1237
|
+
|
1238
|
+
|
1239
|
+
end
|
1240
|
+
|
1241
|
+
end
|
1242
|
+
|
1243
|
+
public # deprecated
|
1244
|
+
|
1245
|
+
|
1246
|
+
# == nodoc
|
1247
|
+
#TODO: Update documentation
|
1248
|
+
#TODO: Is this function deprecated? (see SUT#refresh_ui_dump)
|
1249
|
+
#TODO: rethink get_ui_dump and refresh --> functions!
|
1250
|
+
# function to query for UIDump.
|
1251
|
+
# == returns
|
1252
|
+
# xmlDocument:: REXML::Document object containing valid xml fragment
|
1253
|
+
# == raises
|
1254
|
+
# someException:: If Dump does not conform to the tasMessage schema error is raised
|
1255
|
+
def get_ui_dump( refresh_args = {} )
|
1256
|
+
|
1257
|
+
#$stderr.puts "warning: SUT#get_ui_dump is deprecated, please use SUT#refresh_ui_dump instead."
|
1258
|
+
|
1259
|
+
refresh_ui_dump refresh_args, {}
|
1260
|
+
|
1261
|
+
end
|
1262
|
+
|
1263
|
+
# enable hooking for performance measurement & debug logging
|
1264
|
+
MobyUtil::Hooking.instance.hook_methods( self ) if defined?( MobyUtil::Hooking )
|
1265
|
+
|
1266
|
+
end # SUT
|
1267
|
+
|
1268
|
+
end # MobyBehaviour
|