cutedriver-qt-sut-plugin 2.0.0.20210120165900
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/env.rb +24 -0
- data/installer/extconf.rb +62 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin.rb +23 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/action.rb +157 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/application.rb +312 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/attribute.rb +300 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/behaviour.rb +214 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/configure_behaviour.rb +317 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/cute_cpu.rb +145 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/cute_gpu.rb +147 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/cute_mem.rb +142 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/cute_pwr.rb +146 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/events.rb +192 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/file_transfer.rb +375 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/find.rb +82 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/fixture.rb +214 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/fps.rb +189 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/gesture.rb +1039 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/infologger.rb +767 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/key_press.rb +166 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/locale_db.rb +157 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/method.rb +112 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/multitouch.rb +474 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/os.rb +100 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/qt_api_method.rb +148 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/record.rb +134 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/screen_capture.rb +279 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/settings.rb +302 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/sut.rb +840 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/synchronization.rb +257 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/treewidgetitemcolumn.rb +117 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/type_text.rb +97 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/view_item.rb +97 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/webkit.rb +272 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/widget.rb +877 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/action.rb +30 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/configure_command.rb +38 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/drag.rb +44 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/find_object.rb +67 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/group.rb +44 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/infologger_command.rb +38 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/qt.rb +171 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/tap.rb +54 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/version.rb +34 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/widget.rb +199 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/agent.rb +54 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/application.rb +192 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/configure_command.rb +53 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/find_object.rb +48 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/fixture.rb +65 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/group.rb +57 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/infologger_command.rb +53 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/key_sequence.rb +93 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/screen_capture.rb +53 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/tap.rb +62 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/version.rb +46 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/widget.rb +98 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/plugin.rb +200 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/sut/adapter.rb +466 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/sut/communication.rb +185 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/sut/controller.rb +69 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/util/find_object_generator.rb +287 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/util/fixture_parameter.rb +77 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/util/message_composer.rb +370 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/util/widget.rb +79 -0
- data/lib/testability-driver-qt-sut-plugin.rb +24 -0
- data/xml/behaviour/qt.xml +845 -0
- data/xml/defaults/sut_qt.xml +9 -0
- data/xml/keymap/qt.xml +321 -0
- data/xml/keymap/win.xml +174 -0
- data/xml/template/qt.xml +141 -0
- metadata +127 -0
@@ -0,0 +1,185 @@
|
|
1
|
+
############################################################################
|
2
|
+
##
|
3
|
+
## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
4
|
+
## All rights reserved.
|
5
|
+
## Contact: Nokia Corporation (testabilitydriver@nokia.com)
|
6
|
+
##
|
7
|
+
## This file is part of TDriver.
|
8
|
+
##
|
9
|
+
## If you have questions regarding the use of this file, please contact
|
10
|
+
## Nokia at testabilitydriver@nokia.com .
|
11
|
+
##
|
12
|
+
## This library is free software; you can redistribute it and/or
|
13
|
+
## modify it under the terms of the GNU Lesser General Public
|
14
|
+
## License version 2.1 as published by the Free Software Foundation
|
15
|
+
## and appearing in the file LICENSE.LGPL included in the packaging
|
16
|
+
## of this file.
|
17
|
+
##
|
18
|
+
############################################################################
|
19
|
+
|
20
|
+
module MobyController
|
21
|
+
|
22
|
+
module QT
|
23
|
+
|
24
|
+
module Comms
|
25
|
+
|
26
|
+
# Command types
|
27
|
+
ERROR_MSG = 0
|
28
|
+
VALID_MSG = 1
|
29
|
+
OK_MESSAGE = "OK"
|
30
|
+
|
31
|
+
class Inflator
|
32
|
+
|
33
|
+
def self.inflate( response )
|
34
|
+
|
35
|
+
# strip 4 extra bytes written by qt compression, return empty string if no raw data found, otherwise inflate it
|
36
|
+
( raw_data = response[ 4 .. -1 ] ).empty? ? "" : Zlib::Inflate.inflate( raw_data )
|
37
|
+
|
38
|
+
end
|
39
|
+
|
40
|
+
# enable hooking for performance measurement & debug logging
|
41
|
+
TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
|
42
|
+
|
43
|
+
end # Inflator
|
44
|
+
|
45
|
+
# deprecated: see send_service_request#adapter.rb
|
46
|
+
# Wrapper for protocol message.
|
47
|
+
class QTResponse
|
48
|
+
|
49
|
+
attr_accessor :msg_body, :flag, :crc, :message_id
|
50
|
+
|
51
|
+
# deprecated: see send_service_request#adapter.rb
|
52
|
+
# Initialize QT Response.
|
53
|
+
# == params
|
54
|
+
# command_flag Indicator flad for message type (error or ok)
|
55
|
+
# message_code 0 or an error code
|
56
|
+
# msg_body Body of the message. For command a simple "OK" message for ui state the xml document as string
|
57
|
+
# == returns
|
58
|
+
def initialize( command_flag, msg_body, crc, message_id )
|
59
|
+
|
60
|
+
@flag, @msg_body, @crc, @message_id = command_flag, msg_body, crc, message_id
|
61
|
+
|
62
|
+
end
|
63
|
+
|
64
|
+
# deprecated: see send_service_request#adapter.rb
|
65
|
+
def validate_message( msg_id )
|
66
|
+
|
67
|
+
#check that response matches the request
|
68
|
+
if @message_id != msg_id
|
69
|
+
|
70
|
+
msg = "Response to request did not match: #{ @message_id.to_s.inspect }!=#{ msg_id.to_s.inspect }"
|
71
|
+
|
72
|
+
$logger.fatal msg
|
73
|
+
|
74
|
+
$logger.fatal @msg_body
|
75
|
+
|
76
|
+
raise RuntimeError, msg
|
77
|
+
|
78
|
+
end
|
79
|
+
|
80
|
+
#raise error if error flag
|
81
|
+
if @flag == Comms::ERROR_MSG
|
82
|
+
|
83
|
+
raise MobyBase::ApplicationNotAvailableError, @msg_body if @msg_body =~ /The application with Id \d+ is no longer available/
|
84
|
+
|
85
|
+
raise RuntimeError, @msg_body
|
86
|
+
|
87
|
+
end
|
88
|
+
|
89
|
+
end
|
90
|
+
|
91
|
+
# enable hooking for performance measurement & debug logging
|
92
|
+
TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
|
93
|
+
|
94
|
+
end # QTResponse
|
95
|
+
|
96
|
+
# Message generator for qt tas messages
|
97
|
+
class MessageGenerator
|
98
|
+
|
99
|
+
def self.generate( message_data, message_flag = VALID_MSG )
|
100
|
+
|
101
|
+
MobyController::QT::Comms::QtMessage.new( message_flag, message_data )
|
102
|
+
|
103
|
+
end
|
104
|
+
|
105
|
+
# enable hooking for performance measurement & debug logging
|
106
|
+
TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
|
107
|
+
|
108
|
+
end # MobyController
|
109
|
+
|
110
|
+
class QtMessage
|
111
|
+
|
112
|
+
attr_reader :flag, :data, :compression, :size
|
113
|
+
|
114
|
+
attr_accessor :message_id
|
115
|
+
|
116
|
+
def initialize( message_flag, message_data )
|
117
|
+
|
118
|
+
# message flag
|
119
|
+
@flag = message_flag
|
120
|
+
|
121
|
+
# no compression by default
|
122
|
+
@compression = 1
|
123
|
+
|
124
|
+
@data = message_data
|
125
|
+
|
126
|
+
@size = @data.size
|
127
|
+
|
128
|
+
# calculate crc only when requested
|
129
|
+
@crc = nil
|
130
|
+
|
131
|
+
end
|
132
|
+
|
133
|
+
def crc
|
134
|
+
|
135
|
+
if @crc.nil?
|
136
|
+
|
137
|
+
# calculate outgoing message crc; sent in message header to receiver for data validation
|
138
|
+
@crc = TDriver::Checksum.crc16_ibm( @data )
|
139
|
+
|
140
|
+
else
|
141
|
+
|
142
|
+
@crc
|
143
|
+
|
144
|
+
end
|
145
|
+
|
146
|
+
end
|
147
|
+
|
148
|
+
def make_binary_message( message_id )
|
149
|
+
|
150
|
+
|
151
|
+
[ @flag, @size, crc, @compression, message_id, @data ].pack( 'CISCIa*' )
|
152
|
+
|
153
|
+
end
|
154
|
+
|
155
|
+
def deflate( level = 9 )
|
156
|
+
|
157
|
+
unless @compression == 2
|
158
|
+
|
159
|
+
@compression = 2
|
160
|
+
|
161
|
+
data_size = @data.size
|
162
|
+
|
163
|
+
# qUncompress required the data length at the beginning so append it - the bytes need to be arranged in the below method (see QByteArray::qUncompress)
|
164
|
+
@data = [ ( data_size & 0xff000000 ) >> 24, ( data_size & 0x00ff0000 ) >> 16, ( data_size & 0x0000ff00 ) >> 8, ( data_size & 0x000000ff ), Zlib::Deflate.deflate( @data, level ) ].pack('C4a*')
|
165
|
+
|
166
|
+
# update data size
|
167
|
+
@size = @data.size
|
168
|
+
|
169
|
+
# recalculate crc
|
170
|
+
@crc = nil
|
171
|
+
|
172
|
+
end
|
173
|
+
|
174
|
+
end
|
175
|
+
|
176
|
+
# enable hooking for performance measurement & debug logging
|
177
|
+
TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
|
178
|
+
|
179
|
+
end # QtMessage
|
180
|
+
|
181
|
+
end # Comms
|
182
|
+
|
183
|
+
end # QT
|
184
|
+
|
185
|
+
end # MobyController
|
@@ -0,0 +1,69 @@
|
|
1
|
+
############################################################################
|
2
|
+
##
|
3
|
+
## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
4
|
+
## All rights reserved.
|
5
|
+
## Contact: Nokia Corporation (testabilitydriver@nokia.com)
|
6
|
+
##
|
7
|
+
## This file is part of TDriver.
|
8
|
+
##
|
9
|
+
## If you have questions regarding the use of this file, please contact
|
10
|
+
## Nokia at testabilitydriver@nokia.com .
|
11
|
+
##
|
12
|
+
## This library is free software; you can redistribute it and/or
|
13
|
+
## modify it under the terms of the GNU Lesser General Public
|
14
|
+
## License version 2.1 as published by the Free Software Foundation
|
15
|
+
## and appearing in the file LICENSE.LGPL included in the packaging
|
16
|
+
## of this file.
|
17
|
+
##
|
18
|
+
############################################################################
|
19
|
+
|
20
|
+
module MobyController
|
21
|
+
|
22
|
+
module QT
|
23
|
+
|
24
|
+
module SutController
|
25
|
+
|
26
|
+
def disconnect
|
27
|
+
|
28
|
+
@sut_adapter.disconnect
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
def connect( id )
|
33
|
+
|
34
|
+
@sut_adapter.connect( id )
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
def received_bytes
|
39
|
+
|
40
|
+
@sut_adapter.socket_received_bytes
|
41
|
+
|
42
|
+
end
|
43
|
+
|
44
|
+
def sent_bytes
|
45
|
+
|
46
|
+
@sut_adapter.socket_sent_bytes
|
47
|
+
|
48
|
+
end
|
49
|
+
|
50
|
+
def received_packets
|
51
|
+
|
52
|
+
@sut_adapter.socket_received_packets
|
53
|
+
|
54
|
+
end
|
55
|
+
|
56
|
+
def sent_packets
|
57
|
+
|
58
|
+
@sut_adapter.socket_sent_packets
|
59
|
+
|
60
|
+
end
|
61
|
+
|
62
|
+
# enable hooking for performance measurement & debug logging
|
63
|
+
TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
|
64
|
+
|
65
|
+
end # SutController
|
66
|
+
|
67
|
+
end # QT
|
68
|
+
|
69
|
+
end # MobyController
|
data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/util/find_object_generator.rb
ADDED
@@ -0,0 +1,287 @@
|
|
1
|
+
############################################################################
|
2
|
+
##
|
3
|
+
## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
4
|
+
## All rights reserved.
|
5
|
+
## Contact: Nokia Corporation (testabilitydriver@nokia.com)
|
6
|
+
##
|
7
|
+
## This file is part of TDriver.
|
8
|
+
##
|
9
|
+
## If you have questions regarding the use of this file, please contact
|
10
|
+
## Nokia at testabilitydriver@nokia.com .
|
11
|
+
##
|
12
|
+
## This library is free software; you can redistribute it and/or
|
13
|
+
## modify it under the terms of the GNU Lesser General Public
|
14
|
+
## License version 2.1 as published by the Free Software Foundation
|
15
|
+
## and appearing in the file LICENSE.LGPL included in the packaging
|
16
|
+
## of this file.
|
17
|
+
##
|
18
|
+
############################################################################
|
19
|
+
|
20
|
+
module MobyUtil
|
21
|
+
|
22
|
+
module FindObjectGenerator
|
23
|
+
|
24
|
+
def generate_message
|
25
|
+
|
26
|
+
# get sut paramteres only once, store to local variable
|
27
|
+
sut_parameters = $parameters[ @_sut.id ]
|
28
|
+
|
29
|
+
filter_type = sut_parameters[ :filter_type, 'none' ]
|
30
|
+
|
31
|
+
plugin_timeout = sut_parameters[ :qttas_plugin_timeout, 10000 ].to_i
|
32
|
+
|
33
|
+
if filter_type != 'none'
|
34
|
+
|
35
|
+
filters = {}
|
36
|
+
|
37
|
+
sut_parameters.if_found( :filter_properties ){ | key, value | filters[ 'filterProperties' ] = value }
|
38
|
+
sut_parameters.if_found( :plugin_blacklist ){ | key, value | filters[ 'pluginBlackList' ] = value }
|
39
|
+
sut_parameters.if_found( :plugin_whitelist ){ | key, value | filters[ 'pluginWhiteList' ] = value }
|
40
|
+
sut_parameters.if_found( :use_view_crop ){ | key, value | filters[ 'useViewCrop' ] = value }
|
41
|
+
|
42
|
+
case filter_type
|
43
|
+
|
44
|
+
when 'dynamic'
|
45
|
+
|
46
|
+
value = TDriver::AttributeFilter.filter_string
|
47
|
+
|
48
|
+
filters[ 'attributeWhiteList' ] = value unless value.blank?
|
49
|
+
|
50
|
+
when 'static'
|
51
|
+
|
52
|
+
sut_parameters.if_found( :attribute_blacklist ){ | key, value | filters[ 'attributeBlackList' ] = value }
|
53
|
+
sut_parameters.if_found( :attribute_whitelist ){ | key, value | filters[ 'attributeWhiteList' ] = value }
|
54
|
+
|
55
|
+
end
|
56
|
+
|
57
|
+
else
|
58
|
+
|
59
|
+
filters = {}
|
60
|
+
|
61
|
+
end
|
62
|
+
|
63
|
+
#xml = "<?xml version=\"1.0\"?>"
|
64
|
+
|
65
|
+
xml = "<TasCommands plugin_timeout=\"#{plugin_timeout}\" service=\"findObject\" #{ @_app_details.to_attributes }"
|
66
|
+
|
67
|
+
# pass checksum value if known from previous service request result
|
68
|
+
#unless @_checksum.nil?
|
69
|
+
# xml << " checksum=\"#{ @_checksum.to_s }\" "
|
70
|
+
#end
|
71
|
+
|
72
|
+
unless @_params.empty?
|
73
|
+
|
74
|
+
# TasCommands close
|
75
|
+
xml << '><Target>'
|
76
|
+
|
77
|
+
# temp. objects xml fragment
|
78
|
+
objects = ""
|
79
|
+
|
80
|
+
# collect objects with attributes
|
81
|
+
@_params.reverse_each{ | parameters |
|
82
|
+
|
83
|
+
if parameters == @_params.last
|
84
|
+
|
85
|
+
objects = "<object #{ parameters.to_attributes } />"
|
86
|
+
|
87
|
+
else
|
88
|
+
|
89
|
+
objects = "<object #{ parameters.to_attributes }>#{ objects }</object>"
|
90
|
+
|
91
|
+
end
|
92
|
+
|
93
|
+
}
|
94
|
+
|
95
|
+
# add objects to xml
|
96
|
+
xml << objects
|
97
|
+
|
98
|
+
xml << '<Command name="findObject">'
|
99
|
+
|
100
|
+
filters.each{ | name, value | xml << "<param name=\"#{ name }\" value=\"#{ value }\" />" }
|
101
|
+
|
102
|
+
xml << '</Command></Target></TasCommands>'
|
103
|
+
|
104
|
+
else
|
105
|
+
|
106
|
+
# TasCommands close
|
107
|
+
xml << ' />'
|
108
|
+
|
109
|
+
end
|
110
|
+
|
111
|
+
xml
|
112
|
+
|
113
|
+
end
|
114
|
+
|
115
|
+
=begin
|
116
|
+
def generate_message
|
117
|
+
|
118
|
+
# get sut paramteres only once, store to local variable
|
119
|
+
sut_parameters = $parameters[ @_sut.id ]
|
120
|
+
|
121
|
+
filter_type = sut_parameters[ :filter_type, 'none' ]
|
122
|
+
|
123
|
+
if filter_type != 'none'
|
124
|
+
|
125
|
+
filters = {}
|
126
|
+
value = nil
|
127
|
+
filters[ 'filterProperties' ] = value if ( value = sut_parameters[ :filter_properties, nil ] )
|
128
|
+
filters[ 'pluginBlackList' ] = value if ( value = sut_parameters[ :plugin_blacklist, nil ] )
|
129
|
+
filters[ 'pluginWhiteList' ] = value if ( value = sut_parameters[ :plugin_whitelist, nil ] )
|
130
|
+
|
131
|
+
case filter_type
|
132
|
+
|
133
|
+
when 'dynamic'
|
134
|
+
|
135
|
+
filters[ 'attributeWhiteList' ] = value if ( value = TDriver::AttributeFilter.filter_string )
|
136
|
+
|
137
|
+
when 'static'
|
138
|
+
|
139
|
+
filters[ 'attributeBlackList' ] = value if ( value = sut_parameters[ :attribute_blacklist, nil ] )
|
140
|
+
filters[ 'attributeWhiteList' ] = value if ( value = sut_parameters[ :attribute_whitelist, nil ] )
|
141
|
+
|
142
|
+
end
|
143
|
+
|
144
|
+
else
|
145
|
+
|
146
|
+
filters = {}
|
147
|
+
|
148
|
+
end
|
149
|
+
|
150
|
+
#xml = "<?xml version=\"1.0\"?>"
|
151
|
+
|
152
|
+
xml = "<TasCommands service=\"findObject\" #{ @_app_details.to_attributes }"
|
153
|
+
|
154
|
+
unless @_params.empty?
|
155
|
+
|
156
|
+
# TasCommands close
|
157
|
+
xml << '><Target>'
|
158
|
+
|
159
|
+
# temp. objects xml fragment
|
160
|
+
objects = ""
|
161
|
+
|
162
|
+
# collect objects with attributes
|
163
|
+
@_params.reverse.each_with_index{ | parameters, index |
|
164
|
+
|
165
|
+
if index == 0
|
166
|
+
|
167
|
+
objects = "<object #{ parameters.to_attributes } />"
|
168
|
+
|
169
|
+
else
|
170
|
+
|
171
|
+
objects = "<object #{ parameters.to_attributes }>#{ objects }</object>"
|
172
|
+
|
173
|
+
end
|
174
|
+
|
175
|
+
}
|
176
|
+
|
177
|
+
# add objects to xml
|
178
|
+
xml << objects
|
179
|
+
|
180
|
+
xml << '<Command name="findObject">'
|
181
|
+
|
182
|
+
filters.each{ | name, value | xml << "<param name=\"#{ name }\" value=\"#{ value }\" />" }
|
183
|
+
|
184
|
+
xml << '</Command></Target></TasCommands>'
|
185
|
+
|
186
|
+
else
|
187
|
+
|
188
|
+
# TasCommands close
|
189
|
+
xml << ' />'
|
190
|
+
|
191
|
+
end
|
192
|
+
|
193
|
+
xml
|
194
|
+
|
195
|
+
end
|
196
|
+
=end
|
197
|
+
|
198
|
+
=begin
|
199
|
+
def generate_message
|
200
|
+
|
201
|
+
filter_type = $parameters[ @_sut.id ][ :filter_type, 'none' ]
|
202
|
+
|
203
|
+
filters = make_params if filter_type == 'dynamic'
|
204
|
+
|
205
|
+
builder = Nokogiri::XML::Builder.new do |xml|
|
206
|
+
|
207
|
+
xml.TasCommands( ( @_app_details || {} ).merge( :service => "findObject") ) {
|
208
|
+
|
209
|
+
xml.Target{
|
210
|
+
|
211
|
+
add_objects( xml, @_params )
|
212
|
+
|
213
|
+
xml.Command( :name => 'findObject' ){ filters.collect{ | name, value | xml.param( :name => name, :value => value ) } } if filter_type == 'dynamic'
|
214
|
+
|
215
|
+
} if @_params and @_params.size > 0
|
216
|
+
|
217
|
+
}
|
218
|
+
|
219
|
+
end
|
220
|
+
|
221
|
+
builder.to_xml
|
222
|
+
|
223
|
+
end
|
224
|
+
|
225
|
+
|
226
|
+
private
|
227
|
+
|
228
|
+
def add_objects( builder, params )
|
229
|
+
|
230
|
+
parent = builder.parent
|
231
|
+
|
232
|
+
params.each{| objectParams |
|
233
|
+
|
234
|
+
parent = create_object_node( builder, objectParams, parent )
|
235
|
+
|
236
|
+
}
|
237
|
+
|
238
|
+
end
|
239
|
+
|
240
|
+
def create_object_node( builder, params, parent )
|
241
|
+
|
242
|
+
node = Nokogiri::XML::Node.new( 'object', builder.doc )
|
243
|
+
|
244
|
+
params.keys.each{ | key | node[ key.to_s ] = params[ key ].to_s }
|
245
|
+
|
246
|
+
parent.add_child( node )
|
247
|
+
|
248
|
+
end
|
249
|
+
|
250
|
+
def make_params
|
251
|
+
|
252
|
+
params = {}
|
253
|
+
|
254
|
+
# get sut paramteres only once, store to local variable
|
255
|
+
sut_parameters = $parameters[ @_sut.id ]
|
256
|
+
|
257
|
+
params[ 'filterProperties' ] = $last_parameter if sut_parameters[ :filter_properties, nil ]
|
258
|
+
params[ 'pluginBlackList' ] = $last_parameter if sut_parameters[ :plugin_blacklist, nil ]
|
259
|
+
params[ 'pluginWhiteList' ] = $last_parameter if sut_parameters[ :plugin_whitelist, nil ]
|
260
|
+
|
261
|
+
case sut_parameters[ :filter_type, 'none' ]
|
262
|
+
|
263
|
+
when 'dynamic'
|
264
|
+
|
265
|
+
white_list = TDriver::AttributeFilter.filter_string
|
266
|
+
|
267
|
+
params['attributeWhiteList'] = white_list if white_list
|
268
|
+
|
269
|
+
when 'static'
|
270
|
+
|
271
|
+
params['attributeBlackList'] = $last_parameter if sut_parameters[ :attribute_blacklist, nil ]
|
272
|
+
params['attributeWhiteList'] = $last_parameter if sut_parameters[ :attribute_whitelist, nil ]
|
273
|
+
|
274
|
+
end
|
275
|
+
|
276
|
+
params
|
277
|
+
|
278
|
+
end
|
279
|
+
=end
|
280
|
+
|
281
|
+
# enable hoo./base/test_object/factory.rb:king for performance measurement & debug logging
|
282
|
+
TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
|
283
|
+
|
284
|
+
end
|
285
|
+
|
286
|
+
end
|
287
|
+
|