testability-driver-qt-sut-plugin 1.0.3 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/installer/extconf.rb +1 -1
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/action.rb +5 -5
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/application.rb +174 -236
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/attribute.rb +3 -3
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/behaviour.rb +5 -5
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/configure_behaviour.rb +7 -7
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/events.rb +7 -7
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/file_transfer.rb +1 -1
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/find.rb +3 -3
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/fixture.rb +5 -5
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/gesture.rb +73 -60
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/infologger.rb +3 -3
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/key_press.rb +6 -6
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/locale_db.rb +8 -8
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/method.rb +1 -1
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/multitouch.rb +348 -329
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/os.rb +5 -5
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/qt_api_method.rb +3 -3
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/record.rb +7 -7
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/screen_capture.rb +9 -9
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/sut.rb +79 -27
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/synchronization.rb +3 -3
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/treewidgetitemcolumn.rb +5 -5
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/type_text.rb +3 -3
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/view_item.rb +5 -5
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/webkit.rb +13 -11
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/widget.rb +70 -67
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/qt.rb +1 -1
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/configure_command.rb +1 -1
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/find_object.rb +1 -1
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/fixture.rb +2 -3
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/group.rb +1 -1
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/infologger_command.rb +1 -1
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/key_sequence.rb +3 -3
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/screen_capture.rb +1 -1
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/tap.rb +1 -1
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/widget.rb +30 -14
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/plugin.rb +8 -3
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/sut/adapter.rb +160 -29
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/sut/communication.rb +6 -8
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/sut/controller.rb +13 -2
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/util/find_object_generator.rb +50 -35
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/util/message_composer.rb +129 -95
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/util/widget.rb +4 -4
- data/xml/behaviour/qt.xml +8 -12
- metadata +53 -72
@@ -17,8 +17,6 @@
|
|
17
17
|
##
|
18
18
|
############################################################################
|
19
19
|
|
20
|
-
require 'zlib'
|
21
|
-
|
22
20
|
module MobyController
|
23
21
|
|
24
22
|
module QT
|
@@ -38,7 +36,7 @@ module MobyController
|
|
38
36
|
end
|
39
37
|
|
40
38
|
# enable hooking for performance measurement & debug logging
|
41
|
-
|
39
|
+
TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
|
42
40
|
|
43
41
|
end
|
44
42
|
|
@@ -68,8 +66,8 @@ module MobyController
|
|
68
66
|
#check that response matches the request
|
69
67
|
if @message_id != msg_id
|
70
68
|
|
71
|
-
|
72
|
-
|
69
|
+
$logger.log "fatal" , "Response to request did not match: \"#{@message_id}\"!=\"#{msg_id.to_s}\""
|
70
|
+
$logger.log "fatal" , @msg_body
|
73
71
|
|
74
72
|
Kernel::raise RuntimeError.new("Response to request did not match: \"#{@message_id}\"!=\"#{msg_id.to_s}\"")
|
75
73
|
|
@@ -86,7 +84,7 @@ module MobyController
|
|
86
84
|
end
|
87
85
|
|
88
86
|
# enable hooking for performance measurement & debug logging
|
89
|
-
|
87
|
+
TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
|
90
88
|
|
91
89
|
end #class
|
92
90
|
|
@@ -100,7 +98,7 @@ module MobyController
|
|
100
98
|
end
|
101
99
|
|
102
100
|
# enable hooking for performance measurement & debug logging
|
103
|
-
|
101
|
+
TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
|
104
102
|
|
105
103
|
end
|
106
104
|
|
@@ -149,7 +147,7 @@ module MobyController
|
|
149
147
|
end
|
150
148
|
|
151
149
|
# enable hooking for performance measurement & debug logging
|
152
|
-
|
150
|
+
TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
|
153
151
|
|
154
152
|
end # class
|
155
153
|
|
@@ -47,9 +47,20 @@ module MobyController
|
|
47
47
|
|
48
48
|
end
|
49
49
|
|
50
|
-
|
51
|
-
|
50
|
+
def received_packets
|
51
|
+
|
52
|
+
@sut_adapter.socket_received_packets
|
53
|
+
|
54
|
+
end
|
55
|
+
|
56
|
+
def sent_packets
|
52
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 )
|
53
64
|
|
54
65
|
end # SutController
|
55
66
|
|
data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/util/find_object_generator.rb
CHANGED
@@ -17,51 +17,63 @@
|
|
17
17
|
##
|
18
18
|
############################################################################
|
19
19
|
|
20
|
-
|
21
|
-
|
22
20
|
module MobyUtil
|
23
21
|
|
24
22
|
module FindObjectGenerator
|
25
23
|
|
26
24
|
def generate_message
|
27
|
-
|
28
|
-
|
29
|
-
|
25
|
+
|
26
|
+
filter_type = $parameters[ @_sut.id ][ :filter_type, 'none' ]
|
27
|
+
|
28
|
+
filters = make_params if filter_type == 'dynamic'
|
30
29
|
|
31
30
|
builder = Nokogiri::XML::Builder.new do |xml|
|
32
|
-
|
33
|
-
xml.
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
31
|
+
|
32
|
+
xml.TasCommands( ( @_app_details || {} ).merge( :service => "findObject") ) {
|
33
|
+
|
34
|
+
xml.Target{
|
35
|
+
|
36
|
+
add_objects( xml, @_params )
|
37
|
+
|
38
|
+
xml.Command( :name => 'findObject' ){ filters.collect{ | name, value | xml.param( :name => name, :value => value ) } } if filter_type == 'dynamic'
|
39
|
+
|
40
|
+
} if @_params and @_params.size > 0
|
41
|
+
|
42
|
+
}
|
43
|
+
|
42
44
|
end
|
43
|
-
|
45
|
+
|
46
|
+
builder.to_xml
|
47
|
+
|
44
48
|
end
|
45
49
|
|
46
50
|
private
|
47
51
|
|
48
|
-
def add_objects(builder, params)
|
52
|
+
def add_objects( builder, params )
|
53
|
+
|
49
54
|
parent = builder.parent
|
50
|
-
|
55
|
+
|
56
|
+
params.each{| objectParams | parent = create_object_node( builder, objectParams, parent ) }
|
57
|
+
|
51
58
|
end
|
52
59
|
|
53
|
-
def create_object_node(builder, params, parent)
|
54
|
-
|
55
|
-
|
56
|
-
|
60
|
+
def create_object_node( builder, params, parent )
|
61
|
+
|
62
|
+
node = Nokogiri::XML::Node.new( 'object', builder.doc )
|
63
|
+
|
64
|
+
params.keys.each{ | key | node[ key.to_s ] = params[ key ].to_s }
|
65
|
+
|
66
|
+
parent.add_child( node )
|
67
|
+
|
57
68
|
end
|
58
69
|
|
59
70
|
|
60
71
|
def make_params
|
72
|
+
|
61
73
|
params = {}
|
62
74
|
|
63
75
|
# get sut paramteres only once, store to local variable
|
64
|
-
sut_parameters =
|
76
|
+
sut_parameters = $parameters[ @_sut.id ]
|
65
77
|
|
66
78
|
params[ 'filterProperties' ] = $last_parameter if sut_parameters[ :filter_properties, nil ]
|
67
79
|
params[ 'pluginBlackList' ] = $last_parameter if sut_parameters[ :plugin_blacklist, nil ]
|
@@ -69,25 +81,28 @@ module MobyUtil
|
|
69
81
|
|
70
82
|
case sut_parameters[ :filter_type, 'none' ]
|
71
83
|
|
72
|
-
|
84
|
+
when 'dynamic'
|
73
85
|
|
74
|
-
|
75
|
-
|
86
|
+
# updates the filter with the current backtrace file list
|
87
|
+
#MobyUtil::DynamicAttributeFilter.instance.update_filter( caller( 0 ) )
|
76
88
|
|
77
|
-
|
78
|
-
|
89
|
+
white_list = MobyUtil::DynamicAttributeFilter.instance.filter_string
|
90
|
+
params['attributeWhiteList'] = white_list if white_list
|
79
91
|
|
80
|
-
|
92
|
+
when 'static'
|
81
93
|
|
82
|
-
|
83
|
-
|
94
|
+
params['attributeBlackList'] = $last_parameter if sut_parameters[ :attribute_blacklist, nil ]
|
95
|
+
params['attributeWhiteList'] = $last_parameter if sut_parameters[ :attribute_whitelist, nil ]
|
84
96
|
|
85
|
-
|
97
|
+
end
|
86
98
|
|
87
|
-
|
99
|
+
params
|
88
100
|
|
89
|
-
|
101
|
+
end
|
102
|
+
|
103
|
+
# enable hoo./base/test_object/factory.rb:king for performance measurement & debug logging
|
104
|
+
TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
|
90
105
|
|
91
106
|
end
|
107
|
+
|
92
108
|
end
|
93
|
-
|
data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/util/message_composer.rb
CHANGED
@@ -17,145 +17,179 @@
|
|
17
17
|
##
|
18
18
|
############################################################################
|
19
19
|
|
20
|
-
|
21
|
-
|
22
20
|
module MobyUtil
|
23
21
|
|
24
22
|
module MessageComposer
|
25
23
|
|
26
24
|
def make_parametrized_message( service_details, command_name, params, command_params = {} )
|
27
25
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
26
|
+
Nokogiri::XML::Builder.new{
|
27
|
+
TasCommands( service_details ) {
|
28
|
+
Target( :TasId => "Application" ) {
|
29
|
+
Command( ( params || {} ).merge( :name => command_name ) ){
|
30
|
+
command_params.collect{ | name, value |
|
31
|
+
param( :name => name, :value => value )
|
32
|
+
}
|
33
|
+
}
|
35
34
|
}
|
36
|
-
|
37
|
-
}
|
38
|
-
}.to_xml
|
35
|
+
}
|
36
|
+
}.to_xml
|
39
37
|
|
40
38
|
end
|
41
39
|
|
40
|
+
def hash_to_attributes( hash )
|
41
|
+
|
42
|
+
( hash || {} ).collect{ | value | "#{ value.first }=\"#{ value.last }\"" }.join(" ")
|
43
|
+
|
44
|
+
end
|
45
|
+
|
42
46
|
def make_xml_message( service_details, command_name, params, command_value = nil )
|
43
47
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
48
|
+
=begin
|
49
|
+
|
50
|
+
# create message as string
|
51
|
+
#MobyUtil::MessageComposer::hash_to_attributes 140 0.00405100 0.00405100 0.010% 0.00002894
|
52
|
+
#MobyUtil::MessageComposer::make_xml_message 70 0.00762200 0.00357100 0.009% 0.00010889
|
53
|
+
|
54
|
+
"<TasCommands #{ hash_to_attributes( service_details ) }>" <<
|
55
|
+
"<Target TasId=\"Application\">" <<
|
56
|
+
"<Command name=\"#{ command_name }\" #{ hash_to_attributes( params ) }#{ command_value ? ">#{ command_value }</Command>" : " />" }" <<
|
57
|
+
"</Target>" <<
|
58
|
+
"</TasCommands>"
|
59
|
+
|
60
|
+
# vs.
|
61
|
+
|
62
|
+
# create message using builder
|
63
|
+
#MobyUtil::MessageComposer::make_xml_message 70 0.03611100 0.03611100 0.090% 0.00051587
|
64
|
+
|
65
|
+
# create message
|
66
|
+
MobyUtil::XML.build{
|
67
|
+
TasCommands( service_details ) {
|
68
|
+
Target( :TasId => "Application" ) {
|
69
|
+
Command( command_value || "", ( params || {} ).merge( :name => command_name ) )
|
70
|
+
}
|
71
|
+
}
|
72
|
+
}.to_xml
|
73
|
+
|
74
|
+
=end
|
75
|
+
|
76
|
+
# construct xml message as string; using builder is approx. 67% slower, see statistics above
|
77
|
+
"<TasCommands #{ hash_to_attributes( service_details ) }><Target TasId=\"Application\"><Command name=\"#{ command_name }\" #{ hash_to_attributes( params ) }#{ command_value ? ">#{ command_value }</Command>" : " />" }</Target></TasCommands>"
|
51
78
|
|
52
79
|
end
|
53
80
|
|
54
81
|
def make_fixture_message(fixture_plugin, params)
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
82
|
+
|
83
|
+
Nokogiri::XML::Builder.new{
|
84
|
+
TasCommands( :id => params[:application_id].to_s, :service => "fixture", :async => params[:async].to_s ) {
|
85
|
+
Target( :TasId => params[:object_id].to_s, :type => params[:object_type].to_s ) {
|
86
|
+
Command( :name => "Fixture", :plugin => fixture_plugin, :method => params[:command_name].to_s ) {
|
87
|
+
params[:parameters].collect{ | name, value |
|
88
|
+
param( :name => name, :value => value )
|
89
|
+
}
|
90
|
+
}
|
62
91
|
}
|
63
|
-
|
64
|
-
}
|
65
|
-
}.to_xml
|
92
|
+
}
|
93
|
+
}.to_xml
|
66
94
|
end
|
67
95
|
|
68
96
|
def encode_string( source )
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
97
|
+
source = source.to_s
|
98
|
+
source.gsub!( '&', '&' );
|
99
|
+
source.gsub!( '>', '>' );
|
100
|
+
source.gsub!( '<', '<' );
|
101
|
+
source.gsub!( '"', '"' );
|
102
|
+
source.gsub!( '\'', ''' );
|
103
|
+
source
|
76
104
|
end
|
77
105
|
|
78
106
|
def make_filters
|
79
107
|
|
80
|
-
|
108
|
+
params = {}
|
81
109
|
|
82
|
-
|
83
|
-
|
110
|
+
# get sut paramteres only once, store to local variable
|
111
|
+
sut_parameters = $parameters[ @_sut.id ]
|
84
112
|
|
85
|
-
|
86
|
-
|
87
|
-
|
113
|
+
params[ 'filterProperties' ] = $last_parameter if sut_parameters[ :filter_properties, nil ]
|
114
|
+
params[ 'pluginBlackList' ] = $last_parameter if sut_parameters[ :plugin_blacklist, nil ]
|
115
|
+
params[ 'pluginWhiteList' ] = $last_parameter if sut_parameters[ :plugin_whitelist, nil ]
|
88
116
|
|
89
|
-
|
90
|
-
|
91
|
-
|
117
|
+
case sut_parameters[ :filter_type, 'none' ]
|
118
|
+
|
119
|
+
when 'dynamic'
|
92
120
|
|
93
|
-
|
94
|
-
|
121
|
+
# updates the filter with the current backtrace file list
|
122
|
+
#MobyUtil::DynamicAttributeFilter.instance.update_filter( caller( 0 ) )
|
95
123
|
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
124
|
+
white_list = MobyUtil::DynamicAttributeFilter.instance.filter_string
|
125
|
+
params['attributeWhiteList'] = white_list if white_list
|
126
|
+
|
127
|
+
when 'static'
|
100
128
|
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
129
|
+
params['attributeBlackList'] = $last_parameter if sut_parameters[ :attribute_blacklist, nil ]
|
130
|
+
params['attributeWhiteList'] = $last_parameter if sut_parameters[ :attribute_whitelist, nil ]
|
131
|
+
|
132
|
+
end
|
105
133
|
|
106
|
-
|
134
|
+
params
|
107
135
|
|
108
136
|
end
|
109
137
|
|
110
138
|
def state_message
|
111
|
-
|
112
|
-
|
139
|
+
app_details = { :service => 'uiState', :name => @_application_name, :id => @_application_uid }
|
140
|
+
app_details[ :applicationUid ] = @_refresh_args[ :applicationUid ] if @_refresh_args.include?( :applicationUid )
|
113
141
|
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
142
|
+
case $parameters[ @_sut.id ][ :filter_type, 'none' ]
|
143
|
+
when 'none'
|
144
|
+
command_xml = make_xml_message( app_details, 'UiState', @_flags || {} )
|
145
|
+
when 'dynamic'
|
146
|
+
params = @_flags || {}
|
147
|
+
params[ :filtered ] = 'true'
|
148
|
+
command_xml = make_parametrized_message( app_details, 'UiState', params, make_filters )
|
149
|
+
else
|
150
|
+
command_xml = make_parametrized_message( app_details, 'UiState', @_flags || {}, make_filters )
|
151
|
+
end
|
152
|
+
command_xml
|
125
153
|
end
|
126
154
|
|
127
155
|
def run_message
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
156
|
+
#clone to not make changes permanent
|
157
|
+
arguments = $parameters[ @_sut.id ][ :application_start_arguments, "" ].clone
|
158
|
+
if @_arguments
|
159
|
+
arguments << "," unless arguments.empty?
|
160
|
+
arguments << @_arguments
|
161
|
+
end
|
162
|
+
|
163
|
+
parameters = {
|
164
|
+
'application_path' => @_application_name,
|
165
|
+
'arguments' => arguments,
|
166
|
+
'environment' => @_environment,
|
167
|
+
'events_to_listen' => @_events_to_listen,
|
168
|
+
'signals_to_listen' => @_signals_to_listen,
|
169
|
+
'start_command' => @_start_command
|
170
|
+
}
|
171
|
+
|
172
|
+
make_xml_message({:service => 'startApplication'}, 'Run', parameters)
|
145
173
|
end
|
146
174
|
|
147
175
|
def close_message
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
176
|
+
|
177
|
+
sut_parameters = $parameters[ @_sut.id ]
|
178
|
+
|
179
|
+
parameters = {
|
180
|
+
'uid' => @_application_uid,
|
181
|
+
'kill' => ( @_flags || {} )[ :force_kill ] || sut_parameters[ :application_close_kill ],
|
182
|
+
'wait_time' => sut_parameters[ :application_close_wait ]
|
183
|
+
}
|
155
184
|
|
156
|
-
|
185
|
+
make_xml_message({:service => 'closeApplication', :id => @_application_uid }, 'Close', parameters)
|
157
186
|
end
|
158
|
-
|
187
|
+
|
188
|
+
# enable hoo./base/test_object/factory.rb:king for performance measurement & debug logging
|
189
|
+
TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
|
190
|
+
|
159
191
|
end
|
192
|
+
|
193
|
+
|
160
194
|
end
|
161
195
|
|