testability-driver 0.9.2
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/README +1 -0
- data/bin/start_app_perf +199 -0
- data/bin/tdriver-devtools +3 -0
- data/config/sut_parameters.rb +39 -0
- data/ext/extconf.rb +67 -0
- data/ext/native_extensions.c +70 -0
- data/lib/matti.rb +30 -0
- data/lib/tdriver-devtools/behaviour/old/xml/example/flick-example.rb +223 -0
- data/lib/tdriver-devtools/behaviour/old/xml/example/impl.rb_invalid +194 -0
- data/lib/tdriver-devtools/behaviour/old/xml/generate_behaviour_xml.rb +95 -0
- data/lib/tdriver-devtools/behaviour/old/xml/lib/tdriver_generator.rb +722 -0
- data/lib/tdriver-devtools/behaviour/old/xml/qdoc_generator.rb +321 -0
- data/lib/tdriver-devtools/behaviour/old/xml/templates/behaviour.method.template +43 -0
- data/lib/tdriver-devtools/behaviour/old/xml/templates/behaviour.module.template +54 -0
- data/lib/tdriver-devtools/behaviour/old/xml/templates/behaviour.xml.argument.template +7 -0
- data/lib/tdriver-devtools/behaviour/old/xml/templates/behaviour.xml.argument_type.template +7 -0
- data/lib/tdriver-devtools/behaviour/old/xml/templates/behaviour.xml.exception.template +5 -0
- data/lib/tdriver-devtools/behaviour/old/xml/templates/behaviour.xml.howto.line.template +2 -0
- data/lib/tdriver-devtools/behaviour/old/xml/templates/behaviour.xml.howto.template +5 -0
- data/lib/tdriver-devtools/behaviour/old/xml/templates/behaviour.xml.method.template +23 -0
- data/lib/tdriver-devtools/behaviour/old/xml/templates/behaviour.xml.template +14 -0
- data/lib/tdriver-devtools/behaviour/old/xml/update +3 -0
- data/lib/tdriver-devtools/behaviour/xml/generate.rb +88 -0
- data/lib/tdriver-devtools/behaviour/xml/rdoc_behaviour_xml_generator.rb +1924 -0
- data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.argument.default.template +1 -0
- data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.argument.template +3 -0
- data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.argument_type.template +4 -0
- data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.exception.template +4 -0
- data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.method.arguments.template +4 -0
- data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.method.deprecated.template +3 -0
- data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.method.exceptions.template +3 -0
- data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.method.info.template +1 -0
- data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.method.returns.template +3 -0
- data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.method.tables.template +3 -0
- data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.method.template +12 -0
- data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.returns.template +5 -0
- data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.table.item.template +1 -0
- data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.table.row.template +2 -0
- data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.table.template +8 -0
- data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.template +14 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/example/flick-example.rb +245 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/example/sut.rb +964 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/generate.rb +68 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/lib/custom_rdoc_generator.rb +1865 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.argument.default.template +1 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.argument.template +3 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.argument_type.template +4 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.exception.template +4 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.method.arguments.template +4 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.method.deprecated.template +3 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.method.exceptions.template +3 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.method.info.template +1 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.method.returns.template +3 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.method.tables.template +3 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.method.template +12 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.returns.template +5 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.table.item.template +1 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.table.row.template +2 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.table.template +7 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.template +14 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/update +3 -0
- data/lib/tdriver-devtools/doc/behaviour_xml/QtExampleGestureBehaviour.xml +138 -0
- data/lib/tdriver-devtools/doc/behaviour_xml/created.rid +1 -0
- data/lib/tdriver-devtools/doc/behaviour_xml/tdriver.hash +1 -0
- data/lib/tdriver-devtools/doc/feature_xml/qt_widget_hold.feature.xml +9 -0
- data/lib/tdriver-devtools/doc/feature_xml/qt_widget_tap.feature.xml +9 -0
- data/lib/tdriver-devtools/doc/generate.rb +892 -0
- data/lib/tdriver-devtools/doc/update +1 -0
- data/lib/tdriver-devtools/doc/xslt/html.rb +7 -0
- data/lib/tdriver-devtools/doc/xslt/template.xsl +1861 -0
- data/lib/tdriver-devtools/doc/xslt/update +3 -0
- data/lib/tdriver-devtools/plugin/placeholder.txt +1 -0
- data/lib/tdriver-devtools/tdriver-devtools.rb +404 -0
- data/lib/tdriver-devtools/tests/feature_tests/example/flick-example.rb +233 -0
- data/lib/tdriver-devtools/tests/feature_tests/example/impl.rb +194 -0
- data/lib/tdriver-devtools/tests/feature_tests/generate.rb +82 -0
- data/lib/tdriver-devtools/tests/feature_tests/lib/custom_rdoc_generator.rb +468 -0
- data/lib/tdriver-devtools/tests/feature_tests/templates/feature_attribute.template +5 -0
- data/lib/tdriver-devtools/tests/feature_tests/templates/feature_method.template +5 -0
- data/lib/tdriver-devtools/tests/feature_tests/templates/scenario_attribute.template +5 -0
- data/lib/tdriver-devtools/tests/feature_tests/templates/scenario_method.template +5 -0
- data/lib/tdriver-devtools/tests/feature_tests/update +3 -0
- data/lib/tdriver.rb +26 -0
- data/lib/tdriver/base/behaviour/behaviour.rb +32 -0
- data/lib/tdriver/base/behaviour/behaviours/object_behaviour_composition.rb +94 -0
- data/lib/tdriver/base/behaviour/behaviours/object_behaviour_description.rb +262 -0
- data/lib/tdriver/base/behaviour/behaviours/object_composition.rb +111 -0
- data/lib/tdriver/base/behaviour/factory.rb +380 -0
- data/lib/tdriver/base/behaviour/loader.rb +28 -0
- data/lib/tdriver/base/command_data/command_data.rb +51 -0
- data/lib/tdriver/base/command_data/loader.rb +25 -0
- data/lib/tdriver/base/errors.rb +131 -0
- data/lib/tdriver/base/loader.rb +38 -0
- data/lib/tdriver/base/state_object.rb +270 -0
- data/lib/tdriver/base/sut/adapter.rb +28 -0
- data/lib/tdriver/base/sut/controller.rb +119 -0
- data/lib/tdriver/base/sut/factory.rb +287 -0
- data/lib/tdriver/base/sut/generic/behaviours/application.rb +243 -0
- data/lib/tdriver/base/sut/generic/behaviours/controller.rb +67 -0
- data/lib/tdriver/base/sut/generic/behaviours/find.rb +96 -0
- data/lib/tdriver/base/sut/generic/behaviours/flash_behaviour.rb +346 -0
- data/lib/tdriver/base/sut/generic/behaviours/sut.rb +1268 -0
- data/lib/tdriver/base/sut/generic/behaviours/switchbox_behaviour.rb +182 -0
- data/lib/tdriver/base/sut/generic/behaviours/verification.rb +119 -0
- data/lib/tdriver/base/sut/generic/commands/application.rb +219 -0
- data/lib/tdriver/base/sut/generic/commands/key_sequence.rb +82 -0
- data/lib/tdriver/base/sut/generic/commands/screen_capture.rb +58 -0
- data/lib/tdriver/base/sut/generic/plugin.rb +96 -0
- data/lib/tdriver/base/sut/loader.rb +35 -0
- data/lib/tdriver/base/sut/sut.rb +67 -0
- data/lib/tdriver/base/test_object/abstract.rb +179 -0
- data/lib/tdriver/base/test_object/behaviours/syncronization.rb +94 -0
- data/lib/tdriver/base/test_object/behaviours/test_object.rb +787 -0
- data/lib/tdriver/base/test_object/factory.rb +618 -0
- data/lib/tdriver/base/test_object/identificator.rb +511 -0
- data/lib/tdriver/base/test_object/loader.rb +37 -0
- data/lib/tdriver/env.rb +21 -0
- data/lib/tdriver/loader.rb +36 -0
- data/lib/tdriver/matti.rb +35 -0
- data/lib/tdriver/report/error_recovery/tdriver_custom_error_recovery.rb +83 -0
- data/lib/tdriver/report/error_recovery/tdriver_error_recovery.rb +158 -0
- data/lib/tdriver/report/error_recovery/tdriver_error_recovery_settings.rb +98 -0
- data/lib/tdriver/report/report.rb +47 -0
- data/lib/tdriver/report/report_api.rb +207 -0
- data/lib/tdriver/report/report_combine.rb +86 -0
- data/lib/tdriver/report/report_crash_file_capture.rb +167 -0
- data/lib/tdriver/report/report_creator.rb +571 -0
- data/lib/tdriver/report/report_cucumber.rb +158 -0
- data/lib/tdriver/report/report_cucumber_listener.rb +337 -0
- data/lib/tdriver/report/report_cucumber_reporter.rb +335 -0
- data/lib/tdriver/report/report_data_presentation.rb +152 -0
- data/lib/tdriver/report/report_data_table.rb +64 -0
- data/lib/tdriver/report/report_execution_statistics.rb +284 -0
- data/lib/tdriver/report/report_file_capture.rb +159 -0
- data/lib/tdriver/report/report_grouping.rb +539 -0
- data/lib/tdriver/report/report_junit_xml.rb +147 -0
- data/lib/tdriver/report/report_rspec.rb +108 -0
- data/lib/tdriver/report/report_test_case_run.rb +621 -0
- data/lib/tdriver/report/report_test_run.rb +1286 -0
- data/lib/tdriver/report/report_test_unit.rb +175 -0
- data/lib/tdriver/report/report_writer.rb +1405 -0
- data/lib/tdriver/tdriver.rb +158 -0
- data/lib/tdriver/util/common.rb +24 -0
- data/lib/tdriver/util/common/array.rb +39 -0
- data/lib/tdriver/util/common/crc16.rb +100 -0
- data/lib/tdriver/util/common/environment.rb +153 -0
- data/lib/tdriver/util/common/error.rb +39 -0
- data/lib/tdriver/util/common/file.rb +315 -0
- data/lib/tdriver/util/common/gem.rb +108 -0
- data/lib/tdriver/util/common/kernel.rb +189 -0
- data/lib/tdriver/util/common/loader.rb +39 -0
- data/lib/tdriver/util/common/retryable.rb +98 -0
- data/lib/tdriver/util/common/string.rb +77 -0
- data/lib/tdriver/util/dbaccess/dbaccess.rb +188 -0
- data/lib/tdriver/util/dbaccess/dbconnection.rb +41 -0
- data/lib/tdriver/util/dbaccess/error.rb +35 -0
- data/lib/tdriver/util/dbaccess/loader.rb +29 -0
- data/lib/tdriver/util/dynamic_attribute_filter.rb +182 -0
- data/lib/tdriver/util/hooking.rb +434 -0
- data/lib/tdriver/util/loader.rb +65 -0
- data/lib/tdriver/util/localisation.rb +24 -0
- data/lib/tdriver/util/localisation/error.rb +32 -0
- data/lib/tdriver/util/localisation/loader.rb +28 -0
- data/lib/tdriver/util/localisation/localisation.rb +479 -0
- data/lib/tdriver/util/logger.rb +377 -0
- data/lib/tdriver/util/operator_data/error.rb +29 -0
- data/lib/tdriver/util/operator_data/loader.rb +26 -0
- data/lib/tdriver/util/operator_data/operator_data.rb +93 -0
- data/lib/tdriver/util/other/config.rb +221 -0
- data/lib/tdriver/util/parameter.rb +24 -0
- data/lib/tdriver/util/parameter/error.rb +45 -0
- data/lib/tdriver/util/parameter/loader.rb +37 -0
- data/lib/tdriver/util/parameter/parameter.rb +285 -0
- data/lib/tdriver/util/parameter/parameter_hash.rb +101 -0
- data/lib/tdriver/util/parameter/parameter_template.rb +120 -0
- data/lib/tdriver/util/parameter/parameter_user_api.rb +84 -0
- data/lib/tdriver/util/parameter/parameter_xml.rb +247 -0
- data/lib/tdriver/util/plugin/abstract.rb +60 -0
- data/lib/tdriver/util/plugin/error.rb +25 -0
- data/lib/tdriver/util/plugin/loader.rb +28 -0
- data/lib/tdriver/util/plugin/service.rb +200 -0
- data/lib/tdriver/util/recorder.rb +292 -0
- data/lib/tdriver/util/stats.rb +90 -0
- data/lib/tdriver/util/user_data/error.rb +29 -0
- data/lib/tdriver/util/user_data/loader.rb +26 -0
- data/lib/tdriver/util/user_data/user_data.rb +103 -0
- data/lib/tdriver/util/video_rec.rb +264 -0
- data/lib/tdriver/util/xml/abstraction.rb +47 -0
- data/lib/tdriver/util/xml/builder.rb +54 -0
- data/lib/tdriver/util/xml/document.rb +32 -0
- data/lib/tdriver/util/xml/element.rb +32 -0
- data/lib/tdriver/util/xml/error.rb +46 -0
- data/lib/tdriver/util/xml/loader.rb +46 -0
- data/lib/tdriver/util/xml/nil_element.rb +89 -0
- data/lib/tdriver/util/xml/nodeset.rb +32 -0
- data/lib/tdriver/util/xml/parsers/libxml/libxml.rb +140 -0
- data/lib/tdriver/util/xml/parsers/loader.rb +22 -0
- data/lib/tdriver/util/xml/parsers/nokogiri/abstraction.rb +111 -0
- data/lib/tdriver/util/xml/parsers/nokogiri/attribute.rb +54 -0
- data/lib/tdriver/util/xml/parsers/nokogiri/builder.rb +58 -0
- data/lib/tdriver/util/xml/parsers/nokogiri/document.rb +58 -0
- data/lib/tdriver/util/xml/parsers/nokogiri/element.rb +147 -0
- data/lib/tdriver/util/xml/parsers/nokogiri/loader.rb +42 -0
- data/lib/tdriver/util/xml/parsers/nokogiri/nodeset.rb +187 -0
- data/lib/tdriver/util/xml/xml.rb +170 -0
- data/lib/tdriver/verify/verify.rb +687 -0
- data/lib/tdriver/verify/verify.rb_org +630 -0
- data/lib/tdriver/version.rb +21 -0
- data/xml/behaviours/generic.xml +495 -0
- data/xml/defaults/generic.xml +97 -0
- data/xml/defaults/sut_generic.xml +36 -0
- data/xml/parameters/tdriver_parameters.xml +23 -0
- data/xml/templates/generic.xml +227 -0
- metadata +327 -0
|
@@ -0,0 +1,82 @@
|
|
|
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 Testability Driver.
|
|
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
|
+
module MobyCommand
|
|
22
|
+
|
|
23
|
+
class KeySequence < MobyCommand::CommandData
|
|
24
|
+
|
|
25
|
+
attr_accessor :id
|
|
26
|
+
|
|
27
|
+
# Constructor to KeySequence
|
|
28
|
+
# == params
|
|
29
|
+
# key_symbol:: (optional) Symbol of key to be added to sequence if given.
|
|
30
|
+
# type_symbol:: (optional) Symbol of keypress type of key if given, otherwise use default.
|
|
31
|
+
# == returns
|
|
32
|
+
# Instance of KeySequence
|
|
33
|
+
def initialize( key_symbol = nil, type_symbol = :ShortPress )
|
|
34
|
+
#TODO: Review comment (OR): @sequence -> @_sequence?
|
|
35
|
+
@sequence = Array.new( 0 )
|
|
36
|
+
#@_sut = sut
|
|
37
|
+
self.append!( key_symbol, type_symbol ) unless key_symbol == nil
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# Function to append a keypress with type to KeySequence.sequence array
|
|
41
|
+
# == params
|
|
42
|
+
# key_symbol:: Symbol of key to be appended to sequence.
|
|
43
|
+
# type_symbol:: (optional) Symbol of keypress type of key if given, otherwise use default.
|
|
44
|
+
# == returns
|
|
45
|
+
# self
|
|
46
|
+
def append!( key_symbol, type_symbol = :ShortPress )
|
|
47
|
+
@sequence.push({:value => key_symbol, :type => type_symbol})
|
|
48
|
+
self
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# Function to repeat last added keypress in sequence unless count is less than one or keypress sequence is empty
|
|
52
|
+
# == params
|
|
53
|
+
# int:: times of key repeated, default is one
|
|
54
|
+
# == returns
|
|
55
|
+
# self
|
|
56
|
+
# == raises
|
|
57
|
+
# ArgumentError:: Fixnum expected as argument
|
|
58
|
+
# ArgumentError:: Positive value expected as argument
|
|
59
|
+
# IndexError:: Not allowed when empty key sequence
|
|
60
|
+
def times!( int = 1 )
|
|
61
|
+
Kernel::raise ArgumentError.new("Fixnum expected as argument") if int.class != Fixnum
|
|
62
|
+
Kernel::raise ArgumentError.new("Positive value expected as argument") if int < 0
|
|
63
|
+
Kernel::raise IndexError.new("Not allowed when empty key sequence") if @sequence.size == 0
|
|
64
|
+
int.times do | iteration |
|
|
65
|
+
@sequence.push @sequence.fetch( -1 ) unless iteration == 0
|
|
66
|
+
end
|
|
67
|
+
self
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
# Returns the stored sequence as an Array with Hash elements having :value and :type keys for each press.
|
|
71
|
+
# == returns
|
|
72
|
+
# Array:: Stored key sequence
|
|
73
|
+
def get_sequence
|
|
74
|
+
return @sequence
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
# enable hooking for performance measurement & debug logging
|
|
78
|
+
MobyUtil::Hooking.instance.hook_methods( self ) if defined?( MobyUtil::Hooking )
|
|
79
|
+
|
|
80
|
+
end # KeySequence
|
|
81
|
+
|
|
82
|
+
end # MobyCommand
|
|
@@ -0,0 +1,58 @@
|
|
|
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 Testability Driver.
|
|
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
|
+
module MobyCommand
|
|
22
|
+
|
|
23
|
+
class ScreenCapture < MobyCommand::CommandData
|
|
24
|
+
|
|
25
|
+
attr_accessor(
|
|
26
|
+
:command,
|
|
27
|
+
:image_mime_type,
|
|
28
|
+
:color_depth,
|
|
29
|
+
:redraw
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
# Constructor to ScreenCapture
|
|
33
|
+
# == params
|
|
34
|
+
# hash:: (optional) Hash of image related attributes
|
|
35
|
+
# == returns
|
|
36
|
+
# Instance of ScreenCapture
|
|
37
|
+
def initialize( hash = {} )
|
|
38
|
+
|
|
39
|
+
# Default values
|
|
40
|
+
@command = hash[ :type ] ||= :Screen
|
|
41
|
+
@image_mime_type = hash[ :mime_type ] ||= :PNG
|
|
42
|
+
@color_depth = hash[ :color_depth ] ||= :Color4K
|
|
43
|
+
@redraw = hash[ :redraw ] ||= false
|
|
44
|
+
|
|
45
|
+
Kernel::raise ArgumentError.new("Wrong argument type %s for command type (expected Symbol)" % hash[ :type ].class ) unless hash[ :type ].kind_of? Symbol
|
|
46
|
+
|
|
47
|
+
Kernel::raise ArgumentError.new("Wrong argument type %s for image MIME type (expected Symbol)" % hash[ :mime_type ].class ) unless hash[ :mime_type ].kind_of? Symbol
|
|
48
|
+
|
|
49
|
+
Kernel::raise ArgumentError.new("Wrong argument type %s for image color depth type (expected Symbol)" % hash[ :color_depth ].class ) unless hash[ :color_depth ].kind_of? Symbol
|
|
50
|
+
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
# enable hooking for performance measurement & debug logging
|
|
54
|
+
MobyUtil::Hooking.instance.hook_methods( self ) if defined?( MobyUtil::Hooking )
|
|
55
|
+
|
|
56
|
+
end # ScreenCapture
|
|
57
|
+
|
|
58
|
+
end # MobyCommand
|
|
@@ -0,0 +1,96 @@
|
|
|
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 Testability Driver.
|
|
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
|
+
# verify that plugin engine and modules is loaded
|
|
22
|
+
Kernel::raise RuntimeError.new( "SUT plugin requires TDriver" ) unless defined?( MobyUtil::Plugin )
|
|
23
|
+
|
|
24
|
+
module MobyPlugin
|
|
25
|
+
|
|
26
|
+
module Generic
|
|
27
|
+
|
|
28
|
+
class SUT < MobyUtil::Plugin
|
|
29
|
+
|
|
30
|
+
## plugin configuration, constructor and deconstructor methods
|
|
31
|
+
def self.plugin_name
|
|
32
|
+
|
|
33
|
+
# return plugin name as string
|
|
34
|
+
"tdriver-generic-sut-plugin"
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def self.plugin_type
|
|
38
|
+
|
|
39
|
+
# return plugin type as symbol
|
|
40
|
+
:sut
|
|
41
|
+
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def self.register_plugin
|
|
45
|
+
|
|
46
|
+
# load plugin specific implementation or other initialization etc.
|
|
47
|
+
MobyUtil::FileHelper.load_modules(
|
|
48
|
+
|
|
49
|
+
# load behaviour(s)
|
|
50
|
+
'behaviours/*.rb',
|
|
51
|
+
|
|
52
|
+
# load commands(s)
|
|
53
|
+
'commands/*.rb'
|
|
54
|
+
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def self.unregister_plugin
|
|
60
|
+
|
|
61
|
+
# unregister plugin
|
|
62
|
+
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
## plugin specific methods
|
|
66
|
+
|
|
67
|
+
# return sut type that plugin implements
|
|
68
|
+
def self.sut_type
|
|
69
|
+
|
|
70
|
+
# return sut type as string
|
|
71
|
+
"generic"
|
|
72
|
+
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
# returns SUT object - this method will be called from MobyBase::SUTFactory
|
|
76
|
+
def self.make_sut( sut_id )
|
|
77
|
+
|
|
78
|
+
MobyBase::SUT.new(
|
|
79
|
+
MobyBase::SutController.new( "", MobyController::SutAdapter.new() ),
|
|
80
|
+
MobyBase::TestObjectFactory.instance,
|
|
81
|
+
sut_id
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
# enable hooking for performance measurement & debug logging
|
|
87
|
+
MobyUtil::Hooking.instance.hook_methods( self ) if defined?( MobyUtil::Hooking )
|
|
88
|
+
|
|
89
|
+
# register plugin
|
|
90
|
+
MobyUtil::PluginService.instance.register_plugin( self ) # Note: self is MobyPlugin::Generic::SUT
|
|
91
|
+
|
|
92
|
+
end # SUT
|
|
93
|
+
|
|
94
|
+
end # Generic
|
|
95
|
+
|
|
96
|
+
end # MobyPlugin
|
|
@@ -0,0 +1,35 @@
|
|
|
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 Testability Driver.
|
|
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
|
+
# load sut abstraction class
|
|
22
|
+
require File.expand_path( File.join( File.dirname( __FILE__ ), 'sut' ) )
|
|
23
|
+
|
|
24
|
+
# load sut adapter abstraction class
|
|
25
|
+
require File.expand_path( File.join( File.dirname( __FILE__ ), 'adapter' ) )
|
|
26
|
+
|
|
27
|
+
# load sut controller
|
|
28
|
+
require File.expand_path( File.join( File.dirname( __FILE__ ), 'controller' ) )
|
|
29
|
+
|
|
30
|
+
# load sut factory
|
|
31
|
+
require File.expand_path( File.join( File.dirname( __FILE__ ), 'factory' ) )
|
|
32
|
+
|
|
33
|
+
# generic sut
|
|
34
|
+
require File.expand_path( File.join( File.dirname( __FILE__ ), 'generic/plugin.rb' ) )
|
|
35
|
+
|
|
@@ -0,0 +1,67 @@
|
|
|
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 Testability Driver.
|
|
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
|
+
# abstract class for SUT - no behaviours
|
|
21
|
+
module MobyBase
|
|
22
|
+
|
|
23
|
+
class SUT
|
|
24
|
+
|
|
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
|
+
|
|
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
|
+
|
|
40
|
+
@_sutController = sut_controller
|
|
41
|
+
@test_object_factory = test_object_factory
|
|
42
|
+
|
|
43
|
+
@id = sut_id
|
|
44
|
+
@input = :key
|
|
45
|
+
@type = "sut"
|
|
46
|
+
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# Interface to forward command execution to sut specific controller (SutController#execute_command)
|
|
50
|
+
# == params
|
|
51
|
+
# command:: MobyBase::CommandData descendant object defining the command
|
|
52
|
+
# == raises
|
|
53
|
+
# ?:: what ever SutController#execute_command( command ) raises
|
|
54
|
+
# == returns
|
|
55
|
+
# Boolean:: what ever SutController returns
|
|
56
|
+
def execute_command( command )
|
|
57
|
+
|
|
58
|
+
@_sutController.execute_command( command )
|
|
59
|
+
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
# enable hooking for performance measurement & debug logging
|
|
63
|
+
MobyUtil::Hooking.instance.hook_methods( self ) if defined?( MobyUtil::Hooking )
|
|
64
|
+
|
|
65
|
+
end # SUT
|
|
66
|
+
|
|
67
|
+
end # MobyBase
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
##
|
|
2
|
+
## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
|
3
|
+
## All rights reserved.
|
|
4
|
+
## Contact: Nokia Corporation (testabilitydriver@nokia.com)
|
|
5
|
+
##
|
|
6
|
+
## This file is part of Testability Driver.
|
|
7
|
+
##
|
|
8
|
+
## If you have questions regarding the use of this file, please contact
|
|
9
|
+
## Nokia at testabilitydriver@nokia.com .
|
|
10
|
+
##
|
|
11
|
+
## This library is free software; you can redistribute it and/or
|
|
12
|
+
## modify it under the terms of the GNU Lesser General Public
|
|
13
|
+
## License version 2.1 as published by the Free Software Foundation
|
|
14
|
+
## and appearing in the file LICENSE.LGPL included in the packaging
|
|
15
|
+
## of this file.
|
|
16
|
+
##
|
|
17
|
+
############################################################################
|
|
18
|
+
|
|
19
|
+
module MobyBase
|
|
20
|
+
|
|
21
|
+
class TestObject
|
|
22
|
+
|
|
23
|
+
attr_reader(
|
|
24
|
+
:sut, # SUT associated to test object
|
|
25
|
+
:type, # test object type (from xml)
|
|
26
|
+
:id, # test object id (from xml)
|
|
27
|
+
:parent, # parent test object
|
|
28
|
+
:name, # test object name (from xml)
|
|
29
|
+
:x_path # xpath for test object, used when updating self with fresh ui dump
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
# Creation of a new TestObject requires a data object to be given to constructor
|
|
33
|
+
# === params
|
|
34
|
+
# factory:: TestObjectFactory used for creating test object for the sut this object is associated with
|
|
35
|
+
# sut:: SUT object that this test object is associated with
|
|
36
|
+
# xml_object:: REXML::Document object describing this test object
|
|
37
|
+
# === returns
|
|
38
|
+
# TestObject:: new TestObject instance
|
|
39
|
+
# === raises
|
|
40
|
+
def initialize( test_object_factory, sut, parent = nil, xml_object = nil )
|
|
41
|
+
|
|
42
|
+
# Initializes a test object by assigning it a test object factory and a sut and storing xml data
|
|
43
|
+
# describing the object.
|
|
44
|
+
@test_object_factory = test_object_factory
|
|
45
|
+
@parent = parent
|
|
46
|
+
@sut = sut
|
|
47
|
+
|
|
48
|
+
#self.xml_data = xml_object if xml_object
|
|
49
|
+
method( :xml_data= ).call( xml_object ) if xml_object
|
|
50
|
+
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
# Function to verify is DATA of two TestObjects are the same,
|
|
54
|
+
# Defined in TestObject#== other_test_object
|
|
55
|
+
# === param
|
|
56
|
+
# other_test_object:: TestObject other, could be null
|
|
57
|
+
# === returns
|
|
58
|
+
# true:: if TestObjects have same DATA
|
|
59
|
+
# false:: if TestObjects have different DATA
|
|
60
|
+
# === raises
|
|
61
|
+
# nothing
|
|
62
|
+
def eql?( other_test_object )
|
|
63
|
+
self == other_test_object
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
# Function to verify is DATA of two TestObjects are the same,
|
|
67
|
+
# return TRUE if other_test_object:
|
|
68
|
+
# instance of MobyBase::TestObject
|
|
69
|
+
# type's are equal
|
|
70
|
+
# id's are equal
|
|
71
|
+
# name's are equal
|
|
72
|
+
# == param
|
|
73
|
+
# other_test_object:: TestObject other, could be null
|
|
74
|
+
# == returns
|
|
75
|
+
# true:: if TestObjects have same DATA
|
|
76
|
+
# false:: if TestObjects have different DATA
|
|
77
|
+
# == raises
|
|
78
|
+
# nothing
|
|
79
|
+
def ==( other_test_object )
|
|
80
|
+
|
|
81
|
+
#return false unless other_test_object.instance_of?( MobyBase::TestObject )
|
|
82
|
+
#return false unless self.type == other_test_object.type
|
|
83
|
+
#return false unless self.id == other_test_object.id
|
|
84
|
+
#return false unless self.name == other_test_object.name
|
|
85
|
+
#return true
|
|
86
|
+
|
|
87
|
+
# optimized version
|
|
88
|
+
other_test_object.instance_of?( MobyBase::TestObject ) && ( @type == other_test_object.type ) && ( @id == other_test_object.id ) && (@name == other_test_object.name )
|
|
89
|
+
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
# Function to calculate HASH value for a TestObject
|
|
93
|
+
# as required by, e.g. Set
|
|
94
|
+
#
|
|
95
|
+
# This is required, as eql? method is being overwritten.
|
|
96
|
+
# === returns
|
|
97
|
+
# Fixnum:: hash number representing current TestObject
|
|
98
|
+
def hash
|
|
99
|
+
|
|
100
|
+
#result = 17
|
|
101
|
+
#result = result * 37 + self.id.to_i
|
|
102
|
+
#result = result * 37 + type.hash
|
|
103
|
+
#result = result * 37 + name.hash
|
|
104
|
+
#return result
|
|
105
|
+
|
|
106
|
+
# optimized version
|
|
107
|
+
( ( ( 17 * 37 + @id.to_i ) * 37 + @type.hash ) * 37 + @name.hash )
|
|
108
|
+
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
# Function to support sorting TestObjects within an array.
|
|
112
|
+
# Mostly for unit testing purposes, as Set is not ordered.
|
|
113
|
+
# should not be used normally. Thus, not documented.
|
|
114
|
+
def <=>( other )
|
|
115
|
+
|
|
116
|
+
#self_type = self.type
|
|
117
|
+
#other_type = other.type
|
|
118
|
+
#return -1 if self_type < other_type
|
|
119
|
+
#return 1 if self_type > other_type
|
|
120
|
+
|
|
121
|
+
#self_name = self.name
|
|
122
|
+
#other_name = other.name
|
|
123
|
+
#return -1 if self_name < other_name
|
|
124
|
+
#return 1 if self_name > other_name
|
|
125
|
+
|
|
126
|
+
#self_id = self.id
|
|
127
|
+
#other_id = other.id
|
|
128
|
+
#return -1 if self_id < other_id
|
|
129
|
+
#return 1 if self_id > other_id
|
|
130
|
+
|
|
131
|
+
#0
|
|
132
|
+
|
|
133
|
+
# optimized version
|
|
134
|
+
( ( result = ( @type <=> other.type ) ) == 0 ? ( ( result = ( @name <=> other.name ) ) == 0 ? @id <=> other.id : result ) : result )
|
|
135
|
+
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
# Function to be renamed, possibly refactored
|
|
139
|
+
def xml_data=( xml_object )
|
|
140
|
+
|
|
141
|
+
=begin
|
|
142
|
+
@name,
|
|
143
|
+
@x_path =
|
|
144
|
+
xml_object.attribute( 'name' ),
|
|
145
|
+
"%s/*//object[@type='%s' and @id='%s']" % [
|
|
146
|
+
@parent.x_path,
|
|
147
|
+
@type = xml_object.attribute( 'type' ),
|
|
148
|
+
@id = xml_object.attribute( 'id' )
|
|
149
|
+
]
|
|
150
|
+
=end
|
|
151
|
+
|
|
152
|
+
@name, @x_path = xml_object.attribute( 'name' ), "#{ @parent.x_path }/*//object[@type='#{ @type = xml_object.attribute( 'type' ) }' and @id='#{ @id = xml_object.attribute( 'id' ) }']"
|
|
153
|
+
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
# Returns a XML node representing this test object.
|
|
157
|
+
#
|
|
158
|
+
# === returns
|
|
159
|
+
# LibXML::XML::Node:: XML representation of this test object
|
|
160
|
+
# === raises
|
|
161
|
+
# TestObjectNotFoundError:: The test object does not exist on the SUT any longer.
|
|
162
|
+
def xml_data()
|
|
163
|
+
|
|
164
|
+
#Kernel::raise MobyBase::TestObjectNotFoundError.new( 'The test object does not exist on the sut anymore.' ) if ( elements = @sut.xml_data.xpath( @x_path ) ).size.zero?
|
|
165
|
+
|
|
166
|
+
#Kernel::raise MobyBase::TestObjectNotFoundError.new( "The test object with id: \"#{ @id.to_s }\", type: \"#{ @type.to_s }\" and name: \"#{ @name.to_s }\" does not exist on sut \"#{ @sut.id.to_s }\" anymore" ) if ( elements = @sut.xml_data.xpath( @x_path ) ).size.zero?
|
|
167
|
+
|
|
168
|
+
Kernel::raise MobyBase::TestObjectNotFoundError.new( 'The test object (id: "%s", type: "%s", name: "%s") does not exist on sut (%s) anymore' % [ @id, @type, @name, @sut.id ] ) if ( elements = @sut.xml_data.xpath( @x_path ) ).size.zero?
|
|
169
|
+
|
|
170
|
+
elements.first
|
|
171
|
+
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
# enable hooking for performance measurement & debug logging
|
|
175
|
+
MobyUtil::Hooking.instance.hook_methods( self ) if defined?( MobyUtil::Hooking )
|
|
176
|
+
|
|
177
|
+
end # TestObject
|
|
178
|
+
|
|
179
|
+
end # MobyBase
|