testability-driver-qt-sut-plugin 1.2.1 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (30) hide show
  1. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/application.rb +16 -6
  2. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/behaviour.rb +86 -12
  3. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/configure_behaviour.rb +1 -1
  4. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/events.rb +5 -3
  5. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/file_transfer.rb +15 -0
  6. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/fixture.rb +110 -76
  7. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/gesture.rb +125 -69
  8. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/sut.rb +28 -19
  9. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/synchronization.rb +143 -24
  10. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/behaviours/widget.rb +25 -10
  11. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/agent.rb +54 -0
  12. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/application.rb +1 -0
  13. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/configure_command.rb +32 -39
  14. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/find_object.rb +8 -19
  15. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/fixture.rb +35 -22
  16. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/group.rb +31 -29
  17. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/infologger_command.rb +23 -32
  18. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/key_sequence.rb +44 -61
  19. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/screen_capture.rb +22 -23
  20. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/tap.rb +39 -28
  21. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/version.rb +14 -24
  22. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/controllers/widget.rb +39 -42
  23. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/sut/adapter.rb +93 -120
  24. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/sut/communication.rb +95 -75
  25. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/util/find_object_generator.rb +6 -8
  26. data/lib/testability-driver-plugins/testability-driver-qt-sut-plugin/util/message_composer.rb +1 -1
  27. data/xml/behaviour/qt.xml +6 -0
  28. data/xml/keymap/win.xml +174 -0
  29. data/xml/template/qt.xml +128 -117
  30. metadata +60 -75
@@ -89,7 +89,7 @@ module MobyBehaviour
89
89
  end
90
90
  command.command_params(params)
91
91
 
92
- @sut.execute_command(command)
92
+ execute_behavior(move_params, command)
93
93
 
94
94
  rescue Exception => e
95
95
 
@@ -130,12 +130,15 @@ module MobyBehaviour
130
130
  # |:interval|This method sleeps tap_count times interval|Integer|2|1|
131
131
  # |:tap_count|Number of taps to do|Integer|2|1|
132
132
  # |:use_tap_screen|Should tapping be done on screen or as mouse event to the object|Boolean|true|see TDriver parameters table below|
133
+ # |:ensure_event|Verify that an event is sent to the target object. Retry if not received by target|Boolean|true|false|
134
+ #
133
135
  # tdriver_params_table
134
136
  # title: Default values read from tdriver parameters
135
137
  # description: These setting values are read from tdriver_parameters.xml
136
138
  # |Name|Description|Default if missing from parameters|
137
139
  # |use_tap_screen|See :use_tap_screen above|false|
138
140
  # |in_tap_move_pointer|Wether to actually move mouse pointer to tap coordinates|false|
141
+ # |:ensure_event|Verify that an event is sent to the target object. Retry if not received by target|false|
139
142
  #
140
143
  # == returns
141
144
  # NilClass
@@ -178,6 +181,7 @@ module MobyBehaviour
178
181
 
179
182
  tap_count = tap_params[:tap_count].nil? ? 1 : tap_params[:tap_count]
180
183
  use_tap_screen = tap_params[:use_tap_screen].nil? ? sut_parameters[ :use_tap_screen, 'false'] : tap_params[:use_tap_screen].to_s
184
+
181
185
  else
182
186
  tap_count = tap_params
183
187
 
@@ -254,7 +258,7 @@ module MobyBehaviour
254
258
  command.command_params(params)
255
259
 
256
260
  # puts "tap: " + (Time.now - tapMeasure).to_s + " s - tap about to execute "
257
- @sut.execute_command( command )
261
+ execute_behavior(tap_params, command)
258
262
 
259
263
  # puts "tap: " + (Time.now - tapMeasure).to_s + " s - executed"
260
264
  #do not allow operations to continue untill taps done
@@ -358,7 +362,7 @@ module MobyBehaviour
358
362
 
359
363
  )
360
364
 
361
- @sut.execute_command(command)
365
+ execute_behavior(tap_params, command)
362
366
 
363
367
  rescue # Exception => e
364
368
 
@@ -479,13 +483,25 @@ module MobyBehaviour
479
483
 
480
484
  logging_enabled = $logger.enabled
481
485
  $logger.enabled = false
482
-
486
+
483
487
  raise ArgumentError.new("First parameter should be time between taps or Hash") unless tap_params.kind_of? Hash or tap_params.kind_of? Fixnum
484
488
 
485
489
  begin
486
- tap_down(button, false, tap_params)
487
- sleep time
488
- tap_up(button, false, tap_params)
490
+ ens = param_set_configured?(tap_params, :ensure_event)
491
+ tap_params[:ensure_event] = false
492
+ if ens
493
+ self.ensure_event(:retry_timeout => 5, :retry_interval => 0.5) {
494
+ tap_down(button, false, tap_params)
495
+ sleep time
496
+ tap_up(button, false, tap_params)
497
+ }
498
+ else
499
+ tap_down(button, false, tap_params)
500
+ sleep time
501
+ tap_up(button, false, tap_params)
502
+ end
503
+
504
+
489
505
  rescue Exception => e
490
506
  $logger.enabled = logging_enabled
491
507
  $logger.behaviour "FAIL;Failed long_tap with time \"#{time.to_s}\", button \"#{button.to_s}\".;#{identity};long_tap;"
@@ -610,7 +626,7 @@ module MobyBehaviour
610
626
  params.merge!(tap_params)
611
627
 
612
628
  command.command_params(params)
613
- @sut.execute_command(command)
629
+ execute_behavior(tap_params, command)
614
630
 
615
631
  self.force_refresh( :id => get_application_id ) if refresh
616
632
 
@@ -679,8 +695,7 @@ module MobyBehaviour
679
695
 
680
696
  command.command_params(params)
681
697
 
682
-
683
- @sut.execute_command(command)
698
+ execute_behavior(tap_params, command)
684
699
  self.force_refresh({:id => get_application_id}) if refresh
685
700
 
686
701
  rescue Exception => e
@@ -0,0 +1,54 @@
1
+ ############################################################################
2
+ ##
3
+ ## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
4
+ ## All rights reserved.
5
+ ## Contact: Nokia Corporation (testabilitydriver@nokia.com)
6
+ ##
7
+ ## This file is part of TDriver.
8
+ ##
9
+ ## If you have questions regarding the use of this file, please contact
10
+ ## Nokia at testabilitydriver@nokia.com .
11
+ ##
12
+ ## This library is free software; you can redistribute it and/or
13
+ ## modify it under the terms of the GNU Lesser General Public
14
+ ## License version 2.1 as published by the Free Software Foundation
15
+ ## and appearing in the file LICENSE.LGPL included in the packaging
16
+ ## of this file.
17
+ ##
18
+ ############################################################################
19
+
20
+ module MobyController
21
+
22
+ module QT
23
+
24
+ module AgentCommand
25
+
26
+ include MobyController::Abstraction
27
+
28
+ # TODO: document me
29
+ # overloads default MobyController::Abstraction#make_message
30
+ def make_message
31
+
32
+ command = @parameters[ :command ]
33
+
34
+ case command
35
+
36
+ when :version
37
+
38
+ # query agent version from versionService
39
+ Comms::MessageGenerator.generate( '<TasCommands service="versionService" />' )
40
+
41
+ else
42
+
43
+ # raise exception if command not implemented
44
+ raise NotImplementedError, "command #{ command.inspect } not implemented in #{ self.class.name }"
45
+
46
+ end
47
+
48
+ end
49
+
50
+ end # AgentCommand
51
+
52
+ end # QT
53
+
54
+ end # MobyController
@@ -30,6 +30,7 @@ module MobyController
30
30
  @sut_adapter = adapter
31
31
 
32
32
  end
33
+
33
34
 
34
35
  # Execute the command
35
36
  # Sends the message to the device using the @sut_adapter (see base class)
@@ -19,42 +19,35 @@
19
19
 
20
20
  module MobyController
21
21
 
22
- module QT
23
-
24
- module ConfigureCommand
25
-
26
- # Execute the command
27
- # Sends the message to the device using the @sut_adapter (see base class)
28
- # == params
29
- # == returns
30
- # == raises
31
- # NotImplementedError: raised if unsupported command type
32
- def execute
33
-
34
- @sut_adapter.send_service_request(
35
- Comms::MessageGenerator.generate(
36
- Nokogiri::XML::Builder.new{
37
- TasCommands( :service => "confService", :id=> application_id ) {
38
- Target( :TasId => "Application" ) {
39
- Command( value || "", ( params || {} ).merge( :name => name ) )
40
- }
41
- }
42
- }.to_xml
43
- )
44
- )
45
-
46
- end
47
-
48
- def set_adapter( adapter )
49
- @sut_adapter = adapter
50
- end
51
-
52
- # enable hooking for performance measurement & debug logging
53
- TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
54
-
55
- end #module ConfigureCommand
56
-
57
- end #module QT
58
-
59
- end #module MobyController
60
-
22
+ module QT
23
+
24
+ module ConfigureCommand
25
+
26
+ include MobyController::Abstraction
27
+
28
+ # Creates service command message which will be sent to @sut_adapter by execute method
29
+ # == params
30
+ # == returns
31
+ # == raises
32
+ def make_message
33
+
34
+ Comms::MessageGenerator.generate(
35
+ Nokogiri::XML::Builder.new{
36
+ TasCommands( :service => "confService", :id=> application_id ) {
37
+ Target( :TasId => "Application" ){
38
+ Command( value || "", ( params || {} ).merge( :name => name ) )
39
+ }
40
+ }
41
+ }.to_xml
42
+ )
43
+
44
+ end
45
+
46
+ # enable hooking for performance measurement & debug logging
47
+ TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
48
+
49
+ end # ConfigureCommand
50
+
51
+ end # QT
52
+
53
+ end # MobyController
@@ -25,27 +25,17 @@ module MobyController
25
25
 
26
26
  include MobyUtil::FindObjectGenerator
27
27
 
28
- # Execute the command
29
- # Sends the message to the device using the @sut_adapter (see base class)
28
+ include MobyController::Abstraction
29
+
30
+ # Creates service command message which will be sent to @sut_adapter by execute method
30
31
  # == params
31
32
  # == returns
32
33
  # == raises
33
- # NotImplementedError: raised if unsupported command type
34
- def execute
35
-
36
- @sut_adapter.send_service_request(
37
-
38
- # *[ message, return_crc ]
39
- MobyController::QT::Comms::MessageGenerator.generate( generate_message ), true
40
-
41
- )
42
-
43
- end
44
-
45
- def set_adapter( adapter )
46
-
47
- @sut_adapter = adapter
48
-
34
+ def make_message
35
+
36
+ # *[ message, return_crc ]
37
+ [ Comms::MessageGenerator.generate( generate_message ), true ]
38
+
49
39
  end
50
40
 
51
41
  # enable hooking for performance measurement & debug logging
@@ -56,4 +46,3 @@ module MobyController
56
46
  end # QT
57
47
 
58
48
  end # MobyController
59
-
@@ -19,34 +19,47 @@
19
19
 
20
20
  module MobyController
21
21
 
22
- module QT
22
+ module QT
23
23
 
24
- module Fixture
25
- include MobyUtil::MessageComposer
24
+ module Fixture
26
25
 
27
- # Execute the command
28
- # Sends the message to the device using the @sut_adapter (see base class)
29
- # == params
30
- # == returns
31
- # == raises
32
- # NotImplementedError: raised if unsupported command type
33
- def execute
34
- Kernel::raise ArgumentError.new( "Fixture '%s' not found for sut id '%s'" % [ @name, @sut_adapter.sut_id ] ) if ( plugin_params = $parameters[ @sut_adapter.sut_id.to_sym ][ :fixtures ][ @params[:name].to_sym, nil ] ).nil?
26
+ include MobyUtil::MessageComposer
35
27
 
36
- fixture_plugin = plugin_params.kind_of?(String) ? plugin_params : plugin_params[:plugin]
37
- @sut_adapter.send_service_request(Comms::MessageGenerator.generate(make_fixture_message(fixture_plugin, @params)))
28
+ include MobyController::Abstraction
38
29
 
39
- end
30
+ # Creates service command message which will be sent to @sut_adapter by execute method
31
+ # == params
32
+ # == returns
33
+ # == raises
34
+ def make_message
40
35
 
41
- def set_adapter( adapter )
42
- @sut_adapter = adapter
43
- end
36
+ # use local variable for less AST lookups
37
+ sut_id = @sut_adapter.sut_id.to_sym
44
38
 
45
- # enable hooking for performance measurement & debug logging
46
- TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
39
+ plugin_name = @params[ :name ].to_s
47
40
 
48
- end # Fixture
41
+ # retrieve plugin details from fixtures configuration
42
+ plugin_params = $parameters[ sut_id ][ :fixtures ][ plugin_name.to_sym, nil ]
49
43
 
50
- end #module QT
44
+ # verify that plugin is configured
45
+ plugin_params.not_nil "Fixture #{ plugin_name.inspect } not found for #{ sut_id.inspect }"
51
46
 
52
- end #module MobyController
47
+ # retrieve plugin name
48
+ fixture_plugin = plugin_params.kind_of?( String ) ? plugin_params : plugin_params[ :plugin ]
49
+
50
+ Comms::MessageGenerator.generate(
51
+ make_fixture_message(
52
+ fixture_plugin, @params
53
+ )
54
+ )
55
+
56
+ end
57
+
58
+ # enable hooking for performance measurement & debug logging
59
+ TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
60
+
61
+ end # Fixture
62
+
63
+ end # QT
64
+
65
+ end # MobyController
@@ -19,34 +19,36 @@
19
19
 
20
20
  module MobyController
21
21
 
22
- module QT
23
-
24
- module Group
25
-
26
- # Execute the command).
27
- # Sends the message to the device using the @sut_adapter (see base class)
28
- # == params
29
- # == returns
30
- # == raises
31
- # NotImplementedError: raised if unsupported command type
32
- def execute
33
- builder = Nokogiri::XML::Builder.new{
34
- TasCommands( :id=> application.id.to_s, :transitions => 'true', :service => 'uiCommand', :interval => interval.to_s, :multitouch => multitouch.to_s)
35
- }
36
- @sut_adapter.set_message_builder(builder)
37
- block.call
38
- @sut_adapter.send_grouped_request
39
- end
40
-
41
- def set_adapter( adapter )
42
- @sut_adapter = adapter
43
- end
44
-
45
- # enable hooking for performance measurement & debug logging
46
- TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
47
-
48
- end #module Group
49
-
50
- end #module QT
22
+ module QT
23
+
24
+ module Group
25
+
26
+ # Execute the command).
27
+ # Sends the message to the device using the @sut_adapter (see base class)
28
+ # == params
29
+ # == returns
30
+ # == raises
31
+ # NotImplementedError: raised if unsupported command type
32
+ def execute
33
+ builder = Nokogiri::XML::Builder.new{
34
+ TasCommands( :id=> application.id.to_s, :transitions => 'true', :service => 'uiCommand', :interval => interval.to_s, :multitouch => multitouch.to_s)
35
+ }
36
+
37
+ @sut_adapter.set_message_builder(builder)
38
+ block.call
39
+ @sut_adapter.send_grouped_request
40
+
41
+ end
42
+
43
+ def set_adapter( adapter )
44
+ @sut_adapter = adapter
45
+ end
46
+
47
+ # enable hooking for performance measurement & debug logging
48
+ TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
49
+
50
+ end #module Group
51
+
52
+ end #module QT
51
53
 
52
54
  end #module MobyController
@@ -19,44 +19,35 @@
19
19
 
20
20
  module MobyController
21
21
 
22
- module QT
22
+ module QT
23
23
 
24
- module InfoLoggerCommand
24
+ module InfoLoggerCommand
25
25
 
26
- # Execute the command
27
- # Sends the message to the device using the @sut_adapter (see base class)
28
- # == params
29
- # == returns
30
- # == raises
31
- # NotImplementedError: raised if unsupported command type
32
- def execute
26
+ include MobyController::Abstraction
33
27
 
34
- @sut_adapter.send_service_request(
35
- Comms::MessageGenerator.generate(
36
- Nokogiri::XML::Builder.new{
37
- TasCommands( :service => "infoService", :id=> application_id, :interval => params[:interval] ) {
38
- Target( :TasId => "Application" ) {
39
- Command( value || "", ( params || {} ).merge( :name => name ) )
40
- }
41
- }
42
- }.to_xml
43
- )
44
- )
28
+ # Creates service command message which will be sent to @sut_adapter by execute method
29
+ # == params
30
+ # == returns
31
+ # == raises
32
+ def make_message
45
33
 
46
- end
34
+ Comms::MessageGenerator.generate(
35
+ Nokogiri::XML::Builder.new{
36
+ TasCommands( :service => "infoService", :id=> application_id, :interval => params[:interval] ) {
37
+ Target( :TasId => "Application" ){
38
+ Command( value || "", ( params || {} ).merge( :name => name ) )
39
+ }
40
+ }
41
+ }.to_xml
42
+ )
47
43
 
48
- def set_adapter( adapter )
44
+ end
49
45
 
50
- @sut_adapter = adapter
46
+ # enable hooking for performance measurement & debug logging
47
+ TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
51
48
 
52
- end
49
+ end # InfoLoggerCommand
53
50
 
54
- # enable hooking for performance measurement & debug logging
55
- TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
51
+ end # QT
56
52
 
57
-
58
- end # InfoLoggerCommand
59
-
60
- end #module QT
61
-
62
- end #module MobyController
53
+ end # MobyController