testability-driver-qt-sut-plugin 0.9.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. data/env.rb +26 -0
  2. data/installer/extconf.rb +62 -0
  3. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin.rb +23 -0
  4. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/action.rb +156 -0
  5. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/application.rb +318 -0
  6. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/attribute.rb +227 -0
  7. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/behaviour.rb +140 -0
  8. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/configure_behaviour.rb +317 -0
  9. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/events.rb +165 -0
  10. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/file_transfer.rb +333 -0
  11. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/find.rb +80 -0
  12. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/fixture.rb +178 -0
  13. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/gesture.rb +906 -0
  14. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/infologger.rb +604 -0
  15. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/key_press.rb +152 -0
  16. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/locale_db.rb +151 -0
  17. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/method.rb +85 -0
  18. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/multitouch.rb +455 -0
  19. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/os.rb +100 -0
  20. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/qt_api_method.rb +148 -0
  21. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/record.rb +124 -0
  22. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/screen_capture.rb +283 -0
  23. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/sut.rb +492 -0
  24. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/synchronization.rb +113 -0
  25. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/treewidgetitemcolumn.rb +93 -0
  26. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/type_text.rb +97 -0
  27. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/view_item.rb +97 -0
  28. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/webkit.rb +230 -0
  29. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/widget.rb +663 -0
  30. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/action.rb +30 -0
  31. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/configure_command.rb +38 -0
  32. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/drag.rb +44 -0
  33. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/find_object.rb +50 -0
  34. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/fixture.rb +45 -0
  35. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/group.rb +48 -0
  36. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/infologger_command.rb +38 -0
  37. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/qt.rb +170 -0
  38. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/tap.rb +54 -0
  39. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/commands/widget.rb +226 -0
  40. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/application.rb +264 -0
  41. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/configure_command.rb +60 -0
  42. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/find_object.rb +114 -0
  43. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/fixture.rb +67 -0
  44. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/group.rb +52 -0
  45. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/infologger_command.rb +62 -0
  46. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/key_sequence.rb +99 -0
  47. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/screen_capture.rb +54 -0
  48. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/tap.rb +51 -0
  49. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/widget.rb +72 -0
  50. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/plugin.rb +119 -0
  51. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/sut/adapter.rb +225 -0
  52. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/sut/communication.rb +154 -0
  53. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/sut/controller.rb +58 -0
  54. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/util/fixture_parameter.rb +77 -0
  55. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/util/widget.rb +82 -0
  56. data/lib/testability-driver-qt-sut-plugin.rb +24 -0
  57. data/xml/behaviour/qt.xml +717 -0
  58. data/xml/defaults/sut_qt.xml +9 -0
  59. data/xml/keymap/qt.xml +321 -0
  60. data/xml/template/qt.xml +124 -0
  61. metadata +141 -0
@@ -0,0 +1,604 @@
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
+ # This module contains implementation to control info logging for cpu, mem, and gpu
26
+ #
27
+ # == behaviour
28
+ # InfoLogger
29
+ #
30
+ # == requires
31
+ # testability-driver-qt-sut-plugin
32
+ #
33
+ # == input_type
34
+ # *
35
+ #
36
+ # == sut_type
37
+ # qt
38
+ #
39
+ # == sut_version
40
+ # *
41
+ #
42
+ # == objects
43
+ # sut;application
44
+ #
45
+ module InfoLoggerBehaviour
46
+
47
+ include MobyBehaviour::QT::Behaviour
48
+
49
+ # == description
50
+ # Starts logging the cpu usage the application or qttasserver if called for sut. Logging is done to a file in the given intervals (seconds).
51
+ # Small (<1) intervals may cause problems and should be avoided.
52
+ #
53
+ # The default behaviour is that a new log file will be started whenever the logging is started.
54
+ # If you need to save the old results use the append parameter to tell the logger to append the results to the existing file.
55
+ #
56
+ # == arguments
57
+ # params
58
+ # Hash
59
+ # description: Update interval and path for the log file. Interval value is in seconds.
60
+ # The file path given must exist on the target.
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
+ # example: {:interval => 1, :filePath => 'C:\Data', :append => true}
63
+ # default: No default values, must be set
64
+ #
65
+ # == returns
66
+ # nil
67
+ # description: -
68
+ # example: -
69
+ #
70
+ # == exceptions
71
+ # ArgumentError
72
+ # description: For missing / wrong argument types
73
+ #
74
+ # == info
75
+ #
76
+ def log_cpu(params)
77
+ params[:action] = 'start'
78
+ execute_info('cpu', params)
79
+ end
80
+
81
+ # == description
82
+ # Stops the cpu load logging and returns the results and xml data.
83
+ # Will return an error if the logging was not started.
84
+ # The logging is done by writing the values to a log file.
85
+ # When the logging is stopped the file is read and a xml format of the data is returned.
86
+ # The file is removed.\n
87
+ #
88
+ # The data is returned in the same format as the ui state xml. Each log enty contains a timestamp the and cpu load value.\n
89
+ #
90
+ # The top object is of type logData and name cpuLoad. It contains the number of entries. The entries are the child elements of logData element.
91
+ #
92
+ # [code]
93
+ # <object id="0" name="cpuLoad" type="logData" >
94
+ # <attributes>
95
+ # <attribute name="entryCount" >
96
+ # <value>8</value>
97
+ # </attribute>
98
+ # </attributes>
99
+ # <object>
100
+ # [/code]
101
+ #
102
+ # Each logEntry contains a timeStamp (yyyyMMddhhmmsszzz) and cpuLoad (%).\n
103
+ #
104
+ # [code]
105
+ # <object id="0" name="LogEntry" type="logEntry" >
106
+ # <attributes>
107
+ # <attribute name="timeStamp" >
108
+ # <value>20100109184651114</value>
109
+ # </attribute>
110
+ # <attribute name="cpuLoad" >
111
+ # <value>21.8966</value>
112
+ # </attribute>
113
+ # </attributes>
114
+ # </object>
115
+ # [/code]
116
+ #
117
+ # You can use xpath to access the data directly to form any your own reports. Another way is to create a state object out of the data. This way you can access the data as you access ui state objects.
118
+ #
119
+ # [code]
120
+ # # start logging
121
+ # @app.log_cpu( :interval => 1, :filePath => 'C:\Data' )
122
+ #
123
+ # # perform the tests here...
124
+ #
125
+ # # stop logging and get data as state object
126
+ # log_data_object = MobyBase::StateObject.new( @app.stop_cpu_log )
127
+ #
128
+ # # collect values from log_data_object to result array
129
+ # result = ( 0 .. log_data_object.logData.attribute( 'entryCount' ).to_i ).collect do | index |
130
+ #
131
+ # log_data_object.logEntry( :id => index.to_s ).attribute( 'cpuLoad' ).to_i
132
+ #
133
+ # end
134
+ #
135
+ # g = Gruff::Line.new
136
+ # g.title = "Application cpu usage"
137
+ # g.data( "Cpu Usage", result )
138
+ # g.write( "cpu_load.png" )
139
+ # [/code]
140
+ #
141
+ # The example produces a graph which shows the cpu load (values depend on the testing steps, device, platform etc...).
142
+ #
143
+ # == arguments
144
+ # params
145
+ # Hash
146
+ # description: Optional parameters.
147
+ # example: {:clearLog => true}
148
+ # default: No default values, must be set
149
+ #
150
+ # == returns
151
+ # Xml
152
+ # description: data is returned in the same format as the ui state xml
153
+ # example: <object id="0" name="LogEntry" type="logEntry" >
154
+ # <attributes>
155
+ # <attribute name="timeStamp" >
156
+ # <value>20100109184651114</value>
157
+ # </attribute>
158
+ # <attribute name="cpuLoad" >
159
+ # <value>21.8966</value>
160
+ # </attribute>
161
+ # </attributes>
162
+ # </object>
163
+ #
164
+ # == exceptions
165
+ # RuntimeError
166
+ # description: When no data has been colleted
167
+ # ArgumentError
168
+ # description: For missing / wrong argument types
169
+ #
170
+ # == info
171
+ #
172
+ def stop_cpu_log(params={})
173
+ params[:action] = 'stop'
174
+ execute_info('cpu', params)
175
+ end
176
+
177
+ # == description
178
+ # Starts logging the memory usage of the application or sut.
179
+ # Normally this is the heap size used. Logging is done to a file in the given intervals (seconds).
180
+ # Small (<1) intervals may cause problems and should be avoided.
181
+ #
182
+ # The default behaviour is that a new log file will be started whenever the logging is started.
183
+ # If you need to save the old results use the append parameter to tell the logger to append the results to the existing file.
184
+ #
185
+ # == arguments
186
+ # params
187
+ # Hash
188
+ # description: Update interval and path for the log file. Interval value is in seconds.
189
+ # The file path given must exist on the target.
190
+ # 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
+ # example: {:interval => 1, :filePath => 'C:\Data', :append => true}
192
+ # default: No default values, must be set
193
+ #
194
+ # == returns
195
+ # nil
196
+ # description: -
197
+ # example: -
198
+ # == exceptions
199
+ # ArgumentError
200
+ # description: For missing / wrong argument types
201
+ #
202
+ # == info
203
+ #
204
+ def log_mem(params)
205
+ params[:action] = 'start'
206
+ execute_info('mem', params)
207
+ end
208
+
209
+ # == description
210
+ # Stops the memory logging and returns the results and xml data.
211
+ # Will return an error if the logging was not started.
212
+ # The logging is done by writing the values to a log file.
213
+ # When the logging is stopped the file is read and a xml format of the data is returned. The file is removed.
214
+ #
215
+ # The top object is of type logData and name memUsage. It contains the number of entries. The entries are the child elements of logData element.\n
216
+ #
217
+ # [code]
218
+ # <object id="0" name="memUsage" type="logData" >
219
+ # <attributes>
220
+ # <attribute name="entryCount" >
221
+ # <value>8</value>
222
+ # </attribute>
223
+ # </attributes>
224
+ # <object>
225
+ # [/code]
226
+ #
227
+ # Each logEntry contains a timeStamp (yyyyMMddhhmmsszzz) and heapSize.
228
+ #
229
+ # [code]
230
+ # <object id="0" name="LogEntry" type="logEntry" >
231
+ # <attributes>
232
+ # <attribute name="timeStamp" >
233
+ # <value>20100109184651114</value>
234
+ # </attribute>
235
+ # <attribute name="heapSize" >
236
+ # <value>3337448</value>
237
+ # </attribute>
238
+ # </attributes>
239
+ # </object>
240
+ # [/code]
241
+ #
242
+ # You can use xpath to access the data directly to form any your own reports. Another way is to create a state object out of the data. This way you can access the data as you access ui state objects.
243
+ #
244
+ # [code]
245
+ # # start logging
246
+ # @app.log_mem( :interval => 1, :filePath => 'C:\Data' )
247
+ #
248
+ # # perform the tests here...
249
+ #
250
+ # # stop logging and get data as state object
251
+ # log_data_object = MobyBase::StateObject.new( @app.stop_mem_log )
252
+ #
253
+ # # collect values from log_data_object to result array
254
+ # result = ( 0 .. log_data_object.logData.attribute( 'entryCount' ).to_i ).collect do | index |
255
+ #
256
+ # log_data_object.logEntry( :id => index.to_s ).attribute( 'heapSize' ).to_i
257
+ #
258
+ # end
259
+ #
260
+ # g = Gruff::Line.new
261
+ # g.title = "Application memory usage"
262
+ # g.data( "Memory Usage", result )
263
+ # g.write( "info_mem_load.png" )
264
+ # [/code]
265
+ # Above example produces a graph which shows the memory usage (values depend on the testing steps, device, platform etc...).
266
+ #
267
+ # == arguments
268
+ # params
269
+ # Hash
270
+ # description: Optional parameters.
271
+ # example: {:clearLog => true}
272
+ # default: No default values, must be set
273
+ #
274
+ # == returns
275
+ # Xml
276
+ # description: data is returned in the same format as the ui state xml
277
+ # example: <object id="0" name="LogEntry" type="logEntry" >
278
+ # <attributes>
279
+ # <attribute name="timeStamp" >
280
+ # <value>20100109184651114</value>
281
+ # </attribute>
282
+ # <attribute name="heapSize" >
283
+ # <value>3337448</value>
284
+ # </attribute>
285
+ # </attributes>
286
+ # </object>
287
+ #
288
+ # == exceptions
289
+ # RuntimeError
290
+ # description: When no data has been colleted
291
+ # ArgumentError
292
+ # description: For missing / wrong argument types
293
+ #
294
+ # == info
295
+ #
296
+ def stop_mem_log(params={})
297
+ params[:action] = 'stop'
298
+ execute_info('mem', params)
299
+ end
300
+
301
+ # == description
302
+ # Starts logging the gpu memory usage of the application.
303
+ # NOTE: not supported on all platforms. Platforms not supporting will return -1 values.
304
+ # Logging is done to a file in the given intervals (seconds). Small (<1) intervals may cause problems and should be avoided.
305
+ #
306
+ # The default behaviour is that a new log file will be started whenever the logging is started.
307
+ # If you need to save the old results use the append parameter to tell the logger to append the results to the existing file.
308
+ #
309
+ # == arguments
310
+ # params
311
+ # Hash
312
+ # description: Update interval and path for the log file. Interval value is in seconds.
313
+ # The file path given must exist on the target.
314
+ # 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
+ # example: {:interval => 1, :filePath => 'C:\Data', :append => true}
316
+ # default: No default values, must be set
317
+ #
318
+ # == returns
319
+ # nil
320
+ # description: -
321
+ # example: -
322
+ # == exceptions
323
+ # ArgumentError
324
+ # description: For missing / wrong argument types
325
+ #
326
+ # == info
327
+ #
328
+ def log_gpu_mem(params)
329
+ params[:action] = 'start'
330
+ execute_info('gpu', params)
331
+ end
332
+
333
+
334
+ # == description
335
+ # Stops the gpu memory logging and returns the results and xml data.
336
+ # Will return an error if the logging was not started.
337
+ # The logging is done by writing the values to a log file.
338
+ # When the logging is stopped the file is read and a xml format of the data is returned. The file is removed.\n
339
+ #
340
+ # Top object is of type logData and name gpuMemUsage. It contains the number of entries. The entries are the child elements of logData element.
341
+ #
342
+ # [code]
343
+ # <object id="0" name="gpuMemUsage" type="logData" >
344
+ # <attributes>
345
+ # <attribute name="entryCount" >
346
+ # <value>8</value>
347
+ # </attribute>
348
+ # </attributes>
349
+ # <objects>
350
+ # [/code]
351
+ #
352
+ # Each logEntry contains a timeStamp (yyyyMMddhhmmsszzz), totalMem, usedMem, freeMem, processPrivateMem and processSharedMem. Process specific details may not always be available. \n
353
+ #
354
+ # [code]
355
+ # <object id="0" name="LogEntry" type="logEntry" >
356
+ # <attributes>
357
+ # <attribute name="timeStamp" >
358
+ # <value>20100108190741059</value>
359
+ # </attribute>
360
+ # <attribute name="totalMem" >
361
+ # <value>33554432</value>
362
+ # </attribute>
363
+ # <attribute name="usedMem" >
364
+ # <value>17252576</value>
365
+ # </attribute>
366
+ # <attribute name="freeMem" >
367
+ # <value>16301856</value>
368
+ # </attribute>
369
+ # <attribute name="processPrivateMem" >
370
+ # <value>5170739</value>
371
+ # </attribute>
372
+ # <attribute name="processSharedMem" >
373
+ # <value>0</value>
374
+ # </attribute>
375
+ # </attributes>
376
+ # </object>
377
+ # [/code]
378
+ #
379
+ # You can use xpath to access the data directly to form any your own reports. Another way is to create a state object out of the data. This way you can access the data as you access ui state objects.
380
+ #
381
+ # [code]
382
+ # # start logging
383
+ # @app.log_gpu_mem( :interval => 1, :filePath => 'C:\Data' )
384
+ #
385
+ # # perform the tests here...
386
+ #
387
+ # # stop logging and get data as state object
388
+ # log_data_object = MobyBase::StateObject.new( @app.stop_gpu_log )
389
+ #
390
+ # # create arrays for the results
391
+ # total_memory = []
392
+ # used_memory = []
393
+ # free_memory = []
394
+ # process_private_memory = []
395
+ # process_shared_memory = []
396
+ #
397
+ # # collect values from each log entry and store to results array
398
+ # ( 0 .. log_data_object.logData.attribute( 'entryCount' ).to_i ).each do | index |
399
+ #
400
+ # # store log entry reference to variable
401
+ # entry = log_data_object.logEntry( :id => index.to_s )
402
+ #
403
+ # # store entry values to array
404
+ # total_memory << entry.attribute( 'totalMem' ).to_i
405
+ # used_memory << entry.attribute( 'usedMem' ).to_i
406
+ # free_memory << entry.attribute( 'freeMem' ).to_i
407
+ # process_private_memory << entry.attribute( 'processPrivateMem' ).to_i
408
+ # process_shared_memory << entry.attribute( 'processSharedMem' ).to_i
409
+ #
410
+ # end
411
+ #
412
+ # g = Gruff::Line.new
413
+ # g.title = "Application cpu usage%"
414
+ # g.data( "Total memory", total_memory )
415
+ # g.data( "Used memory", used_memory )
416
+ # g.data( "Free memory", free_memory )
417
+ # g.data( "Process private memory", process_private_memory )
418
+ # g.data( "Process shared memory", process_shared_memory )
419
+ # g.write( "info_gpu_load.png" )
420
+ # [/code]
421
+ #
422
+ # The example produces a graph which shows the cpu load (values depend on the testing steps, device, platform etc...).
423
+ #
424
+ # == arguments
425
+ # params
426
+ # Hash
427
+ # description: Optional parameters.
428
+ # example: {:clearLog => true}
429
+ # default: No default values, must be set
430
+ #
431
+ # == returns
432
+ # Xml
433
+ # description: data is returned in the same format as the ui state xml
434
+ # example: <object id="0" name="LogEntry" type="logEntry" >
435
+ # <attributes>
436
+ # <attribute name="timeStamp" >
437
+ # <value>20100108190741059</value>
438
+ # </attribute>
439
+ # <attribute name="totalMem" >
440
+ # <value>33554432</value>
441
+ # </attribute>
442
+ # <attribute name="usedMem" >
443
+ # <value>17252576</value>
444
+ # </attribute>
445
+ # <attribute name="freeMem" >
446
+ # <value>16301856</value>
447
+ # </attribute>
448
+ # <attribute name="processPrivateMem" >
449
+ # <value>5170739</value>
450
+ # </attribute>
451
+ # <attribute name="processSharedMem" >
452
+ # <value>0</value>
453
+ # </attribute>
454
+ # </attributes>
455
+ # </object>
456
+ #
457
+ # == exceptions
458
+ # RuntimeError
459
+ # description: When no data has been colleted
460
+ # ArgumentError
461
+ # description: For missing / wrong argument types
462
+ #
463
+ # == info
464
+ #
465
+ def stop_gpu_log(params={})
466
+ params[:action] = 'stop'
467
+ execute_info('gpu', params)
468
+ end
469
+
470
+ # == description
471
+ # Load the cpu log without stopping the logging.
472
+ #
473
+ # == arguments
474
+ # params
475
+ # Hash
476
+ # description: Optional params hash. If :clearLog => true given will clear the log when loading by default log will not be cleared.
477
+ # example: {:clearLog = true}
478
+ # default: nil
479
+ #
480
+ #
481
+ # == returns
482
+ # Xml
483
+ # description: data is returned in the same format as the ui state xml
484
+ # example: -
485
+ #
486
+ # == exceptions
487
+ # RuntimeError
488
+ # description: When no data has been colleted
489
+ # ArgumentError
490
+ # description: For missing / wrong argument types
491
+ #
492
+ # == info
493
+ #
494
+ def load_cpu_log(params={})
495
+ params[:action] = 'load'
496
+ execute_info('cpu', params)
497
+ end
498
+
499
+ # == description
500
+ # Load the mem log without stopping the logging.
501
+ #
502
+ # == arguments
503
+ # params
504
+ # Hash
505
+ # description: Optional params hash. If :clearLog => true given will clear the log when loading by default log will not be cleared.
506
+ # example: {:clearLog = true}
507
+ # default: nil
508
+ #
509
+ #
510
+ # == returns
511
+ # Xml
512
+ # description: data is returned in the same format as the ui state xml
513
+ # example: -
514
+ #
515
+ # == exceptions
516
+ # RuntimeError
517
+ # description: When no data has been colleted
518
+ # ArgumentError
519
+ # description: For missing / wrong argument types
520
+ #
521
+ # == info
522
+ #
523
+ def load_mem_log(params={})
524
+ params[:action] = 'load'
525
+ execute_info('mem', params)
526
+ end
527
+
528
+ # == description
529
+ # Load the gpu log without stopping the logging.
530
+ #
531
+ # == arguments
532
+ # params
533
+ # Hash
534
+ # description: Optional params hash. If :clearLog => true given will clear the log when loading by default log will not be cleared.
535
+ # example: {:clearLog = true}
536
+ # default: nil
537
+ #
538
+ #
539
+ # == returns
540
+ # Xml
541
+ # description: data is returned in the same format as the ui state xml
542
+ # example: -
543
+ #
544
+ # == exceptions
545
+ # RuntimeError
546
+ # description: When no data has been colleted
547
+ # ArgumentError
548
+ # description: For missing / wrong argument types
549
+ #
550
+ # == info
551
+ #
552
+
553
+ def load_gpu_log(params={})
554
+ params[:action] = 'load'
555
+ execute_info('gpu', params)
556
+ end
557
+
558
+ private
559
+
560
+ def execute_info(service, params)
561
+ begin
562
+
563
+ validate_params(params)
564
+
565
+ time = params[:interval].to_f
566
+ interval = time*1000
567
+ params[:interval] = interval.to_i
568
+
569
+ command = MobyCommand::InfoLoggerCommand.new(service, params )
570
+
571
+ ret = nil
572
+ if self.class == MobyBase::SUT
573
+ ret = execute_command( command )
574
+ else
575
+ command.application_id = get_application_id
576
+ ret = @sut.execute_command( command )
577
+ end
578
+
579
+ rescue Exception => e
580
+ MobyUtil::Logger.instance.log "behaviour","FAIL;Failed infologger \"#{params.to_s}\".;#{service};"
581
+ Kernel::raise e
582
+ end
583
+ MobyUtil::Logger.instance.log "behaviour","PASS;Operation infologger succeeded with params \"#{params.to_s}\".;#{service};"
584
+ ret
585
+ end
586
+
587
+ def validate_params(params)
588
+ #type
589
+ raise ArgumentError.new("Parameters must be a hash (e.g. {:filePath => 'C:\Data\',:interval => 1 }") unless params.kind_of?(Hash)
590
+ if params[:action] == 'start'
591
+ #speed
592
+ raise ArgumentError.new("Log file path must be defined (e.g. :filePath => 'C:\Data\')") unless params[:filePath]
593
+ #distance
594
+ raise ArgumentError.new("Interval 1 must be an number (e.g. :interval => 1") unless params[:interval].kind_of?(Numeric)
595
+ end
596
+ end
597
+
598
+ # enable hooking for performance measurement & debug logging
599
+ MobyUtil::Hooking.instance.hook_methods( self ) if defined?( MobyUtil::Hooking )
600
+
601
+
602
+ end
603
+ end
604
+ end