testability-driver-qt-sut-plugin 0.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/env.rb +26 -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 +156 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/application.rb +318 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/attribute.rb +227 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/behaviour.rb +140 -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/events.rb +165 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/file_transfer.rb +333 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/find.rb +80 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/fixture.rb +178 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/gesture.rb +906 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/infologger.rb +604 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/key_press.rb +152 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/locale_db.rb +151 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/method.rb +85 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/multitouch.rb +455 -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 +124 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/screen_capture.rb +283 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/sut.rb +492 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/synchronization.rb +113 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/treewidgetitemcolumn.rb +93 -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 +230 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/widget.rb +663 -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 +50 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/fixture.rb +45 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/group.rb +48 -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 +170 -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/widget.rb +226 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/application.rb +264 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/configure_command.rb +60 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/find_object.rb +114 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/fixture.rb +67 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/group.rb +52 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/infologger_command.rb +62 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/key_sequence.rb +99 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/screen_capture.rb +54 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/tap.rb +51 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/widget.rb +72 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/plugin.rb +119 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/sut/adapter.rb +225 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/sut/communication.rb +154 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/sut/controller.rb +58 -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/widget.rb +82 -0
- data/lib/testability-driver-qt-sut-plugin.rb +24 -0
- data/xml/behaviour/qt.xml +717 -0
- data/xml/defaults/sut_qt.xml +9 -0
- data/xml/keymap/qt.xml +321 -0
- data/xml/template/qt.xml +124 -0
- metadata +141 -0
|
@@ -0,0 +1,54 @@
|
|
|
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
|
+
|
|
21
|
+
|
|
22
|
+
#require File.expand_path( File.join( File.dirname( __FILE__ ), 'command_data' ) )
|
|
23
|
+
|
|
24
|
+
module MobyCommand
|
|
25
|
+
|
|
26
|
+
class Tap < MobyCommand::CommandData
|
|
27
|
+
|
|
28
|
+
# Constructor to Tap
|
|
29
|
+
# == params
|
|
30
|
+
# text:: (optional) String to be added to text sequence if given.
|
|
31
|
+
# == returns
|
|
32
|
+
# Instance of TypeText
|
|
33
|
+
def initialize( xcoordinate = nil, ycoordinate = nil, time_to_hold = 1, times_to_tap = 1, time_between_taps = 1 )
|
|
34
|
+
# Set status value to nil (not executed)
|
|
35
|
+
@_xcoordinate = xcoordinate
|
|
36
|
+
@_ycoordinate = ycoordinate
|
|
37
|
+
@_time_to_hold = time_to_hold
|
|
38
|
+
@_times_to_tap = times_to_tap
|
|
39
|
+
@_time_between_taps = time_between_taps
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def get_x
|
|
43
|
+
@_xcoordinate
|
|
44
|
+
end
|
|
45
|
+
def get_y
|
|
46
|
+
@_ycoordinate
|
|
47
|
+
end
|
|
48
|
+
def get_hold
|
|
49
|
+
@_time_to_hold
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
end #module
|
|
@@ -0,0 +1,226 @@
|
|
|
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
|
+
|
|
21
|
+
|
|
22
|
+
module MobyCommand
|
|
23
|
+
|
|
24
|
+
class WidgetCommand < MobyCommand::CommandData
|
|
25
|
+
|
|
26
|
+
# Constructs a new CommandParams object. CommandParams stores the details for the commands send
|
|
27
|
+
# to suts that operate using the tasCommand xml format. The controller creates an xml formatted
|
|
28
|
+
# operation request that will be forwarded to the sut being tested.
|
|
29
|
+
# Example:
|
|
30
|
+
# Given params: command_name = MouseClick, params = [button => '1']
|
|
31
|
+
# xml command: <Command name="MouseClick" button="1">
|
|
32
|
+
#
|
|
33
|
+
# == params
|
|
34
|
+
# command_name:: Name of the command to be executed on the device (e.g. MouseClick)
|
|
35
|
+
# params:: A Hash containing the parameters sent to the device as name/value pairs (e.g. button => 1)
|
|
36
|
+
# == returns
|
|
37
|
+
# CommandParams:: New CommandParams object
|
|
38
|
+
# == raises
|
|
39
|
+
# ArgumentError:: When the supplied params are invalid type (initially can be nil)
|
|
40
|
+
def initialize(application_id = nil, object_id = nil, object_type = nil, command_name = nil, params = nil, value=nil, service = nil)
|
|
41
|
+
|
|
42
|
+
@@_valid_types = [ nil, :Standard, :Graphics, :Application, :Action, :Web ]
|
|
43
|
+
|
|
44
|
+
self.application_id(application_id )
|
|
45
|
+
self.object_id( object_id )
|
|
46
|
+
self.object_type( object_type )
|
|
47
|
+
self.command_name( command_name )
|
|
48
|
+
self.command_params( params )
|
|
49
|
+
self.command_value( value )
|
|
50
|
+
self.service( service )
|
|
51
|
+
|
|
52
|
+
@_transitions = true
|
|
53
|
+
|
|
54
|
+
return self
|
|
55
|
+
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def service(service)
|
|
59
|
+
@_service = service
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def get_service
|
|
63
|
+
@_service
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
# Set transition flag on
|
|
67
|
+
# Will cause the events to be
|
|
68
|
+
# done on a delayed mode.
|
|
69
|
+
def transitions_on
|
|
70
|
+
@_transitions = true
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
# Set transition flag off
|
|
74
|
+
# Will cause the events to be
|
|
75
|
+
# done on immediately
|
|
76
|
+
def transitions_off
|
|
77
|
+
@_transitions = false
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
# Return the transition value
|
|
81
|
+
# ==returns
|
|
82
|
+
# bool: true of false
|
|
83
|
+
def get_transitions
|
|
84
|
+
@_transitions
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
# Set true if response is expected from device side after command
|
|
89
|
+
# Has been completed.
|
|
90
|
+
# ==params
|
|
91
|
+
# bool: True if response needed
|
|
92
|
+
def set_require_response(response_required)
|
|
93
|
+
@_response_required = response_required
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
# Returns true if response required after command.
|
|
97
|
+
def require_response?
|
|
98
|
+
@_response_required
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
# Application id of the currently tested application
|
|
102
|
+
# == params
|
|
103
|
+
# id:: Id of the application
|
|
104
|
+
# == returns
|
|
105
|
+
# == raises
|
|
106
|
+
# ArgumentError:: When the supplied id is not of type String
|
|
107
|
+
def application_id(id)
|
|
108
|
+
raise ArgumentError.new( "Application id must be a string." ) unless id == nil or id.kind_of?( String )
|
|
109
|
+
@_application_id = id
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
# Return application id
|
|
113
|
+
# == params
|
|
114
|
+
# == returns
|
|
115
|
+
# String:: Application id of the command
|
|
116
|
+
def get_application_id
|
|
117
|
+
@_application_id
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
# Object id of the target object
|
|
121
|
+
# == params
|
|
122
|
+
# id:: Id of the Object
|
|
123
|
+
# == returns
|
|
124
|
+
# == raises
|
|
125
|
+
# ArgumentError:: When the supplied id is not of type String
|
|
126
|
+
def object_id(id)
|
|
127
|
+
raise ArgumentError.new( "Object id must be a string." ) unless id == nil or id.kind_of?( String )
|
|
128
|
+
@_object_id = id
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
# Return object id
|
|
132
|
+
# == params
|
|
133
|
+
# == returns
|
|
134
|
+
# String:: Object id of the command
|
|
135
|
+
def get_object_id
|
|
136
|
+
@_object_id
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
# Object type of the target object
|
|
140
|
+
# == params
|
|
141
|
+
# type:: type of the Object
|
|
142
|
+
# == returns
|
|
143
|
+
# == raises
|
|
144
|
+
# ArgumentError:: When the supplied type is not :Graphics or :Standard
|
|
145
|
+
def object_type(type)
|
|
146
|
+
raise ArgumentError.new("Given object type '#{type.to_s}' is not valid.") unless @@_valid_types.include?(type)
|
|
147
|
+
@_object_type = type
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
# Return object type
|
|
151
|
+
# == params
|
|
152
|
+
# == returns
|
|
153
|
+
# String:: Object type of the command
|
|
154
|
+
def get_object_type
|
|
155
|
+
@_object_type
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
# Name of the command
|
|
159
|
+
# == params
|
|
160
|
+
# name:: Name of the command to be executed on the device (e.g. MouseClick)
|
|
161
|
+
# == returns
|
|
162
|
+
# == raises
|
|
163
|
+
# ArgumentError:: When the supplied command_name is not of type String
|
|
164
|
+
def command_name(name)
|
|
165
|
+
raise ArgumentError.new( "Command name must be a String." ) unless name == nil or name.kind_of?( String )
|
|
166
|
+
@_command_name = name
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
# Return name of the command
|
|
170
|
+
# == params
|
|
171
|
+
# == returns
|
|
172
|
+
# String:: Name of the command
|
|
173
|
+
def get_command_name
|
|
174
|
+
@_command_name
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
# Command parameters
|
|
178
|
+
# == params
|
|
179
|
+
# params:: A Hash containing the parameters sent to the device as name/value pairs (e.g. button => 1)
|
|
180
|
+
# == returns
|
|
181
|
+
# == raises
|
|
182
|
+
# ArgumentError:: When the supplied params is of type Hash
|
|
183
|
+
def command_params(params)
|
|
184
|
+
raise ArgumentError.new( "The given params must be in a hash (name => value)." ) unless params == nil or params.kind_of?( Hash )
|
|
185
|
+
@_command_params = params
|
|
186
|
+
end
|
|
187
|
+
|
|
188
|
+
# Return params of the command
|
|
189
|
+
# == params
|
|
190
|
+
# == returns
|
|
191
|
+
# Hash:: Command parameter hash
|
|
192
|
+
def get_command_params
|
|
193
|
+
@_command_params
|
|
194
|
+
end
|
|
195
|
+
|
|
196
|
+
# Command value which is passed on to the device as the value of the command.
|
|
197
|
+
# Example: <Command name=TypeText>Text to be written</Command> where the
|
|
198
|
+
# "Text to be written" would be the value String passed as parameter to this method.
|
|
199
|
+
# == params
|
|
200
|
+
# value:: A String that will be passed to the device in the value field in the command xml, or an Array containing data for multiple step commands
|
|
201
|
+
# == returns
|
|
202
|
+
# == raises
|
|
203
|
+
# ArgumentError:: When the supplied params not of type String or Array or nil
|
|
204
|
+
def command_value(value)
|
|
205
|
+
raise ArgumentError.new( "Command value must be a string." ) unless value == nil or value.kind_of?( String ) or value.kind_of? Array
|
|
206
|
+
@_command_value = value
|
|
207
|
+
end
|
|
208
|
+
|
|
209
|
+
# Return command value
|
|
210
|
+
# == params
|
|
211
|
+
# == returns
|
|
212
|
+
# tring or Array:: Command value
|
|
213
|
+
def get_command_value
|
|
214
|
+
@_command_value
|
|
215
|
+
end
|
|
216
|
+
|
|
217
|
+
def set_event_type(event_type)
|
|
218
|
+
@_event_type = event_type
|
|
219
|
+
end
|
|
220
|
+
|
|
221
|
+
def get_event_type
|
|
222
|
+
Kernel::raise "Assert: event_type must be set!" unless @_event_type
|
|
223
|
+
@_event_type
|
|
224
|
+
end
|
|
225
|
+
end
|
|
226
|
+
end
|
data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/application.rb
ADDED
|
@@ -0,0 +1,264 @@
|
|
|
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 Application
|
|
25
|
+
|
|
26
|
+
def set_adapter( adapter )
|
|
27
|
+
|
|
28
|
+
@sut_adapter = adapter
|
|
29
|
+
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# Execute the command).
|
|
33
|
+
# Sends the message to the device using the @sut_adapter (see base class)
|
|
34
|
+
# == params
|
|
35
|
+
# == returns
|
|
36
|
+
# == raises
|
|
37
|
+
# ArgumentError: raised if unsupported command type
|
|
38
|
+
def execute()
|
|
39
|
+
|
|
40
|
+
return_response_crc = false
|
|
41
|
+
|
|
42
|
+
# application ui state
|
|
43
|
+
if @_command == :State
|
|
44
|
+
|
|
45
|
+
command_xml = state_message()
|
|
46
|
+
return_response_crc = true
|
|
47
|
+
|
|
48
|
+
# launch application
|
|
49
|
+
elsif @_command == :Run
|
|
50
|
+
command_xml = run_message()
|
|
51
|
+
|
|
52
|
+
# close
|
|
53
|
+
elsif @_command == :Close
|
|
54
|
+
command_xml = close_message()
|
|
55
|
+
|
|
56
|
+
# close qttas
|
|
57
|
+
elsif @_command == :CloseQttas
|
|
58
|
+
#params = {'uid' => '0'}
|
|
59
|
+
command_xml = make_message({:service => 'closeApplication'},'Close',{'uid' => '0'})
|
|
60
|
+
|
|
61
|
+
# kill application
|
|
62
|
+
elsif @_command == :Kill
|
|
63
|
+
command_xml = make_message({:service => 'closeApplication'},'Kill',{'uid' => @_application_uid})
|
|
64
|
+
|
|
65
|
+
# list application -- raises exception??
|
|
66
|
+
elsif @_command == :List
|
|
67
|
+
Kernel::raise ArgumentError.new( "Unknown command! " + @_command.to_s )
|
|
68
|
+
|
|
69
|
+
# list applications
|
|
70
|
+
elsif @_command == :ListApps
|
|
71
|
+
service_details = {:service => 'listApps', :name => @_application_name, :id => @_application_uid}
|
|
72
|
+
command_xml = make_message(service_details, 'listApps', nil )
|
|
73
|
+
|
|
74
|
+
# list crashed applications
|
|
75
|
+
elsif @_command == :ListCrashedApps
|
|
76
|
+
service_details = {:service => 'listCrashedApps', :name => @_application_name, :id => @_application_uid}
|
|
77
|
+
command_xml = make_message(service_details, 'listCrashedApps', nil )
|
|
78
|
+
|
|
79
|
+
# shell command
|
|
80
|
+
elsif @_command == :Shell
|
|
81
|
+
command_xml = make_message({:service => 'shellCommand'}, 'shellCommand', @_flags, @_application_name)
|
|
82
|
+
|
|
83
|
+
# kill all application started by agent_qt
|
|
84
|
+
elsif @_command == :KillAll
|
|
85
|
+
command_xml = make_message({:service =>'kill'},'Kill', nil)
|
|
86
|
+
|
|
87
|
+
# tap screen
|
|
88
|
+
elsif @_command == :TapScreen
|
|
89
|
+
command_xml = make_message({:service =>'tapScreen'}, 'TapScreen', params)
|
|
90
|
+
|
|
91
|
+
# bring application to foreground
|
|
92
|
+
elsif @_command == :BringToForeground
|
|
93
|
+
command_xml = make_message({:service => 'bringToForeground'},'BringToForeground', {'pid' => @_application_uid})
|
|
94
|
+
|
|
95
|
+
# system info
|
|
96
|
+
elsif @_command == :SystemInfo
|
|
97
|
+
command_xml = make_message({:service => 'systemInfo'}, 'systemInfo', nil)
|
|
98
|
+
|
|
99
|
+
# start process memory logging
|
|
100
|
+
elsif @_command == :ProcessMemLoggingStart
|
|
101
|
+
|
|
102
|
+
parameters = {
|
|
103
|
+
'thread_name' => @_application_name,
|
|
104
|
+
'file_name' => @_flags[ :file_name ],
|
|
105
|
+
'timestamp' => @_flags[ :timestamp ],
|
|
106
|
+
'interval_s' => @_flags[ :interval_s] }
|
|
107
|
+
|
|
108
|
+
command_xml = make_message({:service => 'resourceLogging'}, 'ProcessMemLoggingStart', parameters)
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
# stop process memory logging
|
|
112
|
+
elsif @_command == :ProcessMemLoggingStop
|
|
113
|
+
parameters = {'thread_name' => @_application_name,
|
|
114
|
+
'return_data' => @_flags[ :return_data ]}
|
|
115
|
+
|
|
116
|
+
command_xml = make_message({ :service =>'resourceLogging'}, 'ProcessMemLoggingStop',paremeters)
|
|
117
|
+
|
|
118
|
+
# start CPU load generating
|
|
119
|
+
elsif @_command == :CpuLoadStart
|
|
120
|
+
parameters = {'cpu_load' => @_flags[ :cpu_load ]}
|
|
121
|
+
command_xml = make_message({:service => 'resourceLogging'},'CpuLoadStart',paremeters)
|
|
122
|
+
|
|
123
|
+
# stop CPU load generating
|
|
124
|
+
elsif @_command == :CpuLoadStop
|
|
125
|
+
command_xml = make_message({:service => 'resourceLogging'},'CpuLoadStop', nil)
|
|
126
|
+
|
|
127
|
+
# unknown command
|
|
128
|
+
else
|
|
129
|
+
Kernel::raise ArgumentError.new( "Unknown command! " + @_command.to_s )
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
message = Comms::MessageGenerator.generate( command_xml )
|
|
133
|
+
@sut_adapter.send_service_request( message, return_response_crc ) if message
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
private
|
|
137
|
+
|
|
138
|
+
def make_parametrized_message( service_details, command_name, params, command_params = {} )
|
|
139
|
+
|
|
140
|
+
Nokogiri::XML::Builder.new{
|
|
141
|
+
TasCommands( service_details ) {
|
|
142
|
+
Target( :TasId => "Application" ) {
|
|
143
|
+
Command( ( params || {} ).merge( :name => command_name ) ){
|
|
144
|
+
command_params.collect{ | name, value |
|
|
145
|
+
param( :name => name, :value => value )
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}.to_xml
|
|
151
|
+
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
def make_message( service_details, command_name, params, command_value = nil )
|
|
155
|
+
|
|
156
|
+
Nokogiri::XML::Builder.new{
|
|
157
|
+
TasCommands( service_details ) {
|
|
158
|
+
Target( :TasId => "Application" ) {
|
|
159
|
+
Command( command_value || "", ( params || {} ).merge( :name => command_name ) )
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}.to_xml
|
|
163
|
+
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
def encode_string( source )
|
|
168
|
+
source = source.to_s
|
|
169
|
+
source.gsub!( '&', '&' );
|
|
170
|
+
source.gsub!( '>', '>' );
|
|
171
|
+
source.gsub!( '<', '<' );
|
|
172
|
+
source.gsub!( '"', '"' );
|
|
173
|
+
source.gsub!( '\'', ''' );
|
|
174
|
+
source
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
def make_filters
|
|
178
|
+
|
|
179
|
+
params = {}
|
|
180
|
+
|
|
181
|
+
# get sut paramteres only once, store to local variable
|
|
182
|
+
sut_parameters = MobyUtil::Parameter[ @_sut.id ]
|
|
183
|
+
|
|
184
|
+
params[ 'filterProperties' ] = $last_parameter if sut_parameters[ :filter_properties, nil ]
|
|
185
|
+
params[ 'pluginBlackList' ] = $last_parameter if sut_parameters[ :plugin_blacklist, nil ]
|
|
186
|
+
params[ 'pluginWhiteList' ] = $last_parameter if sut_parameters[ :plugin_whitelist, nil ]
|
|
187
|
+
|
|
188
|
+
case sut_parameters[ :filter_type, 'none' ]
|
|
189
|
+
|
|
190
|
+
when 'dynamic'
|
|
191
|
+
|
|
192
|
+
# updates the filter with the current backtrace file list
|
|
193
|
+
MobyUtil::DynamicAttributeFilter.instance.update_filter( caller( 0 ) )
|
|
194
|
+
|
|
195
|
+
white_list = MobyUtil::DynamicAttributeFilter.instance.filter_string
|
|
196
|
+
params['attributeWhiteList'] = white_list if white_list
|
|
197
|
+
|
|
198
|
+
when 'static'
|
|
199
|
+
|
|
200
|
+
params['attributeBlackList'] = $last_parameter if sut_parameters[ :attribute_blacklist, nil ]
|
|
201
|
+
params['attributeWhiteList'] = $last_parameter if sut_parameters[ :attribute_whitelist, nil ]
|
|
202
|
+
|
|
203
|
+
end
|
|
204
|
+
|
|
205
|
+
params
|
|
206
|
+
|
|
207
|
+
end
|
|
208
|
+
|
|
209
|
+
def state_message
|
|
210
|
+
app_details = { :service => 'uiState', :name => @_application_name, :id => @_application_uid }
|
|
211
|
+
app_details[ :applicationUid ] = @_refresh_args[ :applicationUid ] if @_refresh_args.include?( :applicationUid )
|
|
212
|
+
|
|
213
|
+
case MobyUtil::Parameter[ @_sut.id ][ :filter_type, 'none' ]
|
|
214
|
+
when 'none'
|
|
215
|
+
command_xml = make_message( app_details, 'UiState', @_flags || {} )
|
|
216
|
+
when 'dynamic'
|
|
217
|
+
params = @_flags || {}
|
|
218
|
+
params[ :filtered ] = 'true'
|
|
219
|
+
command_xml = make_parametrized_message( app_details, 'UiState', params, make_filters )
|
|
220
|
+
else
|
|
221
|
+
command_xml = make_parametrized_message( app_details, 'UiState', @_flags || {}, make_filters )
|
|
222
|
+
end
|
|
223
|
+
command_xml
|
|
224
|
+
end
|
|
225
|
+
|
|
226
|
+
def run_message
|
|
227
|
+
#clone to not make changes permanent
|
|
228
|
+
arguments = MobyUtil::Parameter[ @_sut.id ][ :application_start_arguments, "" ].clone
|
|
229
|
+
if @_arguments
|
|
230
|
+
arguments << "," unless arguments.empty?
|
|
231
|
+
arguments << @_arguments
|
|
232
|
+
end
|
|
233
|
+
|
|
234
|
+
parameters = {
|
|
235
|
+
'application_path' => @_application_name,
|
|
236
|
+
'arguments' => arguments,
|
|
237
|
+
'environment' => @_environment,
|
|
238
|
+
'events_to_listen' => @_events_to_listen,
|
|
239
|
+
'signals_to_listen' => @_signals_to_listen,
|
|
240
|
+
'start_command' => @_start_command
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
make_message({:service => 'startApplication'}, 'Run', parameters)
|
|
244
|
+
end
|
|
245
|
+
|
|
246
|
+
def close_message
|
|
247
|
+
sut_id = @_sut.id
|
|
248
|
+
|
|
249
|
+
parameters = {
|
|
250
|
+
'uid' => @_application_uid,
|
|
251
|
+
'kill' => ( @_flags || {} )[ :force_kill ] || MobyUtil::Parameter[ sut_id ][ :application_close_kill ],
|
|
252
|
+
'wait_time' => MobyUtil::Parameter[ sut_id ][ :application_close_wait ]
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
make_message({:service => 'closeApplication', :id => @_application_uid }, 'Close', parameters)
|
|
256
|
+
end
|
|
257
|
+
|
|
258
|
+
# enable hooking for performance measurement & debug logging
|
|
259
|
+
MobyUtil::Hooking.instance.hook_methods( self ) if defined?( MobyUtil::Hooking )
|
|
260
|
+
end #application
|
|
261
|
+
|
|
262
|
+
end # QT
|
|
263
|
+
|
|
264
|
+
end # MobyController
|