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,302 @@
|
|
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 MobyBehaviour
|
21
|
+
|
22
|
+
module QT
|
23
|
+
|
24
|
+
# == description
|
25
|
+
#
|
26
|
+
# == behaviour
|
27
|
+
# QtSettings
|
28
|
+
#
|
29
|
+
# == requires
|
30
|
+
# testability-driver-qt-sut-plugin
|
31
|
+
#
|
32
|
+
# == input_type
|
33
|
+
# *
|
34
|
+
#
|
35
|
+
# == sut_type
|
36
|
+
# QT
|
37
|
+
#
|
38
|
+
# == sut_version
|
39
|
+
# *
|
40
|
+
#
|
41
|
+
# == objects
|
42
|
+
# *
|
43
|
+
#
|
44
|
+
module Settings
|
45
|
+
|
46
|
+
include MobyBehaviour::QT::Behaviour
|
47
|
+
|
48
|
+
|
49
|
+
# == description
|
50
|
+
# Sets the given settings to the settings storage defined in the setting indentifiers.
|
51
|
+
# QSettings documentation will give more information on how the settigns are created
|
52
|
+
# and accessed.
|
53
|
+
#
|
54
|
+
# == arguments
|
55
|
+
# identifiers
|
56
|
+
# Hash
|
57
|
+
# description: Idenfifiers for the settings. See QSettings documentations for details on how
|
58
|
+
# settings are accessed. You can use either direct file name or organization and
|
59
|
+
# application name way to access and edit the settings.
|
60
|
+
# See [link="#identifier_params_table1"]file path access [/link] and
|
61
|
+
# [link="#identifier_params_table2"]registry access [/link] on how
|
62
|
+
# specify the idenfitication details for the settings to be accessed.
|
63
|
+
#
|
64
|
+
# example: File name: {:fileName => '/etc/init/settings.ini', :format => 'Ini'}
|
65
|
+
# Registry: {:organization => 'Tdriver', :application => 'qttasserver'}
|
66
|
+
#
|
67
|
+
# values
|
68
|
+
# Hash
|
69
|
+
# description: Setting values to be edited (key and value)
|
70
|
+
# example: {:setting => 'value'}
|
71
|
+
#
|
72
|
+
# == tables
|
73
|
+
# identifier_params_table1
|
74
|
+
# title: Hash argument when using file path
|
75
|
+
# description: Valid values when using filepath to access settings.
|
76
|
+
# |Key|Description|Example|
|
77
|
+
# |:fileName|Settings file name or path to registry|:fileName => '/etc/init/settings.ini'|
|
78
|
+
# |:format|Settings storage format. Possible values: Ini, Native, Invalid|:format => 'Ini'|
|
79
|
+
#
|
80
|
+
# identifier_params_table2
|
81
|
+
# title: Hash argument when using registry type access to settings
|
82
|
+
# description: Valid values when using registry type way to access settings.
|
83
|
+
# |Key|Description|Example|
|
84
|
+
# |:organization|Organization for the settings|:organization => 'MySoft'|
|
85
|
+
# |:application|Application using the settings|:application => 'MyApp'|
|
86
|
+
# |:format|Settings storage format. Possible values: ini, native, invalid. Defaults to Native if not set.|:format => 'native'|
|
87
|
+
# |:scope|Scope of the settings. User specific or system wide. Possible values: user, system. Defaults to user.|:scope => 'system'|
|
88
|
+
#
|
89
|
+
# == returns
|
90
|
+
# NilClass
|
91
|
+
# description: -
|
92
|
+
# example: -
|
93
|
+
#
|
94
|
+
# == exceptions
|
95
|
+
# ArgumentError
|
96
|
+
# description: In case the given parameters are not valid.
|
97
|
+
#
|
98
|
+
def set_settings(identifiers, values)
|
99
|
+
|
100
|
+
begin
|
101
|
+
raise ArgumentError.new("No values to set") unless values
|
102
|
+
|
103
|
+
params = generate_fixture_params(identifiers, values)
|
104
|
+
|
105
|
+
fixture('setting', 'set', params)
|
106
|
+
|
107
|
+
rescue Exception => e
|
108
|
+
|
109
|
+
$logger.behaviour "FAIL;Failed set settings \"#{identifiers.to_s}\", \"#{values.to_s}\".;set_settings;"
|
110
|
+
raise e
|
111
|
+
|
112
|
+
end
|
113
|
+
|
114
|
+
$logger.behaviour "PASS;Operation set settings executed successfully \"#{identifiers.to_s}\", \"#{values.to_s}\".;set_settings;"
|
115
|
+
|
116
|
+
nil
|
117
|
+
end
|
118
|
+
|
119
|
+
|
120
|
+
# == description
|
121
|
+
# Remove the settings corresponding to the given keys from the settings idenfitied by
|
122
|
+
# the identifiers.
|
123
|
+
#
|
124
|
+
# == arguments
|
125
|
+
# identifiers
|
126
|
+
# Hash
|
127
|
+
# description: Idenfifiers for the settings. See QSettings documentations for details on how
|
128
|
+
# settings are accessed. You can use either direct file name or organization and
|
129
|
+
# application name way to access and edit the settings.
|
130
|
+
# See [link="#identifier_params_table1"]file path access [/link] and
|
131
|
+
# [link="#identifier_params_table2"]registry access [/link] on how
|
132
|
+
# specify the idenfitication details for the settings to be accessed.
|
133
|
+
#
|
134
|
+
# example: File name: {:fileName => '/etc/init/settings.ini', :format => 'Ini'}
|
135
|
+
# Registry: {:organization => 'Tdriver', :application => 'qttasserver'}
|
136
|
+
#
|
137
|
+
# setting_keys
|
138
|
+
# Array
|
139
|
+
# description: Array of settings keys which are to be removed.
|
140
|
+
# example: [setting1, setting2]
|
141
|
+
#
|
142
|
+
# == returns
|
143
|
+
# NilClass
|
144
|
+
# description: -
|
145
|
+
# example: -
|
146
|
+
#
|
147
|
+
# == exceptions
|
148
|
+
# ArgumentError
|
149
|
+
# description: In case the given parameters are not valid.
|
150
|
+
#
|
151
|
+
def remove_settings(identifiers, setting_keys)
|
152
|
+
begin
|
153
|
+
raise ArgumentError.new("No settings to remove") unless setting_keys
|
154
|
+
|
155
|
+
params = generate_fixture_params(identifiers, nil)
|
156
|
+
setting_keys.each{|value| params[value.to_sym] = ''}
|
157
|
+
|
158
|
+
fixture('setting', 'remove', params)
|
159
|
+
|
160
|
+
rescue Exception => e
|
161
|
+
|
162
|
+
$logger.behaviour "FAIL;Failed remove settings \"#{identifiers.to_s}\", \"#{setting_keys.to_s}\".;remove_settings;"
|
163
|
+
raise e
|
164
|
+
|
165
|
+
end
|
166
|
+
|
167
|
+
$logger.behaviour "PASS;Operation remove settings executed successfully \"#{identifiers.to_s}\", \"#{setting_keys.to_s}\".;remove_settings;"
|
168
|
+
|
169
|
+
nil
|
170
|
+
|
171
|
+
end
|
172
|
+
|
173
|
+
# == description
|
174
|
+
# Read the setting values corresponding to the given keys from the settings idenfitied by
|
175
|
+
# the identifiers.
|
176
|
+
#
|
177
|
+
# == arguments
|
178
|
+
# identifiers
|
179
|
+
# Hash
|
180
|
+
# description: Idenfifiers for the settings. See QSettings documentations for details on how
|
181
|
+
# settings are accessed. You can use either direct file name or organization and
|
182
|
+
# application name way to access and edit the settings.
|
183
|
+
# See [link="#identifier_params_table1"]file path access [/link] and
|
184
|
+
# [link="#identifier_params_table2"]registry access [/link] on how
|
185
|
+
# specify the idenfitication details for the settings to be accessed.
|
186
|
+
#
|
187
|
+
# example: File name: {:fileName => '/etc/init/settings.ini', :format => 'Ini'}
|
188
|
+
# Registry: {:organization => 'Tdriver', :application => 'qttasserver'}
|
189
|
+
#
|
190
|
+
# setting_keys
|
191
|
+
# Array
|
192
|
+
# description: Array of settings keys which are to be removed.
|
193
|
+
# example: [setting1, setting2]
|
194
|
+
#
|
195
|
+
# == returns
|
196
|
+
# Hash
|
197
|
+
# description: Hash table with key value pairs for the settings read.
|
198
|
+
# example: {:setting => 'value'}
|
199
|
+
#
|
200
|
+
# == exceptions
|
201
|
+
# ArgumentError
|
202
|
+
# description: In case the given parameters are not valid.
|
203
|
+
#
|
204
|
+
def read_settings(identifiers, setting_keys)
|
205
|
+
hash = nil
|
206
|
+
begin
|
207
|
+
raise ArgumentError.new("No settings to read") unless setting_keys
|
208
|
+
|
209
|
+
params = generate_fixture_params(identifiers, nil)
|
210
|
+
setting_keys.each{|value| params[value.to_sym] = ''}
|
211
|
+
|
212
|
+
result_string =fixture('setting', 'read', params)
|
213
|
+
hash = JSON.parse(result_string)
|
214
|
+
|
215
|
+
rescue Exception => e
|
216
|
+
|
217
|
+
$logger.behaviour "FAIL;Failed read settings \"#{identifiers.to_s}\", \"#{setting_keys.to_s}\".;read_settings;"
|
218
|
+
raise e
|
219
|
+
|
220
|
+
end
|
221
|
+
|
222
|
+
$logger.behaviour "PASS;Operation read settings executed successfully \"#{identifiers.to_s}\", \"#{setting_keys.to_s}\".;read_settings;"
|
223
|
+
|
224
|
+
hash
|
225
|
+
|
226
|
+
end
|
227
|
+
|
228
|
+
# == description
|
229
|
+
# Read the all the setting values from the settings idenfitied by
|
230
|
+
# the identifiers.
|
231
|
+
#
|
232
|
+
# == arguments
|
233
|
+
# identifiers
|
234
|
+
# Hash
|
235
|
+
# description: Idenfifiers for the settings. See QSettings documentations for details on how
|
236
|
+
# settings are accessed. You can use either direct file name or organization and
|
237
|
+
# application name way to access and edit the settings.
|
238
|
+
# See [link="#identifier_params_table1"]file path access [/link] and
|
239
|
+
# [link="#identifier_params_table2"]registry access [/link] on how
|
240
|
+
# specify the idenfitication details for the settings to be accessed.
|
241
|
+
#
|
242
|
+
# example: File name: {:fileName => '/etc/init/settings.ini', :format => 'Ini'}
|
243
|
+
# Registry: {:organization => 'Tdriver', :application => 'qttasserver'}
|
244
|
+
#
|
245
|
+
#
|
246
|
+
# == returns
|
247
|
+
# Hash
|
248
|
+
# description: Hash table with key value pairs for the settings read.
|
249
|
+
# example: {:setting => 'value'}
|
250
|
+
#
|
251
|
+
# == exceptions
|
252
|
+
# ArgumentError
|
253
|
+
# description: In case the given parameters are not valid.
|
254
|
+
#
|
255
|
+
def read_all_settings(identifiers)
|
256
|
+
hash = nil
|
257
|
+
begin
|
258
|
+
|
259
|
+
params = generate_fixture_params(identifiers, nil)
|
260
|
+
result_string =fixture('setting', 'readAll', params)
|
261
|
+
hash = JSON.parse(result_string)
|
262
|
+
|
263
|
+
rescue Exception => e
|
264
|
+
|
265
|
+
$logger.behaviour "FAIL;Failed read all settings \"#{identifiers.to_s}\".;read_all_settings;"
|
266
|
+
raise e
|
267
|
+
|
268
|
+
end
|
269
|
+
|
270
|
+
$logger.behaviour "PASS;Operation read all settings executed successfully \"#{identifiers.to_s}\".;read_all_settings;"
|
271
|
+
|
272
|
+
hash
|
273
|
+
|
274
|
+
end
|
275
|
+
|
276
|
+
private
|
277
|
+
|
278
|
+
def generate_fixture_params(identifiers, params)
|
279
|
+
|
280
|
+
raise ArgumentError.new("No enough information to access settings. Define filename or organization") unless identifiers[:fileName] or identifiers[:organization]
|
281
|
+
raise ArgumentError.new("Cannot define both fileName and organization.") if identifiers[:fileName] and identifiers[:organization]
|
282
|
+
|
283
|
+
fixture_params = Hash.new
|
284
|
+
fixture_params[:settingFileName] = identifiers[:fileName] if identifiers[:fileName]
|
285
|
+
fixture_params[:settingOrganization] = identifiers[:organization] if identifiers[:organization]
|
286
|
+
|
287
|
+
fixture_params[:settingApplication] = identifiers[:application] if identifiers[:application]
|
288
|
+
fixture_params[:settingFormat] = identifiers[:format] if identifiers[:format]
|
289
|
+
fixture_params[:settingScope] = identifiers[:scope] if identifiers[:scope]
|
290
|
+
fixture_params.merge!(params) if params
|
291
|
+
fixture_params
|
292
|
+
end
|
293
|
+
|
294
|
+
# enable hooking for performance measurement & debug logging
|
295
|
+
TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
|
296
|
+
|
297
|
+
|
298
|
+
end # Settings
|
299
|
+
|
300
|
+
end
|
301
|
+
|
302
|
+
end # MobyBase
|
@@ -0,0 +1,840 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
############################################################################
|
3
|
+
##
|
4
|
+
## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
5
|
+
## All rights reserved.
|
6
|
+
## Contact: Nokia Corporation (testabilitydriver@nokia.com)
|
7
|
+
##
|
8
|
+
## This file is part of TDriver.
|
9
|
+
##
|
10
|
+
## If you have questions regarding the use of this file, please contact
|
11
|
+
## Nokia at testabilitydriver@nokia.com .
|
12
|
+
##
|
13
|
+
## This library is free software; you can redistribute it and/or
|
14
|
+
## modify it under the terms of the GNU Lesser General Public
|
15
|
+
## License version 2.1 as published by the Free Software Foundation
|
16
|
+
## and appearing in the file LICENSE.LGPL included in the packaging
|
17
|
+
## of this file.
|
18
|
+
##
|
19
|
+
############################################################################
|
20
|
+
|
21
|
+
# use tdrivers own xml api instead of nokogiri
|
22
|
+
#require 'nokogiri'
|
23
|
+
|
24
|
+
module MobyBehaviour
|
25
|
+
|
26
|
+
module QT
|
27
|
+
|
28
|
+
# == description
|
29
|
+
# Qt SUT specific behaviours
|
30
|
+
#
|
31
|
+
# == behaviour
|
32
|
+
# QtSUT
|
33
|
+
#
|
34
|
+
# == requires
|
35
|
+
# testability-driver-qt-sut-plugin
|
36
|
+
#
|
37
|
+
# == input_type
|
38
|
+
# *
|
39
|
+
#
|
40
|
+
# == sut_type
|
41
|
+
# QT
|
42
|
+
#
|
43
|
+
# == sut_version
|
44
|
+
# *
|
45
|
+
#
|
46
|
+
# == objects
|
47
|
+
# sut
|
48
|
+
#
|
49
|
+
module SUT
|
50
|
+
|
51
|
+
include MobyBehaviour::Behaviour
|
52
|
+
|
53
|
+
@@_event_type_map = { :Mouse => '0', :Touch => '1', :Both => '2' }
|
54
|
+
|
55
|
+
# == description
|
56
|
+
# Kills all of the applications started through the server.
|
57
|
+
# == returns
|
58
|
+
# NilClass
|
59
|
+
# description: -
|
60
|
+
# example: -
|
61
|
+
def kill_started_processes
|
62
|
+
|
63
|
+
# execute the application control service request
|
64
|
+
execute_command( MobyCommand::Application.new( :KillAll ) )
|
65
|
+
nil
|
66
|
+
end
|
67
|
+
|
68
|
+
# == description
|
69
|
+
# Returns XML list of applications running on SUT known to qttasserver
|
70
|
+
# \n
|
71
|
+
# == arguments
|
72
|
+
#
|
73
|
+
# == returns
|
74
|
+
# String
|
75
|
+
# description: tasMessage XML
|
76
|
+
# example: <tasMessage dateTime="2010.10.26 17:01:53.930" version="0.9.1" ><tasInfo id="1" name="Qt4.7.0" type="qt" ><object id="" name="QApplications" type="applications" ></object></tasInfo></tasMessage>
|
77
|
+
#
|
78
|
+
# == exceptions
|
79
|
+
# RuntimeError
|
80
|
+
# description: if getting applications list throws any exception it's converted to RuntimeError with descriptive message
|
81
|
+
def list_apps
|
82
|
+
|
83
|
+
apps = nil
|
84
|
+
|
85
|
+
begin
|
86
|
+
# execute the application control service request
|
87
|
+
apps = execute_command( MobyCommand::Application.new( :ListApps ) )
|
88
|
+
$logger.behaviour "PASS;Successfully listed applications.;#{ id };sut;{};list_apps;"
|
89
|
+
|
90
|
+
rescue Exception => e
|
91
|
+
|
92
|
+
$logger.behaviour "FAIL;Failed to list applications.;#{ id };sut;{};list_apps;"
|
93
|
+
raise RuntimeError, "Unable to list applications: Exception: #{ e.message } (#{ e.class })"
|
94
|
+
|
95
|
+
end
|
96
|
+
|
97
|
+
apps
|
98
|
+
|
99
|
+
end
|
100
|
+
|
101
|
+
# == description
|
102
|
+
# Returns XML list of processes running in the target.
|
103
|
+
# \n
|
104
|
+
# == arguments
|
105
|
+
#
|
106
|
+
# == returns
|
107
|
+
# String
|
108
|
+
# description: tasMessage XML
|
109
|
+
#
|
110
|
+
# == exceptions
|
111
|
+
# RuntimeError
|
112
|
+
# description: if getting applications list throws any exception it's converted to RuntimeError with descriptive message
|
113
|
+
def list_processes
|
114
|
+
|
115
|
+
apps = nil
|
116
|
+
|
117
|
+
begin
|
118
|
+
# execute the application control service request
|
119
|
+
apps = execute_command( MobyCommand::Application.new( :ListRunningProcesses ) )
|
120
|
+
$logger.behaviour "PASS;Successfully listed processes.;#{ id };sut;{};list_processes;"
|
121
|
+
|
122
|
+
rescue Exception => e
|
123
|
+
|
124
|
+
$logger.behaviour "FAIL;Failed to list processes.;#{ id };sut;{};list_processes;"
|
125
|
+
raise RuntimeError.new( "Unable to list processes: Exception: #{ e.message } (#{ e.class })" )
|
126
|
+
|
127
|
+
end
|
128
|
+
|
129
|
+
apps
|
130
|
+
|
131
|
+
end
|
132
|
+
|
133
|
+
|
134
|
+
# == description
|
135
|
+
# Returns XML list of applications and start times for applications started by qttasserver
|
136
|
+
# \n
|
137
|
+
# == arguments
|
138
|
+
#
|
139
|
+
# == returns
|
140
|
+
# String
|
141
|
+
# description: tasMessage XML
|
142
|
+
# example: <tasMessage dateTime="2010.10.26 17:01:53.930" version="0.9.1" ><tasInfo id="1" name="Qt4.7.0" type="qt" ><object id="" name="QApplications" type="applications" ></object></tasInfo></tasMessage>
|
143
|
+
#
|
144
|
+
# == exceptions
|
145
|
+
# RuntimeError
|
146
|
+
# description: if getting applications list throws any exception it's converted to RuntimeError with descriptive message
|
147
|
+
def list_started_apps
|
148
|
+
|
149
|
+
apps = nil
|
150
|
+
|
151
|
+
begin
|
152
|
+
# execute the application control service request
|
153
|
+
apps = execute_command( MobyCommand::Application.new( :ListStartedApps ) )
|
154
|
+
$logger.behaviour "PASS;Successfully listed applications.;#{ id };sut;{};list_started_apps;"
|
155
|
+
|
156
|
+
rescue Exception => e
|
157
|
+
|
158
|
+
$logger.behaviour "FAIL;Failed to list applications.;#{ id };sut;{};list_started_apps;"
|
159
|
+
raise RuntimeError, "Unable to list started applications: Exception: #{ e.message } (#{ e.class })"
|
160
|
+
|
161
|
+
end
|
162
|
+
|
163
|
+
apps
|
164
|
+
|
165
|
+
end
|
166
|
+
|
167
|
+
# == nodoc
|
168
|
+
# NOT SUPPORTED ANYMORE
|
169
|
+
def list_crashed_apps
|
170
|
+
|
171
|
+
raise ArgumentError, 'Behaviour "list_crashed_apps" is no longer supported.'
|
172
|
+
|
173
|
+
end
|
174
|
+
|
175
|
+
# == description
|
176
|
+
# Executes the command in a shell in the target sut. Note that the executable need to be in path or otherwise you need to use full absolute path. No relative paths can be used with this command. If the process started will take more than 4 seconds to exit then you should launch the process in detached mode by adding the parameter hash ":detached => 'true'" to the arguments. By default processes are launched in "synchronus" mode.
|
177
|
+
#
|
178
|
+
# == arguments
|
179
|
+
# command
|
180
|
+
# String
|
181
|
+
# description: String containing the command executable to execute and any arguments it might need. Executable can be used without path if it is in PATH. Otherwise full absolute path is needed. A shell is required for piped commands (UNIX).
|
182
|
+
# example: "ruby script.rb" or 'sh -c "ruby script.rb|grep output'"
|
183
|
+
#
|
184
|
+
# param
|
185
|
+
# Hash
|
186
|
+
# description: Hash with the flags for the command
|
187
|
+
# example: {:wait => 'true', :timeout => 13}
|
188
|
+
#
|
189
|
+
# == tables
|
190
|
+
# execute_shell_command_hash
|
191
|
+
# title: Parameter hash keys
|
192
|
+
# |Key|Description|Default|
|
193
|
+
# |:detached|Hash containing the ':detached' key with 'true' or 'false' strings as value.|false|
|
194
|
+
# |:threaded|If :thread is set true, the command will be run in a background thrad and the command will return the PID of the process. See [link="#QtSUT:shell_command"]shell_command[/link] for information about controlling the command.|false|
|
195
|
+
# |:wait|Execute a threaded command and wait for the command to complete. Return value will contain the output of the command. Use :wait if the shell command execution taks longer than 4 seconds.|false|
|
196
|
+
# |:timeout|Timeout for :wait, in seconds. If timeout is reached, the command will be killed. RunTimeError occurs if timeout is reached.|300|
|
197
|
+
#
|
198
|
+
# == returns
|
199
|
+
# String
|
200
|
+
# description: Output of the command if any
|
201
|
+
# example: "OK"
|
202
|
+
#
|
203
|
+
# == Exceptions
|
204
|
+
# ArgumentError
|
205
|
+
# description: The command argument was not a non empty String.
|
206
|
+
#
|
207
|
+
# ArgumentError
|
208
|
+
# description: The parameters argumet must be a Hash.
|
209
|
+
#
|
210
|
+
# RuntimeError
|
211
|
+
# description: Timeout of %s seconds reached. %s
|
212
|
+
def execute_shell_command(command, param = { :detached => "false"} )
|
213
|
+
|
214
|
+
raise ArgumentError, "The command argument must be a non empty String." unless command.kind_of?( String ) and !command.empty?
|
215
|
+
raise ArgumentError, "The parameters argumet must be a Hash." unless param.kind_of?( Hash )
|
216
|
+
|
217
|
+
if param[:detached].nil?
|
218
|
+
param[:detached] = "false"
|
219
|
+
end
|
220
|
+
|
221
|
+
param[:timeout].nil? ? timeout = 300 : timeout = param[:timeout].to_i
|
222
|
+
|
223
|
+
# Launch the program execution into the background, wait for it to finish.
|
224
|
+
if param[:wait].to_s == "true"
|
225
|
+
param[:threaded] = "true"
|
226
|
+
|
227
|
+
#pid = execute_command( MobyCommand::Application.new( :Shell, command, nil, nil, nil, nil, nil, nil, param ) ).to_i
|
228
|
+
|
229
|
+
pid = execute_command( MobyCommand::Application.new( :Shell, { :application_name => command, :flags => param } ) ).to_i
|
230
|
+
|
231
|
+
data = ""
|
232
|
+
if pid != 0
|
233
|
+
time = Time.new + timeout
|
234
|
+
while true
|
235
|
+
|
236
|
+
obj = shell_command(pid)
|
237
|
+
|
238
|
+
sleep 1
|
239
|
+
|
240
|
+
data += obj['output'].to_s # cast to string in case of output is nil
|
241
|
+
|
242
|
+
if Time.new > time
|
243
|
+
command_params = {:kill => 'true'}
|
244
|
+
command_output = shell_command(pid, command_params)['output']
|
245
|
+
raise RuntimeError, "Timeout of #{timeout.to_s} seconds reached. #{command_output}"
|
246
|
+
elsif obj['status'] == "RUNNING"
|
247
|
+
next
|
248
|
+
else
|
249
|
+
break
|
250
|
+
end
|
251
|
+
|
252
|
+
end
|
253
|
+
end
|
254
|
+
return data
|
255
|
+
end
|
256
|
+
|
257
|
+
#return execute_command( MobyCommand::Application.new( :Shell, command, nil, nil, nil, nil, nil, nil, nil, param ) ).to_s
|
258
|
+
|
259
|
+
return execute_command( MobyCommand::Application.new( :Shell, { :application_name => command, :flags => param } ) ).to_s
|
260
|
+
|
261
|
+
end
|
262
|
+
|
263
|
+
# == description
|
264
|
+
# Control and retrieve data from a command started by [link="#QtSUT:execute_shell_command"]execute_shell_command[/link]. On a running process, the status and produced output is returned. The command will remove all output from the server that has already been retrieved by the testability driver script. If the command status is FINISHED, all information is removed from the server.
|
265
|
+
#
|
266
|
+
# == arguments
|
267
|
+
# pid
|
268
|
+
# Integer
|
269
|
+
# description: Process id of the command returned by the threaded execute_shell_command.
|
270
|
+
# example: 23442
|
271
|
+
#
|
272
|
+
# param
|
273
|
+
# Hash
|
274
|
+
# description: Additional parameters for the command. Currently supported is ":kill", which will kill the process.
|
275
|
+
# example: {:kill => 'true'}
|
276
|
+
#
|
277
|
+
# == tables
|
278
|
+
# shell_command_return_values
|
279
|
+
# title: Shell command return values
|
280
|
+
# |Key|Description|
|
281
|
+
# |status|RUNNING, ERROR, FINISHED|
|
282
|
+
# |output|Command output|
|
283
|
+
# |exitCode|Return code of the command if finished|
|
284
|
+
#
|
285
|
+
# == returns
|
286
|
+
# Hash
|
287
|
+
# description: The return hash will be empty if no pid is found.
|
288
|
+
# example: {:status => 'FINISHED', :output => 'example_output', :exitCode => 0}
|
289
|
+
#
|
290
|
+
# == exceptions
|
291
|
+
# ArgumentError
|
292
|
+
# description: The command argument was not a non empty String
|
293
|
+
#
|
294
|
+
def shell_command( pid, param = {} )
|
295
|
+
|
296
|
+
raise ArgumentError, "pid argument should be positive integer." unless pid.to_i > 0
|
297
|
+
|
298
|
+
param[ :status ] = 'true'
|
299
|
+
|
300
|
+
xml_source = execute_command(
|
301
|
+
MobyCommand::Application.new(
|
302
|
+
:Shell,
|
303
|
+
{
|
304
|
+
:application_name => pid.to_s,
|
305
|
+
:flags => param
|
306
|
+
}
|
307
|
+
)
|
308
|
+
).to_s
|
309
|
+
|
310
|
+
if param[ :kill ].nil?
|
311
|
+
|
312
|
+
|
313
|
+
object_xml_data, unused_rule = @test_object_adapter.get_objects( MobyUtil::XML.parse_string( xml_source ), { :type => 'Response' }, true )
|
314
|
+
|
315
|
+
=begin
|
316
|
+
data = {}
|
317
|
+
|
318
|
+
object_xml_data.collect{ | element |
|
319
|
+
|
320
|
+
data.merge!(
|
321
|
+
|
322
|
+
@test_object_adapter.test_object_attributes( element )
|
323
|
+
|
324
|
+
)
|
325
|
+
|
326
|
+
}
|
327
|
+
=end
|
328
|
+
object_xml_data.inject( {} ){ | result, element |
|
329
|
+
|
330
|
+
result.merge!( @test_object_adapter.test_object_attributes( element ) )
|
331
|
+
|
332
|
+
}
|
333
|
+
|
334
|
+
else
|
335
|
+
|
336
|
+
# Killed processes have no relevant data.
|
337
|
+
{
|
338
|
+
:status => "KILLED",
|
339
|
+
:output => xml_source
|
340
|
+
}
|
341
|
+
|
342
|
+
end
|
343
|
+
|
344
|
+
end
|
345
|
+
|
346
|
+
|
347
|
+
# == description
|
348
|
+
# launches application in symbian device based on UID and return launched application if succesfull.
|
349
|
+
#
|
350
|
+
# == arguments
|
351
|
+
# target_application_hash
|
352
|
+
# Hash
|
353
|
+
# description: Hash defining expected attributes of the application
|
354
|
+
# example: { :UID => '' }
|
355
|
+
#
|
356
|
+
# == returns
|
357
|
+
# MobyBase::Application
|
358
|
+
# description: launched application that matched the uid
|
359
|
+
# example: -
|
360
|
+
#
|
361
|
+
# == exceptions
|
362
|
+
# TypeError
|
363
|
+
# description: Wrong argument type %s for attributes (expected Hash)
|
364
|
+
#
|
365
|
+
def launch_with_uid( target_application_hash = {} )
|
366
|
+
|
367
|
+
begin
|
368
|
+
|
369
|
+
target_application_hash.check_type Hash, 'wrong argument type $1 for application attributes (expected: $2)'
|
370
|
+
|
371
|
+
the_uid = "failed with uid:" + target_application_hash[ :UID ].to_s
|
372
|
+
|
373
|
+
fullname = @sut.fixture( "launch", "launch_with_uid", target_application_hash )
|
374
|
+
|
375
|
+
raise fullname if fullname == the_uid
|
376
|
+
|
377
|
+
full_shortname = fullname.rpartition( '\\' )[ -1 ]
|
378
|
+
|
379
|
+
shortname = full_shortname.rpartition( '.' )[ 0 ]
|
380
|
+
|
381
|
+
app_child = @sut.application( :name => shortname )
|
382
|
+
|
383
|
+
rescue
|
384
|
+
|
385
|
+
$logger.behaviour "FAIL;Failed to find application.;#{ id.to_s };sut;{};application;#{ target_application_hash.inspect }"
|
386
|
+
|
387
|
+
raise
|
388
|
+
|
389
|
+
end
|
390
|
+
|
391
|
+
$logger.behaviour "PASS;Application found.;#{ id.to_s };sut;{};application;#{ target_application_hash.inspect }"
|
392
|
+
|
393
|
+
app_child
|
394
|
+
|
395
|
+
end
|
396
|
+
|
397
|
+
# == description
|
398
|
+
# Returns details about the tested target. The data is platform/device specific which will make your scripts platform dependant. For devices with mobility apis the data available from them is returned and could be somewhat similar across platforms. Memory details are returned in a fixed format so they can be used and still maintain compatibility cross platforms. However it should be noted that platforms which do not support memory details will return -1 (scripts will not break but data will not be usable).
|
399
|
+
# == arguments
|
400
|
+
# == returns
|
401
|
+
# MobyBase::StateObject
|
402
|
+
# description: Similar object to test objects.
|
403
|
+
# example: -
|
404
|
+
# == exceptions
|
405
|
+
def system_information
|
406
|
+
|
407
|
+
# xml_source = execute_command( MobyCommand::Application.new( :SystemInfo, nil) )
|
408
|
+
# @sut.state_object( xml_source )
|
409
|
+
|
410
|
+
@sut.state_object(
|
411
|
+
execute_command(
|
412
|
+
MobyCommand::Application.new( :SystemInfo )
|
413
|
+
)
|
414
|
+
)
|
415
|
+
|
416
|
+
end
|
417
|
+
|
418
|
+
# == description
|
419
|
+
# Returns the memory used by the qttassever in bytes. Note that this will query for the details from the device. If you intend to use all of the memory details see system_information on how to get the details in one query.
|
420
|
+
# == arguments
|
421
|
+
# == returns
|
422
|
+
# Integer
|
423
|
+
# description: Memory usage in bytes, or -1 if there was an error
|
424
|
+
# example: 7376896
|
425
|
+
# == exceptions
|
426
|
+
def agent_mem_usage
|
427
|
+
info = system_information
|
428
|
+
begin
|
429
|
+
info.MemoryStatus.attribute('qttasMemUsage').to_i
|
430
|
+
rescue Exception => e
|
431
|
+
-1
|
432
|
+
end
|
433
|
+
end
|
434
|
+
|
435
|
+
# == description
|
436
|
+
# Returns the total amount of memory in bytes. Note that this will query for the details from the device. If you intend to all of the memory details see system_information on how to get the details in one query.
|
437
|
+
# == arguments
|
438
|
+
# == returns
|
439
|
+
# Integer
|
440
|
+
# description: Amount of total memory, or -1 if there was an error
|
441
|
+
# example: 2147483647
|
442
|
+
# == exceptions
|
443
|
+
def system_total_mem
|
444
|
+
info = system_information
|
445
|
+
begin
|
446
|
+
info.MemoryStatus.attribute('total').to_i
|
447
|
+
rescue Exception => e
|
448
|
+
-1
|
449
|
+
end
|
450
|
+
end
|
451
|
+
|
452
|
+
# == description
|
453
|
+
# Returns the amount of available memory in bytes. Note that this will query for the details from the device. If you intend to use all of the memory details see system_information on how to get the details in one query.
|
454
|
+
# == arguments
|
455
|
+
# == returns
|
456
|
+
# Integer
|
457
|
+
# description: Amount of available memory, or -1 if there was an error
|
458
|
+
# example: 1214980096
|
459
|
+
# == exceptions
|
460
|
+
def system_available_mem
|
461
|
+
info = system_information
|
462
|
+
begin
|
463
|
+
info.MemoryStatus.attribute('available').to_i
|
464
|
+
rescue Exception => e
|
465
|
+
-1
|
466
|
+
end
|
467
|
+
end
|
468
|
+
|
469
|
+
# == description
|
470
|
+
# Taps the SUT screen at the specified coordinates.\n
|
471
|
+
# \n
|
472
|
+
# [b]NOTE:[/b] Method is only implemented in *nix enviroments.
|
473
|
+
#
|
474
|
+
# == arguments
|
475
|
+
# x
|
476
|
+
# Fixnum
|
477
|
+
# description: Target point vertical axis coordinate.
|
478
|
+
# example: 50
|
479
|
+
# y
|
480
|
+
# Fixnum
|
481
|
+
# description: Target point horizontal axis coordinate.
|
482
|
+
# example: 100
|
483
|
+
#
|
484
|
+
# time_to_hold
|
485
|
+
# Float
|
486
|
+
# description: Duration of the tap, in seconds.
|
487
|
+
# example: 0.1
|
488
|
+
#
|
489
|
+
# == returns
|
490
|
+
# NilClass
|
491
|
+
# description: Always returns nil
|
492
|
+
# example: -
|
493
|
+
#
|
494
|
+
def tap_screen( x, y, time_to_hold = 0.1 ) # todo count
|
495
|
+
|
496
|
+
command = MobyCommand::Tap.new(x,y,time_to_hold)
|
497
|
+
|
498
|
+
begin
|
499
|
+
execute_command( command )
|
500
|
+
nil
|
501
|
+
rescue Exception
|
502
|
+
|
503
|
+
$logger.behaviour "FAIL;Failed tap_screen on coords \"#{ x }:#{ y }\";"
|
504
|
+
|
505
|
+
raise
|
506
|
+
|
507
|
+
end
|
508
|
+
|
509
|
+
end
|
510
|
+
|
511
|
+
# == nodoc
|
512
|
+
# == description
|
513
|
+
# Request the qttasserver to shutdown. This command will cause the qttasserver to close. The sut will no longer be usable after this command. To resume testing qttasserver must be restarted.
|
514
|
+
# == returns
|
515
|
+
# NilClass
|
516
|
+
# description: -
|
517
|
+
# example: -
|
518
|
+
# == exceptions
|
519
|
+
# RuntimeError
|
520
|
+
# description: Unable to close qttas: Exception: %s (%s)
|
521
|
+
def close_qttas
|
522
|
+
begin
|
523
|
+
# execute the application control service request
|
524
|
+
execute_command( MobyCommand::Application.new( :CloseQttas ) )
|
525
|
+
$logger.behaviour "PASS;Successfully closed qttas.;#{ id };sut;{};close_qttas;"
|
526
|
+
rescue Exception => e
|
527
|
+
$logger.behaviour "FAIL;Failed to close qttas.;#{ id };sut;{};close_qttas;"
|
528
|
+
raise RuntimeError, "Unable to close qttas: Exception: #{ e.message } (#{ e.class })"
|
529
|
+
end
|
530
|
+
nil
|
531
|
+
end
|
532
|
+
|
533
|
+
# == nodoc
|
534
|
+
# == description
|
535
|
+
# Starts process memory logging. Information about the given application's
|
536
|
+
# heap memory usage will be stored in a file. In addition to application,
|
537
|
+
# used log file can be specified as well as the type of timestamp and
|
538
|
+
# interval length (in seconds).\ŋ
|
539
|
+
# \n
|
540
|
+
# [b]NOTE:[/b] Currently only supported on Symbian platform.
|
541
|
+
#
|
542
|
+
# == arguments
|
543
|
+
# thread_name
|
544
|
+
# String
|
545
|
+
# description: Name of the application process/thread.
|
546
|
+
# example: 'testapp'
|
547
|
+
#
|
548
|
+
# file_name
|
549
|
+
# String
|
550
|
+
# description: Full name (containing path) of the used log file.
|
551
|
+
# example: 'c:\Data\proc_mem.log'
|
552
|
+
#
|
553
|
+
# timestamp_type
|
554
|
+
# String
|
555
|
+
# description: Type of the used timestamp, either "absolute" for
|
556
|
+
# current system time or "relative" or not specified for
|
557
|
+
# relative timestamp from 0 in milliseconds.
|
558
|
+
# example: 'absolute'
|
559
|
+
#
|
560
|
+
# interval_s
|
561
|
+
# Integer
|
562
|
+
# description: Logging interval in seconds.
|
563
|
+
# example: 2
|
564
|
+
#
|
565
|
+
# == returns
|
566
|
+
# String
|
567
|
+
# description: Response message
|
568
|
+
# example: 'OK'
|
569
|
+
#
|
570
|
+
def log_process_mem_start(thread_name, file_name = nil, timestamp_type = nil, interval_s = nil)
|
571
|
+
status = nil
|
572
|
+
begin
|
573
|
+
|
574
|
+
=begin
|
575
|
+
status = execute_command(
|
576
|
+
MobyCommand::Application.new(
|
577
|
+
:ProcessMemLoggingStart,
|
578
|
+
thread_name,
|
579
|
+
nil, nil, nil, nil, nil, nil,
|
580
|
+
{:file_name => file_name, :timestamp => timestamp_type, :interval_s => interval_s} ) )
|
581
|
+
=end
|
582
|
+
|
583
|
+
status = execute_command(
|
584
|
+
MobyCommand::Application.new(
|
585
|
+
:ProcessMemLoggingStart,
|
586
|
+
{ :application_name => thread_name, :flags => { :file_name => file_name, :timestamp => timestamp_type, :interval_s => interval_s } }
|
587
|
+
)
|
588
|
+
)
|
589
|
+
|
590
|
+
$logger.behaviour "PASS;Successfully started process memory logging.;#{ id };sut;{};log_process_mem_start;"
|
591
|
+
|
592
|
+
rescue Exception => e
|
593
|
+
|
594
|
+
$logger.behaviour "FAIL;Failed to start process memory logging.;#{ id };sut;{};log_process_mem_start;"
|
595
|
+
raise RuntimeError, "Unable to start process memory logging: Exception: #{ e.message } (#{ e.class })"
|
596
|
+
|
597
|
+
end
|
598
|
+
|
599
|
+
status
|
600
|
+
|
601
|
+
end
|
602
|
+
|
603
|
+
# == nodoc
|
604
|
+
# == description
|
605
|
+
# Stops process memory logging. Logging of the given application's heap memory usage is stopped. Either the full log file name or the log file
|
606
|
+
# contents will be returned.\n
|
607
|
+
# \n
|
608
|
+
# [b]NOTE:[/b] Currently only supported on Symbian platform.
|
609
|
+
#
|
610
|
+
# == arguments
|
611
|
+
# thread_name
|
612
|
+
# String
|
613
|
+
# description: Name of the application process/thread.
|
614
|
+
# example: 'testapp'
|
615
|
+
#
|
616
|
+
# return_data
|
617
|
+
# String
|
618
|
+
# description: Should the log file data be returned in response message.
|
619
|
+
# If false, only the log file name will be returned.
|
620
|
+
# example: 'true'
|
621
|
+
#
|
622
|
+
# == returns
|
623
|
+
# String
|
624
|
+
# description: Either the full log file name or the log file contents.
|
625
|
+
# example: 'OK'
|
626
|
+
#
|
627
|
+
def log_process_mem_stop(thread_name, return_data = nil)
|
628
|
+
log = nil
|
629
|
+
begin
|
630
|
+
|
631
|
+
log = execute_command(
|
632
|
+
MobyCommand::Application.new(
|
633
|
+
:ProcessMemLoggingStop,
|
634
|
+
{ :application_name => thread_name, :flags => { :return_data => return_data } }
|
635
|
+
)
|
636
|
+
)
|
637
|
+
|
638
|
+
$logger.behaviour "PASS;Successfully stopped process memory logging.;#{ id };sut;{};log_process_mem_stop;"
|
639
|
+
rescue Exception => e
|
640
|
+
$logger.behaviour "FAIL;Failed to stop process memory logging.;#{ id };sut;{};log_process_mem_stop;"
|
641
|
+
raise RuntimeError, "Unable to stop process memory logging: Exception: #{ e.message } (#{ e.class })"
|
642
|
+
end
|
643
|
+
log
|
644
|
+
end
|
645
|
+
|
646
|
+
# == description
|
647
|
+
# Starts generating CPU load. Tries to generate CPU load as accurately as
|
648
|
+
# it can but depending on other activities on the system it might vary. \n
|
649
|
+
# \n
|
650
|
+
# [b]NOTE:[/b] Currently only supported on Symbian platform.
|
651
|
+
#
|
652
|
+
# == arguments
|
653
|
+
# cpu_load
|
654
|
+
# Integer
|
655
|
+
# description: Requested CPU load in percentage.
|
656
|
+
# example: 50
|
657
|
+
#
|
658
|
+
# == returns
|
659
|
+
# NilClass
|
660
|
+
# description: -
|
661
|
+
# example: -
|
662
|
+
#
|
663
|
+
def cpu_load_start( cpu_load )
|
664
|
+
begin
|
665
|
+
|
666
|
+
=begin
|
667
|
+
status = execute_command(
|
668
|
+
MobyCommand::Application.new(
|
669
|
+
:CpuLoadStart,
|
670
|
+
nil, nil, nil, nil, nil, nil, nil,
|
671
|
+
{:cpu_load => cpu_load} ) )
|
672
|
+
=end
|
673
|
+
|
674
|
+
status = execute_command(
|
675
|
+
MobyCommand::Application.new(
|
676
|
+
:CpuLoadStart,
|
677
|
+
{ :flags => { :cpu_load => cpu_load } }
|
678
|
+
)
|
679
|
+
)
|
680
|
+
|
681
|
+
$logger.behaviour "PASS;Successfully started generating CPU load.;#{ id };sut;{};cpu_load_start;"
|
682
|
+
|
683
|
+
rescue Exception => e
|
684
|
+
|
685
|
+
$logger.behaviour "FAIL;Failed to start generating CPU load.;#{ id };sut;{};cpu_load_start;"
|
686
|
+
|
687
|
+
raise RuntimeError, "Unable to start generating CPU load: Exception: #{ e.message } (#{ e.class })"
|
688
|
+
|
689
|
+
end
|
690
|
+
|
691
|
+
end
|
692
|
+
|
693
|
+
# == description
|
694
|
+
# Stops generating CPU load.\n
|
695
|
+
# \n
|
696
|
+
# [b]NOTE:[/b] Currently only supported on Symbian platform.
|
697
|
+
#
|
698
|
+
# == returns
|
699
|
+
# NilClass
|
700
|
+
# description: -
|
701
|
+
# example: -
|
702
|
+
#
|
703
|
+
def cpu_load_stop
|
704
|
+
begin
|
705
|
+
status = execute_command(MobyCommand::Application.new(:CpuLoadStop) )
|
706
|
+
$logger.behaviour "PASS;Successfully started generating CPU load.;#{ id };sut;{};cpu_load_start;"
|
707
|
+
rescue Exception => e
|
708
|
+
$logger.behaviour "FAIL;Failed to start generating CPU load.;#{ id };sut;{};cpu_load_start;"
|
709
|
+
raise RuntimeError, "Unable to start generating CPU load: Exception: #{ e.message } (#{ e.class })"
|
710
|
+
end
|
711
|
+
end
|
712
|
+
|
713
|
+
# == description
|
714
|
+
# Does MemSpy heap dump from the given application. The dump will be
|
715
|
+
# saved in a file, which need to be separately fetched from the device.\n
|
716
|
+
# \n
|
717
|
+
# [b]NOTE:[/b] Only supported on Symbian platform.
|
718
|
+
#
|
719
|
+
# == arguments
|
720
|
+
# thread_name
|
721
|
+
# String
|
722
|
+
# description: Name of the application thread.
|
723
|
+
# example: 'phonebook2'
|
724
|
+
#
|
725
|
+
# == returns
|
726
|
+
# String
|
727
|
+
# description: Response message
|
728
|
+
# example: 'OK'
|
729
|
+
#
|
730
|
+
def dump_heap(thread_name)
|
731
|
+
status = nil
|
732
|
+
begin
|
733
|
+
status = execute_command(MobyCommand::Application.new(
|
734
|
+
:ThreadHeapDump,
|
735
|
+
{:application_name => thread_name}
|
736
|
+
)
|
737
|
+
)
|
738
|
+
$logger.behaviour "PASS;Successfully dumped thread heap.;#{ id };sut;{};dump_heap;"
|
739
|
+
rescue Exception => e
|
740
|
+
$logger.behaviour "FAIL;Failed to dump thread heap.;#{ id };sut;{};dump_heap;"
|
741
|
+
raise RuntimeError, "Unable to dump thread heap: Exception: #{ e.message } (#{ e.class })"
|
742
|
+
end
|
743
|
+
status
|
744
|
+
end
|
745
|
+
|
746
|
+
# == description
|
747
|
+
# Groups behaviours into a single message. Commands are executed in the target in sequence using the given interval as timeout between the commands. The interval is not quaranteed to be exactly the specified amount and will vary depending on the load in the target device. Therefore it is not recommended to use the interval as basis for the test results. The commands are all executed in the target device in a single roundtrip from TDriver to the target device so no verification will or can be done between the commands so do not group behaviours which change the ui in a way that the next command may fail. Best use cases for the grouping is static behaviours such as virtual keyboard button taps. Behaviours can only be qrouped for one application at a time and you need to provide the application object as parameter. Sut behaviours cannot be grouped.
|
748
|
+
# == arguments
|
749
|
+
# interval
|
750
|
+
# Fixnum
|
751
|
+
# description: Inteval time in seconds (0.1 is an acceptable value)
|
752
|
+
# example: 1
|
753
|
+
# app
|
754
|
+
# MobyBase::TestObject
|
755
|
+
# description: The target application for the grouped behaviours
|
756
|
+
# example: -
|
757
|
+
# &block
|
758
|
+
# Proc
|
759
|
+
# description: Code block containing the behaviours to group as one.
|
760
|
+
# example: {app.Object.tap;app.Object_two.tap}
|
761
|
+
# == returns
|
762
|
+
# NilClass
|
763
|
+
# description: -
|
764
|
+
# example: -
|
765
|
+
def group_behaviours( interval, app, &block )
|
766
|
+
begin
|
767
|
+
raise ArgumentError.new("Application must be defined!") unless app
|
768
|
+
raise ArgumentError.new("Interval must be a number.") unless interval.kind_of?(Numeric)
|
769
|
+
|
770
|
+
interval_millis = interval*1000 # to millis
|
771
|
+
|
772
|
+
# make one refresh before execution then freeze
|
773
|
+
find_object_state = parameter[ :use_find_object, false ]
|
774
|
+
parameter[ :use_find_object] = false
|
775
|
+
|
776
|
+
app.force_refresh({:id => get_application_id})
|
777
|
+
freeze
|
778
|
+
|
779
|
+
#disable sleep to avoid unnecessary sleeping
|
780
|
+
parameter[ :sleep_disabled ] = true
|
781
|
+
|
782
|
+
ret = execute_command( MobyCommand::Group.new(interval_millis.to_i, app, block ) )
|
783
|
+
|
784
|
+
parameter[ :sleep_disabled ] = false
|
785
|
+
parameter[ :use_find_object] = find_object_state
|
786
|
+
|
787
|
+
unfreeze
|
788
|
+
|
789
|
+
# the behaviour returns the amout of behaviours
|
790
|
+
# sleep to avoid sending messages to the app until the
|
791
|
+
# commands have been executed
|
792
|
+
sleep ( ret * interval )
|
793
|
+
|
794
|
+
$logger.behaviour "PASS;Successfully executed grouped behaviours.;#{ id };sut;{};group_behaviours;"
|
795
|
+
rescue Exception => e
|
796
|
+
$logger.behaviour "FAIL;Failed to execute grouped behaviours.;#{ id };sut;{};group_behaviours;"
|
797
|
+
raise RuntimeError, "Unable to execute grouped behaviours: Exception: #{ e.message } (#{ e.class })"
|
798
|
+
end
|
799
|
+
nil
|
800
|
+
end
|
801
|
+
|
802
|
+
# == description
|
803
|
+
# Set the event type used to interact with the target. Possible methods are :Mouse, :Touch and :Both.
|
804
|
+
# Event generation depends on this setting. If set to :Mouse or :Touch then only those events are generated.
|
805
|
+
# If set to :Both then both mouse and touch events are sent. In this situation touch events are set as primary.
|
806
|
+
# This setting has no affect when using multitouch.\n\n
|
807
|
+
# [b]NOTE:[/b] If you generate multitouch type events e.g. a.tap_down,
|
808
|
+
# b.tap_down then a.tap_up, b.tap_up you must set the type to :Touch to avoid mouse events to be generated.
|
809
|
+
# == arguments
|
810
|
+
# new_type
|
811
|
+
# Symbol
|
812
|
+
# description: Symbol defining which method to use: :Mouse, :Touch and :Both.
|
813
|
+
# example: :Touch
|
814
|
+
# == returns
|
815
|
+
# NilClass
|
816
|
+
# description: -
|
817
|
+
# example: -
|
818
|
+
# == raises
|
819
|
+
# ArgumentError
|
820
|
+
# description: If invalid type is given.
|
821
|
+
#
|
822
|
+
def set_event_type(new_type)
|
823
|
+
raise ArgumentError.new("Invalid event type. Accepted values :" << @@_event_type_map.keys.join(", :") ) unless @@_event_type_map.include?(new_type)
|
824
|
+
$parameters[ id ][ :event_type] = @@_event_type_map[new_type]
|
825
|
+
nil
|
826
|
+
end
|
827
|
+
|
828
|
+
# == nodoc
|
829
|
+
# {:name => '', id => '', applicationUid => ''},[ {:objectName => '' , :className => , :text =>} ,..]
|
830
|
+
def find_object( app_details = nil, objects = nil, checksum = nil )
|
831
|
+
execute_command( MobyCommand::FindObjectCommand.new( self, app_details, objects, checksum ) )
|
832
|
+
end
|
833
|
+
|
834
|
+
# enable hooking for performance measurement & debug logging
|
835
|
+
TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
|
836
|
+
end
|
837
|
+
|
838
|
+
end
|
839
|
+
|
840
|
+
end
|