testability-driver 0.9.2 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/tdriver/base/behaviour/behaviours/object_behaviour_composition.rb +1 -1
- data/lib/tdriver/base/behaviour/behaviours/object_behaviour_description.rb +11 -7
- data/lib/tdriver/base/behaviour/behaviours/object_composition.rb +8 -0
- data/lib/tdriver/base/behaviour/factory.rb +229 -209
- data/lib/tdriver/base/errors.rb +3 -0
- data/lib/tdriver/base/state_object.rb +11 -20
- data/lib/tdriver/base/sut/controller.rb +4 -4
- data/lib/tdriver/base/sut/factory.rb +205 -170
- data/lib/tdriver/base/sut/generic/behaviours/application.rb +256 -174
- data/lib/tdriver/base/sut/generic/behaviours/find.rb +17 -11
- data/lib/tdriver/base/sut/generic/behaviours/flash_behaviour.rb +57 -66
- data/lib/tdriver/base/sut/generic/behaviours/sut.rb +578 -497
- data/lib/tdriver/base/sut/generic/behaviours/switchbox_behaviour.rb +41 -15
- data/lib/tdriver/base/sut/generic/behaviours/verification.rb +48 -19
- data/lib/tdriver/base/sut/generic/commands/fixture.rb +47 -0
- data/lib/tdriver/base/sut/generic/commands/key_sequence.rb +25 -13
- data/lib/tdriver/base/sut/generic/commands/screen_capture.rb +16 -10
- data/lib/tdriver/base/sut/generic/plugin.rb +9 -3
- data/lib/tdriver/base/sut/sut.rb +41 -33
- data/lib/tdriver/base/test_object/abstract.rb +26 -3
- data/lib/tdriver/base/test_object/adapter.rb +399 -0
- data/lib/tdriver/base/test_object/behaviours/syncronization.rb +56 -14
- data/lib/tdriver/base/test_object/behaviours/test_object.rb +663 -197
- data/lib/tdriver/base/test_object/cache.rb +132 -0
- data/lib/tdriver/base/test_object/factory.rb +677 -426
- data/lib/tdriver/base/test_object/factory_new.rb +202 -0
- data/lib/tdriver/base/test_object/identificator.rb +24 -17
- data/lib/tdriver/base/test_object/loader.rb +9 -3
- data/lib/tdriver/base/test_object/verification.rb +181 -0
- data/lib/tdriver/loader.rb +1 -1
- data/lib/tdriver/report/report.rb +2 -0
- data/lib/tdriver/report/report_api.rb +4 -4
- data/lib/tdriver/report/report_creator.rb +29 -3
- data/lib/tdriver/report/report_data_presentation.rb +7 -3
- data/lib/tdriver/report/report_execution_statistics.rb +80 -21
- data/lib/tdriver/report/report_javascript.rb +192 -0
- data/lib/tdriver/report/report_test_case_run.rb +22 -0
- data/lib/tdriver/report/report_test_run.rb +62 -55
- data/lib/tdriver/report/report_writer.rb +57 -56
- data/lib/tdriver/tdriver.rb +14 -41
- data/lib/tdriver/util/common/error.rb +1 -0
- data/lib/tdriver/util/common/exceptions.rb +12 -0
- data/lib/tdriver/util/common/file.rb +12 -6
- data/lib/tdriver/util/common/gem.rb +2 -1
- data/lib/tdriver/util/common/hash.rb +152 -0
- data/lib/tdriver/util/common/kernel.rb +49 -34
- data/lib/tdriver/util/common/loader.rb +21 -17
- data/lib/tdriver/util/common/numeric.rb +39 -0
- data/lib/tdriver/util/common/object.rb +115 -0
- data/lib/tdriver/util/common/string.rb +55 -2
- data/lib/tdriver/util/dbaccess/dbaccess.rb +194 -161
- data/lib/tdriver/util/dynamic_attribute_filter.rb +6 -0
- data/lib/tdriver/util/hooking.rb +2 -2
- data/lib/tdriver/util/loader.rb +2 -2
- data/lib/tdriver/util/localisation/localisation.rb +277 -18
- data/lib/tdriver/util/logger.rb +142 -13
- data/lib/tdriver/util/parameter/parameter_hash.rb +8 -5
- data/lib/tdriver/util/parameter/parameter_xml.rb +18 -2
- data/lib/tdriver/util/recorder.rb +17 -12
- data/lib/tdriver/util/user_data/user_data.rb +3 -2
- data/lib/tdriver/util/{video_rec.rb → video_utils.rb} +136 -16
- data/lib/tdriver/util/xml/abstraction.rb +7 -0
- data/lib/tdriver/util/xml/attribute.rb +32 -0
- data/lib/tdriver/util/xml/loader.rb +8 -2
- data/lib/tdriver/util/xml/nil_node.rb +95 -0
- data/lib/tdriver/util/xml/parsers/nokogiri/abstraction.rb +46 -7
- data/lib/tdriver/util/xml/parsers/nokogiri/attribute.rb +19 -9
- data/lib/tdriver/util/xml/parsers/nokogiri/document.rb +1 -1
- data/lib/tdriver/util/xml/parsers/nokogiri/element.rb +13 -1
- data/lib/tdriver/util/xml/parsers/nokogiri/loader.rb +6 -0
- data/lib/tdriver/util/xml/parsers/nokogiri/nodeset.rb +27 -15
- data/lib/tdriver/util/xml/parsers/nokogiri/text.rb +57 -0
- data/lib/tdriver/util/xml/text.rb +32 -0
- data/lib/tdriver/util/xml/xml.rb +35 -22
- data/lib/tdriver/version.rb +1 -1
- data/lib/tdriver-devtools/behaviour/xml/rdoc_behaviour_xml_generator.rb +41 -34
- data/lib/tdriver-devtools/doc/generate.rb +31 -6
- data/lib/tdriver-devtools/doc/xslt/template.xsl +46 -25
- data/lib/tdriver-devtools/tests/feature_tests/example/behaviour_example.rb +100 -0
- data/lib/tdriver-devtools/tests/feature_tests/update +1 -1
- data/lib/tdriver.rb +0 -3
- data/xml/behaviours/generic.xml +1 -1
- data/xml/defaults/generic.xml +4 -90
- data/xml/templates/generic.xml +33 -25
- metadata +21 -29
- data/lib/tdriver-devtools/behaviour/xml_generator/example/flick-example.rb +0 -245
- data/lib/tdriver-devtools/behaviour/xml_generator/example/sut.rb +0 -964
- data/lib/tdriver-devtools/behaviour/xml_generator/generate.rb +0 -68
- data/lib/tdriver-devtools/behaviour/xml_generator/lib/custom_rdoc_generator.rb +0 -1865
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.argument.default.template +0 -1
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.argument.template +0 -3
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.argument_type.template +0 -4
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.exception.template +0 -4
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.method.arguments.template +0 -4
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.method.deprecated.template +0 -3
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.method.exceptions.template +0 -3
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.method.info.template +0 -1
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.method.returns.template +0 -3
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.method.tables.template +0 -3
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.method.template +0 -12
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.returns.template +0 -5
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.table.item.template +0 -1
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.table.row.template +0 -2
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.table.template +0 -7
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.template +0 -14
- data/lib/tdriver-devtools/behaviour/xml_generator/update +0 -3
- data/lib/tdriver-devtools/tests/feature_tests/example/flick-example.rb +0 -233
- data/lib/tdriver-devtools/tests/feature_tests/example/impl.rb +0 -194
|
@@ -44,10 +44,25 @@ module MobyBehaviour
|
|
|
44
44
|
|
|
45
45
|
include MobyBehaviour::Behaviour
|
|
46
46
|
|
|
47
|
+
# == description
|
|
47
48
|
# Instructs the SUT to reboot
|
|
48
|
-
#
|
|
49
|
-
#
|
|
50
|
-
#
|
|
49
|
+
# == returns
|
|
50
|
+
# NilClass
|
|
51
|
+
# description: -
|
|
52
|
+
# example: -
|
|
53
|
+
# == exceptions
|
|
54
|
+
# BehaviourError
|
|
55
|
+
# description: switchbox_sleep_before_powerup_in_reboot not defined for sut in tdriver_parameters.xml
|
|
56
|
+
# BehaviourError
|
|
57
|
+
# description: switchbox_sleep_after_powerup_in_reboot not defined for sut in tdriver_parameters.xml
|
|
58
|
+
# BehaviourError
|
|
59
|
+
# description: switchbox_sleep_before_powerup_in_reboot need to be non-negative integer smaller than 50 seconds
|
|
60
|
+
# BehaviourError
|
|
61
|
+
# description: switchbox_sleep_in_reboot could not be converted to integer
|
|
62
|
+
# BehaviourError
|
|
63
|
+
# description: switchbox_sleep_after_powerup_in_reboot need to be non-negative integer smaller than 500 seconds
|
|
64
|
+
# BehaviourError
|
|
65
|
+
# description: switchbox_sleep_after_powerup_in_reboot could not be converted to integer
|
|
51
66
|
def reset
|
|
52
67
|
str_sleep_time_before_powerup = parameter(:switchbox_sleep_before_powerup_in_reboot)
|
|
53
68
|
Kernel::raise BehaviourError.new("reboot", "switchbox_sleep_before_powerup_in_reboot not defined for sut in tdriver_parameters.xml") if str_sleep_time_before_powerup == nil
|
|
@@ -72,8 +87,6 @@ module MobyBehaviour
|
|
|
72
87
|
rescue
|
|
73
88
|
Kernel::raise BehaviourError.new("reboot", "switchbox_sleep_after_powerup_in_reboot could not be converted to integer")
|
|
74
89
|
end
|
|
75
|
-
|
|
76
|
-
|
|
77
90
|
|
|
78
91
|
power_down
|
|
79
92
|
begin
|
|
@@ -86,7 +99,7 @@ module MobyBehaviour
|
|
|
86
99
|
|
|
87
100
|
MobyUtil::Retryable.until( :timeout => 60, :retry_timeout => 5 ) {
|
|
88
101
|
system(str_commands_after_powerup) if str_commands_after_powerup != nil
|
|
89
|
-
if MobyUtil::Parameter[ :ats4_error_recovery_enabled, false ]
|
|
102
|
+
if MobyUtil::Parameter[ :ats4_error_recovery_enabled, false ]!='true'
|
|
90
103
|
MobyUtil::Logger.instance.log "behaviour" , "PASS;TDriver attempting reconnect"
|
|
91
104
|
self.connect(self.id)
|
|
92
105
|
MobyUtil::Logger.instance.log "behaviour" , "PASS;TDriver connected"
|
|
@@ -97,10 +110,15 @@ module MobyBehaviour
|
|
|
97
110
|
}
|
|
98
111
|
end
|
|
99
112
|
|
|
113
|
+
# == description
|
|
100
114
|
# Instructs the switchbox to power down the sut
|
|
101
|
-
#
|
|
102
|
-
#
|
|
103
|
-
#
|
|
115
|
+
# == returns
|
|
116
|
+
# Boolean
|
|
117
|
+
# description: Current power status
|
|
118
|
+
# example: false
|
|
119
|
+
# == exceptions
|
|
120
|
+
# BehaviourError
|
|
121
|
+
# description: Failed to power down
|
|
104
122
|
def power_down
|
|
105
123
|
str_command_arr = []
|
|
106
124
|
|
|
@@ -129,10 +147,16 @@ module MobyBehaviour
|
|
|
129
147
|
@switch_box_power_status = false
|
|
130
148
|
end
|
|
131
149
|
|
|
150
|
+
|
|
151
|
+
# == description
|
|
132
152
|
# Instructs the switchbox to power up the sut
|
|
133
|
-
#
|
|
134
|
-
#
|
|
135
|
-
#
|
|
153
|
+
# == returns
|
|
154
|
+
# Boolean
|
|
155
|
+
# description: Current power status
|
|
156
|
+
# example: true
|
|
157
|
+
# == exceptions
|
|
158
|
+
# BehaviourError
|
|
159
|
+
# description: Failed to power up
|
|
136
160
|
def power_up
|
|
137
161
|
str_command_arr = []
|
|
138
162
|
|
|
@@ -161,10 +185,12 @@ module MobyBehaviour
|
|
|
161
185
|
@switch_box_power_status = true
|
|
162
186
|
end
|
|
163
187
|
|
|
188
|
+
# == description
|
|
164
189
|
# Gets the current power status of the switchbox
|
|
165
|
-
#
|
|
166
|
-
#
|
|
167
|
-
#
|
|
190
|
+
# == returns
|
|
191
|
+
# Boolean
|
|
192
|
+
# description: Current power status
|
|
193
|
+
# example: true
|
|
168
194
|
def power_status
|
|
169
195
|
if @switch_box_power_status == nil
|
|
170
196
|
false
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
module MobyBehaviour
|
|
21
21
|
|
|
22
22
|
# == description
|
|
23
|
-
# Defines methods for verification of
|
|
23
|
+
# Defines methods for verification of test object state. These methods can only be called from non-sut objects
|
|
24
24
|
#
|
|
25
25
|
# == behaviour
|
|
26
26
|
# GenericVerification
|
|
@@ -38,31 +38,58 @@ module MobyBehaviour
|
|
|
38
38
|
# *
|
|
39
39
|
#
|
|
40
40
|
# == objects
|
|
41
|
-
#
|
|
41
|
+
# *
|
|
42
42
|
#
|
|
43
43
|
module Verification
|
|
44
44
|
|
|
45
45
|
include MobyBehaviour::Behaviour
|
|
46
46
|
|
|
47
47
|
# == description
|
|
48
|
-
# Checks if a child test object matching the given criteria can be found
|
|
49
|
-
#
|
|
50
|
-
#
|
|
51
|
-
#
|
|
52
|
-
#
|
|
53
|
-
#
|
|
54
|
-
#
|
|
55
|
-
#
|
|
56
|
-
#
|
|
57
|
-
#
|
|
58
|
-
#
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
48
|
+
# Checks if a child test object matching the given criteria can be found, under this application object or test object.
|
|
49
|
+
#
|
|
50
|
+
# == arguments
|
|
51
|
+
# type
|
|
52
|
+
# String
|
|
53
|
+
# description: String defining the type of the object
|
|
54
|
+
# example: "Button"
|
|
55
|
+
#
|
|
56
|
+
# attributes
|
|
57
|
+
# Hash
|
|
58
|
+
# description: Optional hash containing attributes that the object must have
|
|
59
|
+
# example: {}
|
|
60
|
+
#
|
|
61
|
+
# == returns
|
|
62
|
+
# TrueClass
|
|
63
|
+
# description: if the object exists on the sut display
|
|
64
|
+
# example: true
|
|
65
|
+
# FalseClass
|
|
66
|
+
# description: if the object exists on the sut display
|
|
67
|
+
# example: false
|
|
68
|
+
#
|
|
69
|
+
# == exceptions
|
|
70
|
+
# TypeError
|
|
71
|
+
# description: Wrong argument type %s for test object type (expected String)
|
|
72
|
+
#
|
|
73
|
+
# ArgumentError
|
|
74
|
+
# description: The test object type argument must not be empty
|
|
75
|
+
#
|
|
76
|
+
# TypeError
|
|
77
|
+
# description: Wrong argument type %s for test object attributes (expected Hash)
|
|
78
|
+
def test_object_exists?(type, attributes = {} )
|
|
79
|
+
|
|
80
|
+
# verify type
|
|
81
|
+
#Kernel::raise ArgumentError.new "The type argument must be a non empty String." unless (type.kind_of? String and !type.empty?)
|
|
82
|
+
type.check_type( String, "Wrong argument type $1 for test object type (expected $2)" )
|
|
83
|
+
|
|
84
|
+
# verify that type is not empty string
|
|
85
|
+
type.not_empty( "The test object type argument must not be empty" )
|
|
86
|
+
|
|
87
|
+
# verify type
|
|
88
|
+
#Kernel::raise ArgumentError.new "The attributes argument must be a Hash." unless attributes.kind_of?( Hash )
|
|
89
|
+
attributes.check_type( Hash, "Wrong argument type $1 for test object attributes (expected $2)")
|
|
64
90
|
|
|
65
91
|
#attributes_with_type = {}.merge attributes
|
|
92
|
+
|
|
66
93
|
attributes_with_type = attributes.clone
|
|
67
94
|
attributes_with_type[:type] = type
|
|
68
95
|
attributes_with_type.delete(:__logging)
|
|
@@ -70,7 +97,8 @@ module MobyBehaviour
|
|
|
70
97
|
#translate the symbol values into string using sut's localisation setting
|
|
71
98
|
translate!( attributes_with_type )
|
|
72
99
|
|
|
73
|
-
|
|
100
|
+
# JKo: is there some reason for the line below?
|
|
101
|
+
#identificator = MobyBase::TestObjectIdentificator.new( attributes_with_type )
|
|
74
102
|
|
|
75
103
|
original_logging = MobyUtil::Logger.instance.enabled
|
|
76
104
|
desired_logging = (attributes[:__logging] == nil || attributes[:__logging] == 'false') ? false : true
|
|
@@ -80,6 +108,7 @@ module MobyBehaviour
|
|
|
80
108
|
begin
|
|
81
109
|
|
|
82
110
|
self.child( attributes_with_type )
|
|
111
|
+
|
|
83
112
|
MobyUtil::Logger.instance.enabled = desired_logging
|
|
84
113
|
MobyUtil::Logger.instance.log "behaviour" , "PASS;Test object of type #{type} with attributes #{attributes.inspect} was found.;#{self.kind_of?(MobyBase::SUT) ? self.id.to_s : ''};test_object_exist;"
|
|
85
114
|
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
############################################################################
|
|
2
|
+
##
|
|
3
|
+
## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
|
4
|
+
## All rights reserved.
|
|
5
|
+
## Contact: Nokia Corporation (testabilitydriver@nokia.com)
|
|
6
|
+
##
|
|
7
|
+
## This file is part of TDriver.
|
|
8
|
+
##
|
|
9
|
+
## If you have questions regarding the use of this file, please contact
|
|
10
|
+
## Nokia at testabilitydriver@nokia.com .
|
|
11
|
+
##
|
|
12
|
+
## This library is free software; you can redistribute it and/or
|
|
13
|
+
## modify it under the terms of the GNU Lesser General Public
|
|
14
|
+
## License version 2.1 as published by the Free Software Foundation
|
|
15
|
+
## and appearing in the file LICENSE.LGPL included in the packaging
|
|
16
|
+
## of this file.
|
|
17
|
+
##
|
|
18
|
+
############################################################################
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
module MobyCommand
|
|
23
|
+
|
|
24
|
+
class Fixture < MobyCommand::CommandData
|
|
25
|
+
|
|
26
|
+
attr_accessor :params
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
# == description
|
|
30
|
+
# Fixture command holds the required parameters to execute a fixture operation in the target.
|
|
31
|
+
#
|
|
32
|
+
# == arguments
|
|
33
|
+
# params
|
|
34
|
+
# Hash
|
|
35
|
+
# description:
|
|
36
|
+
# Hash for holding the parameters need by the fixture operation.
|
|
37
|
+
# Example: {:application_id => "", :object_id => "", :object_type => "", :name => nil, :command_name => nil, :parameters => {}, :async => false)}
|
|
38
|
+
#
|
|
39
|
+
def initialize(params)
|
|
40
|
+
|
|
41
|
+
@params = params
|
|
42
|
+
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
end # Fixture
|
|
46
|
+
|
|
47
|
+
end # MobyCommand
|
|
@@ -17,7 +17,6 @@
|
|
|
17
17
|
##
|
|
18
18
|
############################################################################
|
|
19
19
|
|
|
20
|
-
|
|
21
20
|
module MobyCommand
|
|
22
21
|
|
|
23
22
|
class KeySequence < MobyCommand::CommandData
|
|
@@ -32,9 +31,9 @@ module MobyCommand
|
|
|
32
31
|
# Instance of KeySequence
|
|
33
32
|
def initialize( key_symbol = nil, type_symbol = :ShortPress )
|
|
34
33
|
#TODO: Review comment (OR): @sequence -> @_sequence?
|
|
35
|
-
@sequence = Array.new( 0 )
|
|
34
|
+
@sequence = [] # Array.new( 0 )
|
|
36
35
|
#@_sut = sut
|
|
37
|
-
self.append!( key_symbol, type_symbol ) unless key_symbol
|
|
36
|
+
self.append!( key_symbol, type_symbol ) unless key_symbol.nil?
|
|
38
37
|
end
|
|
39
38
|
|
|
40
39
|
# Function to append a keypress with type to KeySequence.sequence array
|
|
@@ -50,28 +49,41 @@ module MobyCommand
|
|
|
50
49
|
|
|
51
50
|
# Function to repeat last added keypress in sequence unless count is less than one or keypress sequence is empty
|
|
52
51
|
# == params
|
|
53
|
-
#
|
|
52
|
+
# count:: times of key repeated, default is one
|
|
54
53
|
# == returns
|
|
55
54
|
# self
|
|
56
55
|
# == raises
|
|
57
|
-
#
|
|
58
|
-
# ArgumentError:: Positive value expected
|
|
59
|
-
# IndexError::
|
|
60
|
-
def times!(
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
Kernel::raise
|
|
64
|
-
|
|
56
|
+
# TypeError:: Wrong argument type %s for times count (expected Fixnum)
|
|
57
|
+
# ArgumentError:: Positive value expected for times count (got %i)
|
|
58
|
+
# IndexError:: Unable to multiply last given key due to key sequence is empty
|
|
59
|
+
def times!( count = 1 )
|
|
60
|
+
|
|
61
|
+
# verify count argument type
|
|
62
|
+
#Kernel::raise ArgumentError.new("Fixnum expected as argument") if count.class != Fixnum
|
|
63
|
+
count.check_type( Fixnum, "Wrong argument type $1 for times count (expected $2)" )
|
|
64
|
+
|
|
65
|
+
# verify that count is positive number
|
|
66
|
+
Kernel::raise ArgumentError.new( "Positive value expected for times count (got #{ count })" ) if count.negative?
|
|
67
|
+
|
|
68
|
+
# verify that @sequence is not empty
|
|
69
|
+
#Kernel::raise IndexError.new( "Not allowed when empty key sequence" ) if @sequence.size == 0
|
|
70
|
+
Kernel::raise IndexError.new( "Unable to multiply last given key due to key sequence is empty" ) if @sequence.empty?
|
|
71
|
+
|
|
72
|
+
count.times do | iteration |
|
|
73
|
+
|
|
65
74
|
@sequence.push @sequence.fetch( -1 ) unless iteration == 0
|
|
75
|
+
|
|
66
76
|
end
|
|
77
|
+
|
|
67
78
|
self
|
|
79
|
+
|
|
68
80
|
end
|
|
69
81
|
|
|
70
82
|
# Returns the stored sequence as an Array with Hash elements having :value and :type keys for each press.
|
|
71
83
|
# == returns
|
|
72
84
|
# Array:: Stored key sequence
|
|
73
85
|
def get_sequence
|
|
74
|
-
|
|
86
|
+
@sequence
|
|
75
87
|
end
|
|
76
88
|
|
|
77
89
|
# enable hooking for performance measurement & debug logging
|
|
@@ -31,23 +31,29 @@ module MobyCommand
|
|
|
31
31
|
|
|
32
32
|
# Constructor to ScreenCapture
|
|
33
33
|
# == params
|
|
34
|
-
#
|
|
34
|
+
# attributes:: (optional) Hash of image related attributes
|
|
35
35
|
# == returns
|
|
36
36
|
# Instance of ScreenCapture
|
|
37
|
-
def initialize(
|
|
37
|
+
def initialize( attributes = {} )
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
@image_mime_type = hash[ :mime_type ] ||= :PNG
|
|
42
|
-
@color_depth = hash[ :color_depth ] ||= :Color4K
|
|
43
|
-
@redraw = hash[ :redraw ] ||= false
|
|
39
|
+
# verify that attributes argument is type of Hash
|
|
40
|
+
attributes.check_type( Hash, "Wrong argument type $1 for screen capture command attributes (expected $2)" )
|
|
44
41
|
|
|
45
|
-
|
|
42
|
+
# set default values unless already defined in attributes hash
|
|
43
|
+
attributes.default_values( :type => :Screen, :mime_type => :PNG, :color_depth => :Color4K, :redraw => false )
|
|
46
44
|
|
|
47
|
-
|
|
45
|
+
# verify that value of :type is type of Symbol
|
|
46
|
+
( @command = attributes[ :type ] ).check_type( Symbol, "Wrong argument type $1 for screen capture command type (expected $2)" )
|
|
48
47
|
|
|
49
|
-
|
|
48
|
+
# verify that value of :mime_type is type of Symbol
|
|
49
|
+
( @image_mime_type = attributes[ :mime_type ] ).check_type( Symbol, "Wrong argument type $1 for screen capture command mime type (expected $2)" )
|
|
50
50
|
|
|
51
|
+
# verify that value of :color_depth is type of Symbol
|
|
52
|
+
( @color_depth = attributes[ :color_depth ] ).check_type( Symbol, "Wrong argument type $1 for screen capture command image color depth type (expected $2)" )
|
|
53
|
+
|
|
54
|
+
# verify that value of :redraw is type of Symbol
|
|
55
|
+
( @redraw = attributes[ :redraw ] ).check_type( [ TrueClass, FalseClass ], "Wrong argument type $1 for screen capture command redraw flag (expected $2)" )
|
|
56
|
+
|
|
51
57
|
end
|
|
52
58
|
|
|
53
59
|
# enable hooking for performance measurement & debug logging
|
|
@@ -17,9 +17,8 @@
|
|
|
17
17
|
##
|
|
18
18
|
############################################################################
|
|
19
19
|
|
|
20
|
-
|
|
21
20
|
# verify that plugin engine and modules is loaded
|
|
22
|
-
Kernel::raise RuntimeError.new( "SUT plugin requires
|
|
21
|
+
Kernel::raise RuntimeError.new( "This SUT plugin requires Testability Driver and cannot be launched in standalone mode" ) unless defined?( MobyUtil::Plugin )
|
|
23
22
|
|
|
24
23
|
module MobyPlugin
|
|
25
24
|
|
|
@@ -75,12 +74,19 @@ module MobyPlugin
|
|
|
75
74
|
# returns SUT object - this method will be called from MobyBase::SUTFactory
|
|
76
75
|
def self.make_sut( sut_id )
|
|
77
76
|
|
|
77
|
+
# MobyBase::SUT.new(
|
|
78
|
+
# MobyBase::SutController.new( "", MobyController::SutAdapter.new() ),
|
|
79
|
+
# MobyBase::TestObjectFactory.instance,
|
|
80
|
+
# sut_id
|
|
81
|
+
# )
|
|
82
|
+
|
|
78
83
|
MobyBase::SUT.new(
|
|
79
84
|
MobyBase::SutController.new( "", MobyController::SutAdapter.new() ),
|
|
80
|
-
|
|
85
|
+
TDriver.TestObjectFactory.new( TDriver::TestObjectAdapter ),
|
|
81
86
|
sut_id
|
|
82
87
|
)
|
|
83
88
|
|
|
89
|
+
|
|
84
90
|
end
|
|
85
91
|
|
|
86
92
|
# enable hooking for performance measurement & debug logging
|
data/lib/tdriver/base/sut/sut.rb
CHANGED
|
@@ -20,48 +20,56 @@
|
|
|
20
20
|
# abstract class for SUT - no behaviours
|
|
21
21
|
module MobyBase
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
class SUT
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
25
|
+
attr_accessor(
|
|
26
|
+
:id, # id of current SUT
|
|
27
|
+
:ui_type, # ui type
|
|
28
|
+
:ui_version, # ui version
|
|
29
|
+
:input, # the input method used for interacting with this sut as a symbol, eg. :key or :touch.
|
|
30
|
+
:type # type of object ("SUT"), used when applying behaviour
|
|
31
|
+
)
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
33
|
+
# Initialize SUT by giving references to the used controller and test object factory
|
|
34
|
+
# == params
|
|
35
|
+
# sut_controller:: Controller object that acts as a facade to the device represented by this SUT
|
|
36
|
+
# test_object_factory:: TestObjectFactory object, a factory for generating creating test objects for this SUT
|
|
37
|
+
# sut_id:: String representing the identification of this SUT - the identification will need to match with group id in parameters xml
|
|
38
|
+
def initialize( sut_controller, test_object_factory, sut_id )
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
@_sutController = sut_controller
|
|
41
|
+
|
|
42
|
+
@test_object_factory = test_object_factory || TDriver::TestObjectFactory.new( :test_object_adapter => TDriver::TestObjectAdapter )
|
|
42
43
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
@id = sut_id
|
|
45
|
+
@input = :key
|
|
46
|
+
@type = "sut"
|
|
46
47
|
|
|
47
|
-
|
|
48
|
+
end
|
|
48
49
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
50
|
+
# Interface to forward command execution to sut specific controller (SutController#execute_command)
|
|
51
|
+
# == params
|
|
52
|
+
# command:: MobyBase::CommandData descendant object defining the command
|
|
53
|
+
# == raises
|
|
54
|
+
# ?:: what ever SutController#execute_command( command ) raises
|
|
55
|
+
# == returns
|
|
56
|
+
# Boolean:: what ever SutController returns
|
|
57
|
+
def execute_command( command )
|
|
57
58
|
|
|
58
|
-
|
|
59
|
+
@_sutController.execute_command( command )
|
|
59
60
|
|
|
60
|
-
|
|
61
|
+
end
|
|
61
62
|
|
|
62
|
-
|
|
63
|
-
|
|
63
|
+
# TODO: document me
|
|
64
|
+
def inspect
|
|
64
65
|
|
|
65
|
-
|
|
66
|
+
"#<#{ self.class }:0x#{ ( "%x" % ( self.object_id.to_i << 1 ) )[ 3 .. -1 ] } @id=#{ @id.inspect } @input=\"#{ @input }\" @type=\"#{ @type }\" @ui_type=\"#{ @ui_type }\" @ui_version=\"#{ @ui_version }\">"
|
|
67
|
+
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
# enable hooking for performance measurement & debug logging
|
|
71
|
+
MobyUtil::Hooking.instance.hook_methods( self ) if defined?( MobyUtil::Hooking )
|
|
72
|
+
|
|
73
|
+
end # SUT
|
|
66
74
|
|
|
67
75
|
end # MobyBase
|