testability-driver-qt-sut-plugin 0.9.2 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/application.rb +11 -8
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/configure_behaviour.rb +3 -3
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/events.rb +76 -74
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/find.rb +2 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/fixture.rb +10 -4
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/gesture.rb +49 -42
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/infologger.rb +0 -9
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/locale_db.rb +5 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/record.rb +11 -1
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/sut.rb +441 -324
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/synchronization.rb +32 -11
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/treewidgetitemcolumn.rb +54 -34
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/view_item.rb +26 -26
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/webkit.rb +61 -21
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/widget.rb +528 -344
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/application.rb +16 -138
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/find_object.rb +3 -67
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/fixture.rb +4 -18
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/plugin.rb +1 -1
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/sut/adapter.rb +166 -149
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/sut/communication.rb +80 -75
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/util/find_object_generator.rb +93 -0
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/util/message_composer.rb +161 -0
- data/xml/behaviour/qt.xml +26 -26
- data/xml/template/qt.xml +9 -7
- metadata +7 -6
- data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/fixture.rb +0 -45
data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/infologger.rb
CHANGED
@@ -60,7 +60,6 @@ module MobyBehaviour
|
|
60
60
|
# The file path given must exist on the target.
|
61
61
|
# Optional append parameter can also be given and if true the log file will not be cleared if one exists (by default a new file will always be started).
|
62
62
|
# example: {:interval => 1, :filePath => 'C:\Data', :append => true}
|
63
|
-
# default: No default values, must be set
|
64
63
|
#
|
65
64
|
# == returns
|
66
65
|
# nil
|
@@ -145,7 +144,6 @@ module MobyBehaviour
|
|
145
144
|
# Hash
|
146
145
|
# description: Optional parameters.
|
147
146
|
# example: {:clearLog => true}
|
148
|
-
# default: No default values, must be set
|
149
147
|
#
|
150
148
|
# == returns
|
151
149
|
# Xml
|
@@ -189,7 +187,6 @@ module MobyBehaviour
|
|
189
187
|
# The file path given must exist on the target.
|
190
188
|
# Optional append parameter can also be given and if true the log file will not be cleared if one exists (by default a new file will always be started).
|
191
189
|
# example: {:interval => 1, :filePath => 'C:\Data', :append => true}
|
192
|
-
# default: No default values, must be set
|
193
190
|
#
|
194
191
|
# == returns
|
195
192
|
# nil
|
@@ -269,7 +266,6 @@ module MobyBehaviour
|
|
269
266
|
# Hash
|
270
267
|
# description: Optional parameters.
|
271
268
|
# example: {:clearLog => true}
|
272
|
-
# default: No default values, must be set
|
273
269
|
#
|
274
270
|
# == returns
|
275
271
|
# Xml
|
@@ -313,7 +309,6 @@ module MobyBehaviour
|
|
313
309
|
# The file path given must exist on the target.
|
314
310
|
# Optional append parameter can also be given and if true the log file will not be cleared if one exists (by default a new file will always be started).
|
315
311
|
# example: {:interval => 1, :filePath => 'C:\Data', :append => true}
|
316
|
-
# default: No default values, must be set
|
317
312
|
#
|
318
313
|
# == returns
|
319
314
|
# nil
|
@@ -426,7 +421,6 @@ module MobyBehaviour
|
|
426
421
|
# Hash
|
427
422
|
# description: Optional parameters.
|
428
423
|
# example: {:clearLog => true}
|
429
|
-
# default: No default values, must be set
|
430
424
|
#
|
431
425
|
# == returns
|
432
426
|
# Xml
|
@@ -475,7 +469,6 @@ module MobyBehaviour
|
|
475
469
|
# Hash
|
476
470
|
# description: Optional params hash. If :clearLog => true given will clear the log when loading by default log will not be cleared.
|
477
471
|
# example: {:clearLog = true}
|
478
|
-
# default: nil
|
479
472
|
#
|
480
473
|
#
|
481
474
|
# == returns
|
@@ -504,7 +497,6 @@ module MobyBehaviour
|
|
504
497
|
# Hash
|
505
498
|
# description: Optional params hash. If :clearLog => true given will clear the log when loading by default log will not be cleared.
|
506
499
|
# example: {:clearLog = true}
|
507
|
-
# default: nil
|
508
500
|
#
|
509
501
|
#
|
510
502
|
# == returns
|
@@ -533,7 +525,6 @@ module MobyBehaviour
|
|
533
525
|
# Hash
|
534
526
|
# description: Optional params hash. If :clearLog => true given will clear the log when loading by default log will not be cleared.
|
535
527
|
# example: {:clearLog = true}
|
536
|
-
# default: nil
|
537
528
|
#
|
538
529
|
#
|
539
530
|
# == returns
|
data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/locale_db.rb
CHANGED
@@ -52,6 +52,11 @@ module MobyBehaviour
|
|
52
52
|
# == description
|
53
53
|
# Creates a new localisation able for translation using the tdriver_parameters to locate the Localization DB.
|
54
54
|
# It uses the temporary folder to store temporary translation files.
|
55
|
+
# The table structure will have the different languages as columns and the comun names will be set as the
|
56
|
+
# postfix language code from the source filenames for .qm and .ts files. For .loc files, the two-digit postfix
|
57
|
+
# will be mapped to the same language codes as in .qm or .ts when possible forlowing the mapping table on
|
58
|
+
# symbian reference documentation. To see the full mapping used please check the localization.rb implementation
|
59
|
+
# file on testability-driver gem.
|
55
60
|
#
|
56
61
|
# == arguments
|
57
62
|
# path
|
@@ -46,6 +46,11 @@ module MobyBehaviour
|
|
46
46
|
|
47
47
|
include MobyBehaviour::QT::Behaviour
|
48
48
|
|
49
|
+
# == nodoc
|
50
|
+
# == returns
|
51
|
+
# NilClass
|
52
|
+
# description: -
|
53
|
+
# example: -
|
49
54
|
def start_recording
|
50
55
|
|
51
56
|
begin
|
@@ -67,6 +72,11 @@ module MobyBehaviour
|
|
67
72
|
nil
|
68
73
|
end
|
69
74
|
|
75
|
+
# == nodoc
|
76
|
+
# == returns
|
77
|
+
# NilClass
|
78
|
+
# description: -
|
79
|
+
# example: -
|
70
80
|
def stop_recording
|
71
81
|
|
72
82
|
begin
|
@@ -89,6 +99,7 @@ module MobyBehaviour
|
|
89
99
|
|
90
100
|
end
|
91
101
|
|
102
|
+
# == nodoc
|
92
103
|
def print_recordings
|
93
104
|
|
94
105
|
ret = nil
|
@@ -116,7 +127,6 @@ module MobyBehaviour
|
|
116
127
|
# enable hooking for performance measurement & debug logging
|
117
128
|
MobyUtil::Hooking.instance.hook_methods( self ) if defined?( MobyUtil::Hooking )
|
118
129
|
|
119
|
-
|
120
130
|
end # Record
|
121
131
|
|
122
132
|
end
|
@@ -44,20 +44,24 @@ module MobyBehaviour
|
|
44
44
|
# == objects
|
45
45
|
# sut
|
46
46
|
#
|
47
|
-
|
47
|
+
module SUT
|
48
48
|
|
49
|
-
|
49
|
+
include MobyBehaviour::Behaviour
|
50
50
|
|
51
|
-
|
51
|
+
@@_event_type_map = { :Mouse => '0', :Touch => '1', :Both => '2' }
|
52
52
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
53
|
+
# == description
|
54
|
+
# Kills all of the applications started through the server.
|
55
|
+
# == returns
|
56
|
+
# NilClass
|
57
|
+
# description: -
|
58
|
+
# example: -
|
59
|
+
def kill_started_processes
|
60
|
+
|
61
|
+
# execute the application control service request
|
62
|
+
execute_command( MobyCommand::Application.new( :KillAll ) )
|
63
|
+
nil
|
64
|
+
end
|
61
65
|
|
62
66
|
# == description
|
63
67
|
# Returns XML list of applications running on SUT known to qttasserver
|
@@ -72,227 +76,308 @@ module MobyBehaviour
|
|
72
76
|
# == exceptions
|
73
77
|
# RuntimeError
|
74
78
|
# description: if getting applications list throws any exception it's converted to RuntimeError with descriptive message
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
79
|
+
def list_apps
|
80
|
+
|
81
|
+
apps = nil
|
82
|
+
|
83
|
+
begin
|
84
|
+
# execute the application control service request
|
85
|
+
apps = execute_command( MobyCommand::Application.new( :ListApps ) )
|
86
|
+
MobyUtil::Logger.instance.log "behaviour", "PASS;Successfully listed applications.;#{ id };sut;{};list_apps;"
|
87
|
+
|
88
|
+
rescue Exception => e
|
89
|
+
|
90
|
+
MobyUtil::Logger.instance.log "behaviour", "FAIL;Failed to list applications.;#{ id };sut;{};list_apps;"
|
91
|
+
Kernel::raise RuntimeError.new( "Unable to list applications: Exception: #{ e.message } (#{ e.class })" )
|
92
|
+
|
93
|
+
end
|
94
|
+
|
95
|
+
apps
|
96
|
+
|
97
|
+
end
|
98
|
+
|
99
|
+
# == description
|
100
|
+
# Returns list of crashed applications running on SUT known to qttasserver
|
101
|
+
# == returns
|
102
|
+
# String
|
103
|
+
# description: XML string containing crashed applications, their names, process ids and crash times
|
104
|
+
# example: "<tasMessage dateTime="2010.11.02 14:48:11.056" version="0.9.1" ><tasInfo id="1" name="Qt4.6.2" type="qt" ><object id="" name="QApplications" type="applications" ></object></tasInfo></tasMessage>"
|
105
|
+
def list_crashed_apps
|
106
|
+
|
107
|
+
apps = nil
|
108
|
+
|
109
|
+
begin
|
110
|
+
# execute the application control service request
|
111
|
+
apps = execute_command( MobyCommand::Application.new( :ListCrashedApps ) )
|
112
|
+
MobyUtil::Logger.instance.log "behaviour", "PASS;Successfully listed crashed applications.;#{ id };sut;{};list_crashed_apps;"
|
113
|
+
rescue Exception => e
|
114
|
+
MobyUtil::Logger.instance.log "behaviour", "FAIL;Failed to list crashed applications.;#{ id };sut;{};list_crashed_apps;"
|
115
|
+
Kernel::raise RuntimeError.new( "Unable to list crashed applications: Exception: #{ e.message } (#{ e.class })" )
|
116
|
+
end
|
117
|
+
|
118
|
+
apps
|
119
|
+
end
|
120
|
+
|
121
|
+
# == description
|
122
|
+
# 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.
|
123
|
+
#
|
124
|
+
# == arguments
|
125
|
+
# command
|
126
|
+
# String
|
127
|
+
# 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).
|
128
|
+
# example: "ruby script.rb" or 'sh -c "ruby script.rb|grep output'"
|
129
|
+
#
|
130
|
+
# param
|
131
|
+
# Hash
|
132
|
+
# description: Hash with the flags for the command
|
133
|
+
# example: {:wait => 'true', :timeout => 13}
|
134
|
+
#
|
135
|
+
# == tables
|
136
|
+
# execute_shell_command_hash
|
137
|
+
# title: Parameter hash keys
|
138
|
+
# |Key|Description|Default|
|
139
|
+
# |:detached|Hash containing the ':detached' key with 'true' or 'false' strings as value.|false|
|
140
|
+
# |: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|
|
141
|
+
# |: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|
|
142
|
+
# |:timeout|Timeout for :wait, in seconds. If timeout is reached, the command will be killed. RunTimeError occurs if timeout is reached.|300|
|
143
|
+
#
|
144
|
+
# == returns
|
145
|
+
# String
|
146
|
+
# description: Output of the command if any
|
147
|
+
# example: "OK"
|
148
|
+
#
|
149
|
+
# == Exceptions
|
150
|
+
# ArgumentError
|
151
|
+
# description: The command argument was not a non empty String.
|
152
|
+
#
|
153
|
+
# ArgumentError
|
154
|
+
# description: The parameters argumet must be a Hash.
|
155
|
+
#
|
156
|
+
# RuntimeError
|
157
|
+
# description: Timeout of %s seconds reached. %s
|
158
|
+
def execute_shell_command(command, param = { :detached => "false"} )
|
159
|
+
Kernel::raise ArgumentError.new("The command argument must be a non empty String.") unless ( command.kind_of?( String ) and !command.empty? )
|
160
|
+
Kernel::raise ArgumentError.new("The parameters argumet must be a Hash.") unless ( param.kind_of?(Hash) )
|
161
|
+
|
162
|
+
if param[:detached].nil?
|
163
|
+
param[:detached] = "false"
|
164
|
+
end
|
132
165
|
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
166
|
+
param[:timeout].nil? ? timeout = 300 : timeout = param[:timeout].to_i
|
167
|
+
|
168
|
+
# Launch the program execution into the background, wait for it to finish.
|
169
|
+
if param[:wait].to_s == "true"
|
170
|
+
param[:threaded] = "true"
|
171
|
+
pid = execute_command( MobyCommand::Application.new( :Shell, command, nil, nil, nil, nil, nil, nil, param ) ).to_i
|
172
|
+
data = ""
|
173
|
+
if pid != 0
|
174
|
+
time = Time.new + timeout
|
175
|
+
while true
|
176
|
+
obj = shell_command(pid)
|
177
|
+
sleep 1
|
178
|
+
data += obj['output']
|
179
|
+
if Time.new > time
|
180
|
+
command_params = {:kill => 'true'}
|
181
|
+
command_output = shell_command(pid, command_params)['output']
|
182
|
+
Kernel::raise RuntimeError.new( "Timeout of #{timeout.to_s} seconds reached. #{command_output}")
|
183
|
+
elsif obj['status'] == "RUNNING"
|
184
|
+
next
|
185
|
+
else
|
186
|
+
break
|
187
|
+
end
|
188
|
+
end
|
189
|
+
end
|
190
|
+
return data
|
191
|
+
end
|
192
|
+
|
193
|
+
return execute_command( MobyCommand::Application.new( :Shell, command, nil, nil, nil, nil, nil, nil, param ) ).to_s
|
194
|
+
end
|
195
|
+
|
196
|
+
# == description
|
197
|
+
# 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.
|
198
|
+
#
|
199
|
+
# == arguments
|
200
|
+
# pid
|
201
|
+
# Integer
|
202
|
+
# description: Process id of the command returned by the threaded execute_shell_command.
|
203
|
+
# example: 23442
|
204
|
+
#
|
205
|
+
# param
|
206
|
+
# Hash
|
207
|
+
# description: Additional parameters for the command. Currently supported is ":kill", which will kill the process.
|
208
|
+
# example: {:kill => 'true'}
|
209
|
+
#
|
210
|
+
# == tables
|
211
|
+
# shell_command_return_values
|
212
|
+
# title: Shell command return values
|
213
|
+
# |Key|Description|
|
214
|
+
# |status|RUNNING, ERROR, FINISHED|
|
215
|
+
# |output|Command output|
|
216
|
+
# |exitCode|Return code of the command if finished|
|
217
|
+
#
|
218
|
+
# == returns
|
219
|
+
# Hash
|
220
|
+
# description: The return hash will be empty if no pid is found.
|
221
|
+
# example: {:status => 'FINISHED', :output => 'example_output', :exitCode => 0}
|
222
|
+
#
|
223
|
+
# == exceptions
|
224
|
+
# ArgumentError
|
225
|
+
# description: The command argument was not a non empty String
|
226
|
+
#
|
227
|
+
def shell_command(pid, param = {} )
|
228
|
+
Kernel::raise ArgumentError.new("pid argument should be positive integer.") unless pid.to_i > 0
|
229
|
+
param[ :status ] = 'true'
|
230
|
+
xml_source = execute_command( MobyCommand::Application.new( :Shell, pid.to_s, nil, nil, nil, nil, nil, nil, param ) ).to_s
|
231
|
+
if param[:kill].nil?
|
232
|
+
xml = Nokogiri::XML(xml_source)
|
233
|
+
data = {}
|
234
|
+
xml.xpath("//object[@type = 'Response']/attributes/attribute").each { |attr|
|
235
|
+
data[attr[:name]] = attr.children[0].content
|
236
|
+
}
|
237
|
+
return data
|
238
|
+
else
|
239
|
+
# Killed processes have no relevant data.
|
240
|
+
data = {
|
241
|
+
:status => "KILLED",
|
242
|
+
:output => xml_source
|
243
|
+
}
|
244
|
+
end
|
245
|
+
end
|
246
|
+
|
247
|
+
# == description
|
248
|
+
# 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).
|
249
|
+
# == arguments
|
250
|
+
# == returns
|
251
|
+
# MobyBase::StateObject
|
252
|
+
# description: Similar object to test objects.
|
253
|
+
# example: -
|
254
|
+
# == exceptions
|
255
|
+
def system_information
|
256
|
+
xml_source = execute_command( MobyCommand::Application.new( :SystemInfo, nil) )
|
257
|
+
MobyBase::StateObject.new( xml_source )
|
258
|
+
end
|
259
|
+
|
260
|
+
# == description
|
261
|
+
# 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.
|
262
|
+
# == arguments
|
263
|
+
# == returns
|
264
|
+
# Integer
|
265
|
+
# description: Memory usage in bytes, or -1 if there was an error
|
266
|
+
# example: 7376896
|
267
|
+
# == exceptions
|
268
|
+
def agent_mem_usage
|
269
|
+
info = self.system_information
|
270
|
+
begin
|
271
|
+
info.MemoryStatus.attribute('qttasMemUsage').to_i
|
272
|
+
rescue Exception => e
|
273
|
+
-1
|
274
|
+
end
|
275
|
+
end
|
276
|
+
|
277
|
+
# == description
|
278
|
+
# 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.
|
279
|
+
# == arguments
|
280
|
+
# == returns
|
281
|
+
# Integer
|
282
|
+
# description: Amount of total memory, or -1 if there was an error
|
283
|
+
# example: 2147483647
|
284
|
+
# == exceptions
|
285
|
+
def system_total_mem
|
286
|
+
info = self.system_information
|
287
|
+
begin
|
288
|
+
info.MemoryStatus.attribute('total').to_i
|
289
|
+
rescue Exception => e
|
290
|
+
-1
|
291
|
+
end
|
292
|
+
end
|
293
|
+
|
294
|
+
# == description
|
295
|
+
# 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.
|
296
|
+
# == arguments
|
297
|
+
# == returns
|
298
|
+
# Integer
|
299
|
+
# description: Amount of available memory, or -1 if there was an error
|
300
|
+
# example: 1214980096
|
301
|
+
# == exceptions
|
302
|
+
def system_available_mem
|
303
|
+
info = self.system_information
|
304
|
+
begin
|
305
|
+
info.MemoryStatus.attribute('available').to_i
|
306
|
+
rescue Exception => e
|
307
|
+
-1
|
308
|
+
end
|
309
|
+
end
|
310
|
+
|
311
|
+
# == description
|
312
|
+
# Taps the SUT screen at the specified coordinates.\n
|
313
|
+
# \n
|
314
|
+
# [b]NOTE:[/b] Method is only implemented in *nix enviroments.
|
315
|
+
#
|
316
|
+
# == arguments
|
317
|
+
# x
|
318
|
+
# Fixnum
|
319
|
+
# description: Target point vertical axis coordinate.
|
320
|
+
# example: 50
|
321
|
+
# y
|
322
|
+
# Fixnum
|
323
|
+
# description: Target point horizontal axis coordinate.
|
324
|
+
# example: 100
|
325
|
+
#
|
326
|
+
# time_to_hold
|
327
|
+
# Float
|
328
|
+
# description: Duration of the tap, in seconds.
|
329
|
+
# example: 0.1
|
330
|
+
#
|
331
|
+
# == returns
|
332
|
+
# NilClass
|
333
|
+
# description: Always returns nil
|
334
|
+
# example: -
|
335
|
+
#
|
336
|
+
def tap_screen( x, y, time_to_hold = 0.1 ) # todo count
|
337
|
+
|
338
|
+
command = MobyCommand::Tap.new(x,y,time_to_hold)
|
339
|
+
|
340
|
+
begin
|
341
|
+
execute_command( command )
|
342
|
+
nil
|
343
|
+
rescue Exception => e
|
344
|
+
|
345
|
+
MobyUtil::Logger.instance.log "behaviour" , "FAIL;Failed tap_screen on coords \"#{x}:#{y}\";"
|
346
|
+
Kernel::raise e
|
347
|
+
|
348
|
+
end
|
349
|
+
|
350
|
+
end
|
351
|
+
|
352
|
+
# == nodoc
|
353
|
+
# == description
|
354
|
+
# 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.
|
355
|
+
# == returns
|
356
|
+
# NilClass
|
357
|
+
# description: -
|
358
|
+
# example: -
|
359
|
+
# == exceptions
|
360
|
+
# RuntimeError
|
361
|
+
# description: Unable to close qttas: Exception: %s (%s)
|
362
|
+
def close_qttas
|
363
|
+
begin
|
364
|
+
# execute the application control service request
|
365
|
+
execute_command( MobyCommand::Application.new( :CloseQttas ) )
|
366
|
+
MobyUtil::Logger.instance.log "behaviour", "PASS;Successfully closed qttas.;#{ id };sut;{};close_qttas;"
|
367
|
+
rescue Exception => e
|
368
|
+
MobyUtil::Logger.instance.log "behaviour", "FAIL;Failed to close qttas.;#{ id };sut;{};close_qttas;"
|
369
|
+
Kernel::raise RuntimeError.new( "Unable to close qttas: Exception: #{ e.message } (#{ e.class })" )
|
370
|
+
end
|
371
|
+
nil
|
372
|
+
end
|
288
373
|
|
289
374
|
# == description
|
290
375
|
# Starts process memory logging. Information about the given application's
|
291
376
|
# heap memory usage will be stored in a file. In addition to application,
|
292
377
|
# used log file can be specified as well as the type of timestamp and
|
293
|
-
# interval length (in seconds)
|
294
|
-
#
|
295
|
-
#
|
378
|
+
# interval length (in seconds).\ŋ
|
379
|
+
# \n
|
380
|
+
# [b]NOTE:[/b] Currently only supported on Symbian platform.
|
296
381
|
#
|
297
382
|
# == arguments
|
298
383
|
# thread_name
|
@@ -322,29 +407,28 @@ module MobyBehaviour
|
|
322
407
|
# description: Response message
|
323
408
|
# example: 'OK'
|
324
409
|
#
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
410
|
+
def log_process_mem_start(thread_name, file_name = nil, timestamp_type = nil, interval_s = nil)
|
411
|
+
status = nil
|
412
|
+
begin
|
413
|
+
status = execute_command(
|
414
|
+
MobyCommand::Application.new(
|
415
|
+
:ProcessMemLoggingStart,
|
416
|
+
thread_name,
|
417
|
+
nil, nil, nil, nil, nil, nil,
|
418
|
+
{:file_name => file_name, :timestamp => timestamp_type, :interval_s => interval_s} ) )
|
419
|
+
MobyUtil::Logger.instance.log "behaviour", "PASS;Successfully started process memory logging.;#{ id };sut;{};log_process_mem_start;"
|
420
|
+
rescue Exception => e
|
421
|
+
MobyUtil::Logger.instance.log "behaviour", "FAIL;Failed to start process memory logging.;#{ id };sut;{};log_process_mem_start;"
|
422
|
+
Kernel::raise RuntimeError.new( "Unable to start process memory logging: Exception: #{ e.message } (#{ e.class })" )
|
423
|
+
end
|
424
|
+
status
|
425
|
+
end
|
341
426
|
|
342
427
|
# == description
|
343
|
-
# Stops process memory logging. Logging of the given application's heap
|
344
|
-
#
|
345
|
-
#
|
346
|
-
#
|
347
|
-
# Note! Currently only supported on Symbian platform.
|
428
|
+
# 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
|
429
|
+
# contents will be returned.\n
|
430
|
+
# \n
|
431
|
+
# [b]NOTE:[/b] Currently only supported on Symbian platform.
|
348
432
|
#
|
349
433
|
# == arguments
|
350
434
|
# thread_name
|
@@ -364,27 +448,27 @@ module MobyBehaviour
|
|
364
448
|
# example: 'OK'
|
365
449
|
#
|
366
450
|
def log_process_mem_stop(thread_name, return_data = nil)
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
451
|
+
log = nil
|
452
|
+
begin
|
453
|
+
log = execute_command(
|
454
|
+
MobyCommand::Application.new(
|
455
|
+
:ProcessMemLoggingStop,
|
456
|
+
thread_name,
|
457
|
+
nil, nil, nil, nil, nil, nil,
|
458
|
+
{:return_data => return_data} ) )
|
459
|
+
MobyUtil::Logger.instance.log "behaviour", "PASS;Successfully stopped process memory logging.;#{ id };sut;{};log_process_mem_stop;"
|
460
|
+
rescue Exception => e
|
461
|
+
MobyUtil::Logger.instance.log "behaviour", "FAIL;Failed to stop process memory logging.;#{ id };sut;{};log_process_mem_stop;"
|
462
|
+
Kernel::raise RuntimeError.new( "Unable to stop process memory logging: Exception: #{ e.message } (#{ e.class })" )
|
463
|
+
end
|
464
|
+
log
|
465
|
+
end
|
382
466
|
|
383
467
|
# == description
|
384
468
|
# Starts generating CPU load. Tries to generate CPU load as accurately as
|
385
|
-
# it can but depending on other activities on the system it might vary.
|
386
|
-
#
|
387
|
-
#
|
469
|
+
# it can but depending on other activities on the system it might vary. \n
|
470
|
+
# \n
|
471
|
+
# [b]NOTE:[/b] Currently only supported on Symbian platform.
|
388
472
|
#
|
389
473
|
# == arguments
|
390
474
|
# load
|
@@ -393,17 +477,17 @@ module MobyBehaviour
|
|
393
477
|
# example: 50
|
394
478
|
#
|
395
479
|
# == returns
|
396
|
-
|
397
|
-
|
398
|
-
|
480
|
+
# NilClass
|
481
|
+
# description: -
|
482
|
+
# example: -
|
399
483
|
#
|
400
484
|
def cpu_load_start(load)
|
401
485
|
begin
|
402
486
|
status = execute_command(
|
403
487
|
MobyCommand::Application.new(
|
404
|
-
|
405
|
-
|
406
|
-
|
488
|
+
:CpuLoadStart,
|
489
|
+
nil, nil, nil, nil, nil, nil, nil,
|
490
|
+
{:cpu_load => load} ) )
|
407
491
|
MobyUtil::Logger.instance.log "behaviour", "PASS;Successfully started generating CPU load.;#{ id };sut;{};cpu_load_start;"
|
408
492
|
rescue Exception => e
|
409
493
|
MobyUtil::Logger.instance.log "behaviour", "FAIL;Failed to start generating CPU load.;#{ id };sut;{};cpu_load_start;"
|
@@ -412,14 +496,14 @@ module MobyBehaviour
|
|
412
496
|
end
|
413
497
|
|
414
498
|
# == description
|
415
|
-
# Stops generating CPU load
|
416
|
-
#
|
417
|
-
#
|
499
|
+
# Stops generating CPU load.\n
|
500
|
+
# \n
|
501
|
+
# [b]NOTE:[/b] Currently only supported on Symbian platform.
|
418
502
|
#
|
419
503
|
# == returns
|
420
|
-
|
421
|
-
|
422
|
-
|
504
|
+
# NilClass
|
505
|
+
# description: -
|
506
|
+
# example: -
|
423
507
|
#
|
424
508
|
def cpu_load_stop
|
425
509
|
begin
|
@@ -431,61 +515,94 @@ module MobyBehaviour
|
|
431
515
|
end
|
432
516
|
end
|
433
517
|
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
518
|
+
# == description
|
519
|
+
# 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.
|
520
|
+
# == arguments
|
521
|
+
# interval
|
522
|
+
# Fixnum
|
523
|
+
# description: Inteval time in seconds (0.1 is an acceptable value)
|
524
|
+
# example: 1
|
525
|
+
# app
|
526
|
+
# MobyBase::TestObject
|
527
|
+
# description: The target application for the grouped behaviours
|
528
|
+
# example: -
|
529
|
+
# &block
|
530
|
+
# Proc
|
531
|
+
# description: Code block containing the behaviours to group as one.
|
532
|
+
# example: {app.Object.tap;app.Object_two.tap}
|
533
|
+
# == returns
|
534
|
+
# NilClass
|
535
|
+
# description: -
|
536
|
+
# example: -
|
537
|
+
def group_behaviours( interval, app, &block )
|
538
|
+
begin
|
539
|
+
raise ArgumentError.new("Application must be defined!") unless app
|
540
|
+
raise ArgumentError.new("Interval must be a number.") unless interval.kind_of?(Numeric)
|
541
|
+
|
542
|
+
interval_millis = interval*1000 # to millis
|
543
|
+
|
544
|
+
# make one refresh before execution then freeze
|
545
|
+
app.force_refresh({:id => get_application_id})
|
546
|
+
self.freeze
|
547
|
+
|
548
|
+
#disable sleep to avoid unnecessary sleeping
|
549
|
+
MobyUtil::Parameter[ id ][ :sleep_disabled] = 'true'
|
550
|
+
|
551
|
+
ret = execute_command( MobyCommand::Group.new(interval_millis.to_i, app, block ) )
|
552
|
+
|
553
|
+
MobyUtil::Parameter[ id ][ :sleep_disabled] = 'false'
|
554
|
+
|
555
|
+
self.unfreeze
|
556
|
+
|
557
|
+
# the behaviour returns the amout of behaviours
|
558
|
+
# sleep to avoid sending messages to the app untill the
|
559
|
+
# commands have been executed
|
560
|
+
sleep (ret*interval)
|
561
|
+
|
562
|
+
MobyUtil::Logger.instance.log "behaviour", "PASS;Successfully executed grouped behaviours.;#{ id };sut;{};group_behaviours;"
|
563
|
+
rescue Exception => e
|
564
|
+
MobyUtil::Logger.instance.log "behaviour", "FAIL;Failed to execute grouped behaviours.;#{ id };sut;{};group_behaviours;"
|
565
|
+
Kernel::raise RuntimeError.new( "Unable to execute grouped behaviours: Exception: #{ e.message } (#{ e.class })" )
|
566
|
+
end
|
567
|
+
nil
|
568
|
+
end
|
569
|
+
|
570
|
+
# == description
|
571
|
+
# Set the event type used to interact with the target. Possible methods are :Mouse, :Touch and :Both.
|
572
|
+
# Event generation depends on this setting. If set to :Mouse or :Touch then only those events are generated.
|
573
|
+
# If set to :Both then both mouse and touch events are sent. In this situation touch events are set as primary.
|
574
|
+
# This setting has no affect when using multitouch.\n\n
|
575
|
+
# [b]NOTE:[/b] If you generate multitouch type events e.g. a.tap_down,
|
576
|
+
# b.tap_down then a.tap_up, b.tap_up you must set the type to :Touch to avoid mouse events to be generated.
|
577
|
+
# == arguments
|
578
|
+
# new_type
|
579
|
+
# Symbol
|
580
|
+
# description: Symbol defining which method to use: :Mouse, :Touch and :Both.
|
581
|
+
# example: :Touch
|
582
|
+
# == returns
|
583
|
+
# NilClass
|
584
|
+
# description: -
|
585
|
+
# example: -
|
586
|
+
# == raises
|
587
|
+
# ArgumentError
|
588
|
+
# description: If invalid type is given.
|
589
|
+
#
|
590
|
+
def set_event_type(new_type)
|
591
|
+
raise ArgumentError.new("Invalid event type. Accepted values :" << @@_event_type_map.keys.join(", :") ) unless @@_event_type_map.include?(new_type)
|
592
|
+
MobyUtil::Parameter[ self.id ][ :event_type] = @@_event_type_map[new_type]
|
593
|
+
nil
|
478
594
|
end
|
479
595
|
|
596
|
+
# == nodoc
|
480
597
|
# {:name => '', id => '', applicationUid => ''},[ {:objectName => '' , :className => , :text =>} ,..]
|
481
|
-
def find_object(app_details = nil, objects = nil)
|
482
|
-
|
598
|
+
def find_object( app_details = nil, objects = nil )
|
599
|
+
execute_command( MobyCommand::FindObjectCommand.new( self, app_details, objects ) )
|
483
600
|
end
|
484
601
|
|
485
602
|
# enable hooking for performance measurement & debug logging
|
486
603
|
MobyUtil::Hooking.instance.hook_methods( self ) if defined?( MobyUtil::Hooking )
|
487
604
|
|
488
|
-
|
605
|
+
end
|
489
606
|
|
490
607
|
end
|
491
608
|
|