cutedriver-driver 2.0.0.20210120164037
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.
- checksums.yaml +7 -0
- data/README.md +16 -0
- data/bin/start_app_perf +200 -0
- data/bin/tdriver-devtools +3 -0
- data/config/sut_parameters.rb +52 -0
- data/config/sut_setup.rb +32 -0
- data/config/sut_teardown.rb +32 -0
- data/config/tdriver_custom_error_recovery.rb +83 -0
- data/ext/extconf.rb +70 -0
- data/ext/native_extensions.c +315 -0
- data/lib/matti.rb +25 -0
- data/lib/tdriver-devtools/behaviour/old/xml/example/flick-example.rb +120 -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 +1945 -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/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 +917 -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 +2170 -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/behaviour_example.rb +100 -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 +23 -0
- data/lib/tdriver/base/behaviour/abstract.rb +29 -0
- data/lib/tdriver/base/behaviour/behaviours/object_abstract.rb +107 -0
- data/lib/tdriver/base/behaviour/behaviours/object_behaviour_composition.rb +99 -0
- data/lib/tdriver/base/behaviour/behaviours/object_behaviour_description.rb +278 -0
- data/lib/tdriver/base/behaviour/behaviours/object_composition.rb +119 -0
- data/lib/tdriver/base/behaviour/factory.rb +495 -0
- data/lib/tdriver/base/behaviour/loader.rb +46 -0
- data/lib/tdriver/base/command_data/command_data.rb +51 -0
- data/lib/tdriver/base/command_data/loader.rb +29 -0
- data/lib/tdriver/base/controller/abstraction.rb +56 -0
- data/lib/tdriver/base/controller/loader.rb +21 -0
- data/lib/tdriver/base/errors.rb +134 -0
- data/lib/tdriver/base/loader.rb +47 -0
- data/lib/tdriver/base/state_object.rb +373 -0
- data/lib/tdriver/base/sut/adapter.rb +54 -0
- data/lib/tdriver/base/sut/controller.rb +151 -0
- data/lib/tdriver/base/sut/factory.rb +339 -0
- data/lib/tdriver/base/sut/generic/behaviours/agent.rb +77 -0
- data/lib/tdriver/base/sut/generic/behaviours/application.rb +427 -0
- data/lib/tdriver/base/sut/generic/behaviours/controller.rb +67 -0
- data/lib/tdriver/base/sut/generic/behaviours/find.rb +107 -0
- data/lib/tdriver/base/sut/generic/behaviours/flash_behaviour.rb +337 -0
- data/lib/tdriver/base/sut/generic/behaviours/sut.rb +1888 -0
- data/lib/tdriver/base/sut/generic/behaviours/switchbox_behaviour.rb +210 -0
- data/lib/tdriver/base/sut/generic/behaviours/verification.rb +222 -0
- data/lib/tdriver/base/sut/generic/commands/agent.rb +43 -0
- data/lib/tdriver/base/sut/generic/commands/application.rb +274 -0
- data/lib/tdriver/base/sut/generic/commands/fixture.rb +47 -0
- data/lib/tdriver/base/sut/generic/commands/key_sequence.rb +94 -0
- data/lib/tdriver/base/sut/generic/commands/screen_capture.rb +64 -0
- data/lib/tdriver/base/sut/generic/plugin.rb +97 -0
- data/lib/tdriver/base/sut/loader.rb +35 -0
- data/lib/tdriver/base/sut/sut.rb +98 -0
- data/lib/tdriver/base/test_object/abstract.rb +208 -0
- data/lib/tdriver/base/test_object/adapter.rb +740 -0
- data/lib/tdriver/base/test_object/behaviours/syncronization.rb +144 -0
- data/lib/tdriver/base/test_object/behaviours/test_object.rb +1047 -0
- data/lib/tdriver/base/test_object/cache.rb +134 -0
- data/lib/tdriver/base/test_object/factory.rb +684 -0
- data/lib/tdriver/base/test_object/loader.rb +51 -0
- data/lib/tdriver/base/test_object/verification.rb +178 -0
- data/lib/tdriver/base/test_object/xml/abstraction.rb +63 -0
- data/lib/tdriver/base/test_object/xml/adapter.rb +773 -0
- data/lib/tdriver/env.rb +21 -0
- data/lib/tdriver/loader.rb +57 -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 +168 -0
- data/lib/tdriver/report/error_recovery/tdriver_error_recovery_settings.rb +106 -0
- data/lib/tdriver/report/report.rb +61 -0
- data/lib/tdriver/report/report_api.rb +348 -0
- data/lib/tdriver/report/report_combine.rb +86 -0
- data/lib/tdriver/report/report_crash_file_capture.rb +178 -0
- data/lib/tdriver/report/report_creator.rb +665 -0
- data/lib/tdriver/report/report_cucumber.rb +158 -0
- data/lib/tdriver/report/report_cucumber_listener.rb +184 -0
- data/lib/tdriver/report/report_cucumber_reporter.rb +181 -0
- data/lib/tdriver/report/report_data_presentation.rb +156 -0
- data/lib/tdriver/report/report_data_table.rb +64 -0
- data/lib/tdriver/report/report_execution_statistics.rb +400 -0
- data/lib/tdriver/report/report_file_capture.rb +159 -0
- data/lib/tdriver/report/report_graph_generator.rb +59 -0
- data/lib/tdriver/report/report_grouping.rb +541 -0
- data/lib/tdriver/report/report_javascript.rb +199 -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 +725 -0
- data/lib/tdriver/report/report_test_run.rb +1476 -0
- data/lib/tdriver/report/report_test_unit.rb +223 -0
- data/lib/tdriver/report/report_writer.rb +1621 -0
- data/lib/tdriver/tdriver.rb +209 -0
- data/lib/tdriver/util/agent/loader.rb +22 -0
- data/lib/tdriver/util/agent/service.rb +107 -0
- data/lib/tdriver/util/common/array.rb +39 -0
- data/lib/tdriver/util/common/boolean.rb +48 -0
- data/lib/tdriver/util/common/crc16.rb +149 -0
- data/lib/tdriver/util/common/environment.rb +154 -0
- data/lib/tdriver/util/common/error.rb +40 -0
- data/lib/tdriver/util/common/exception.rb +53 -0
- data/lib/tdriver/util/common/exceptions.rb +12 -0
- data/lib/tdriver/util/common/file.rb +328 -0
- data/lib/tdriver/util/common/gem.rb +109 -0
- data/lib/tdriver/util/common/hash.rb +288 -0
- data/lib/tdriver/util/common/kernel.rb +253 -0
- data/lib/tdriver/util/common/loader.rb +47 -0
- data/lib/tdriver/util/common/numeric.rb +159 -0
- data/lib/tdriver/util/common/object.rb +159 -0
- data/lib/tdriver/util/common/retryable.rb +179 -0
- data/lib/tdriver/util/common/stackable.rb +185 -0
- data/lib/tdriver/util/common/string.rb +174 -0
- data/lib/tdriver/util/database/access.rb +240 -0
- data/lib/tdriver/util/database/connection.rb +44 -0
- data/lib/tdriver/util/database/error.rb +34 -0
- data/lib/tdriver/util/database/loader.rb +28 -0
- data/lib/tdriver/util/filters/attribute_filter.rb +121 -0
- data/lib/tdriver/util/filters/loader.rb +29 -0
- data/lib/tdriver/util/fixture/loader.rb +22 -0
- data/lib/tdriver/util/fixture/service.rb +211 -0
- data/lib/tdriver/util/hooking/hooking.rb +477 -0
- data/lib/tdriver/util/keymap/keymap.rb +81 -0
- data/lib/tdriver/util/loader.rb +80 -0
- data/lib/tdriver/util/localisation/error.rb +31 -0
- data/lib/tdriver/util/localisation/loader.rb +25 -0
- data/lib/tdriver/util/localisation/localisation.rb +762 -0
- data/lib/tdriver/util/logger/loader.rb +22 -0
- data/lib/tdriver/util/logger/logger.rb +591 -0
- data/lib/tdriver/util/operator_data/error.rb +29 -0
- data/lib/tdriver/util/operator_data/loader.rb +27 -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/error.rb +48 -0
- data/lib/tdriver/util/parameter/loader.rb +25 -0
- data/lib/tdriver/util/parameter/parameter.rb +1161 -0
- data/lib/tdriver/util/plugin/abstract.rb +61 -0
- data/lib/tdriver/util/plugin/error.rb +0 -0
- data/lib/tdriver/util/plugin/loader.rb +28 -0
- data/lib/tdriver/util/plugin/service.rb +319 -0
- data/lib/tdriver/util/recorder/loader.rb +25 -0
- data/lib/tdriver/util/recorder/recorder.rb +72 -0
- data/lib/tdriver/util/recorder/scripter.rb +294 -0
- data/lib/tdriver/util/statistics/statistics.rb +89 -0
- data/lib/tdriver/util/user_data/error.rb +28 -0
- data/lib/tdriver/util/user_data/loader.rb +25 -0
- data/lib/tdriver/util/user_data/user_data.rb +104 -0
- data/lib/tdriver/util/video/camera.rb +67 -0
- data/lib/tdriver/util/video/camera_linux.rb +153 -0
- data/lib/tdriver/util/video/camera_windows.rb +174 -0
- data/lib/tdriver/util/video/loader.rb +31 -0
- data/lib/tdriver/util/video/video_utils.rb +139 -0
- data/lib/tdriver/util/xml/abstraction.rb +117 -0
- data/lib/tdriver/util/xml/attribute.rb +32 -0
- data/lib/tdriver/util/xml/builder.rb +53 -0
- data/lib/tdriver/util/xml/comment.rb +32 -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 +62 -0
- data/lib/tdriver/util/xml/nil_node.rb +95 -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 +21 -0
- data/lib/tdriver/util/xml/parsers/nokogiri/abstraction.rb +167 -0
- data/lib/tdriver/util/xml/parsers/nokogiri/attribute.rb +66 -0
- data/lib/tdriver/util/xml/parsers/nokogiri/builder.rb +64 -0
- data/lib/tdriver/util/xml/parsers/nokogiri/comment.rb +39 -0
- data/lib/tdriver/util/xml/parsers/nokogiri/document.rb +66 -0
- data/lib/tdriver/util/xml/parsers/nokogiri/element.rb +39 -0
- data/lib/tdriver/util/xml/parsers/nokogiri/loader.rb +58 -0
- data/lib/tdriver/util/xml/parsers/nokogiri/node.rb +212 -0
- data/lib/tdriver/util/xml/parsers/nokogiri/nodeset.rb +237 -0
- data/lib/tdriver/util/xml/parsers/nokogiri/text.rb +39 -0
- data/lib/tdriver/util/xml/text.rb +32 -0
- data/lib/tdriver/util/xml/xml.rb +332 -0
- data/lib/tdriver/verify/verify.rb +2398 -0
- data/lib/tdriver/version.rb +21 -0
- data/xml/behaviours/generic.xml +530 -0
- data/xml/defaults/generic.xml +11 -0
- data/xml/defaults/sut_generic.xml +8 -0
- data/xml/parameters/tdriver_parameters.xml +23 -0
- data/xml/templates/generic.xml +292 -0
- metadata +324 -0
@@ -0,0 +1,61 @@
|
|
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
|
+
module MobyUtil
|
21
|
+
|
22
|
+
# TDriver plugin abstraction class
|
23
|
+
class Plugin
|
24
|
+
|
25
|
+
## plugin configuration, constructor and deconstructor methods
|
26
|
+
def self.plugin_name
|
27
|
+
|
28
|
+
raise PluginError, "Plugin name not defined in implementation (#{ self.name })"
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.plugin_type
|
33
|
+
|
34
|
+
raise PluginError, "Plugin type not defined in implementation (#{ self.name })"
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
def self.plugin_required_tdriver_version
|
39
|
+
|
40
|
+
raise PluginError, "Required TDriver version not defined in plugin implementation (#{ self.name })"
|
41
|
+
|
42
|
+
end
|
43
|
+
|
44
|
+
def self.register_plugin
|
45
|
+
|
46
|
+
# this method will be called when plugin is registered
|
47
|
+
|
48
|
+
end
|
49
|
+
|
50
|
+
def self.unregister_plugin
|
51
|
+
|
52
|
+
# this method will be called when plugin is unregistered
|
53
|
+
|
54
|
+
end
|
55
|
+
|
56
|
+
# enable hooking for performance measurement & debug logging
|
57
|
+
TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
|
58
|
+
|
59
|
+
end # Plugin
|
60
|
+
|
61
|
+
end # MobyUtil
|
Binary file
|
@@ -0,0 +1,28 @@
|
|
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
|
+
# plugin service related errors
|
21
|
+
require File.expand_path( File.join( File.dirname( __FILE__ ), 'error.rb' ) )
|
22
|
+
|
23
|
+
# abstraction class for plugins
|
24
|
+
require File.expand_path( File.join( File.dirname( __FILE__ ), 'abstract.rb' ) )
|
25
|
+
|
26
|
+
# plugin service module
|
27
|
+
require File.expand_path( File.join( File.dirname( __FILE__ ), 'service.rb' ) )
|
28
|
+
|
@@ -0,0 +1,319 @@
|
|
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
|
+
module TDriver
|
21
|
+
|
22
|
+
class PluginService
|
23
|
+
|
24
|
+
# private methods and variables
|
25
|
+
class << self
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
# TODO: document me
|
30
|
+
def initialize_class
|
31
|
+
|
32
|
+
reset_plugins_list
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
# TODO: document me
|
37
|
+
def reset_plugins_list
|
38
|
+
|
39
|
+
# list of registered plugins
|
40
|
+
@registered_plugins = {}
|
41
|
+
|
42
|
+
# list of enabled plugins
|
43
|
+
@enabled_plugins = []
|
44
|
+
|
45
|
+
@plugin_order = []
|
46
|
+
|
47
|
+
end
|
48
|
+
|
49
|
+
# TODO: document me
|
50
|
+
def delete_plugin( plugin_name )
|
51
|
+
|
52
|
+
# remove from the plugins hash
|
53
|
+
@registered_plugins.delete( plugin_name )
|
54
|
+
|
55
|
+
# remove plugin from enabled plugins list
|
56
|
+
@enabled_plugins.delete( plugin_name )
|
57
|
+
|
58
|
+
end
|
59
|
+
|
60
|
+
# TODO: document me
|
61
|
+
def plugin_data_value( plugin_module, value_name, optional = false )
|
62
|
+
|
63
|
+
begin
|
64
|
+
|
65
|
+
plugin_module.send( value_name.to_sym )
|
66
|
+
|
67
|
+
rescue NoMethodError
|
68
|
+
|
69
|
+
raise RuntimeError, "Plugin must have #{ value_name.to_s } value defined" if !optional
|
70
|
+
|
71
|
+
rescue Exception
|
72
|
+
|
73
|
+
raise
|
74
|
+
|
75
|
+
end
|
76
|
+
|
77
|
+
end
|
78
|
+
|
79
|
+
def update_enabled_plugins_list
|
80
|
+
|
81
|
+
@enabled_plugins = @plugin_order.inject([]){ | result, name |
|
82
|
+
|
83
|
+
result << name if @registered_plugins.fetch( name, {} )[ :enabled ].true?
|
84
|
+
|
85
|
+
result
|
86
|
+
|
87
|
+
}
|
88
|
+
|
89
|
+
end
|
90
|
+
|
91
|
+
end # self
|
92
|
+
|
93
|
+
# TODO: document me
|
94
|
+
def self.registered_plugins( type = nil )
|
95
|
+
|
96
|
+
# return all or plugins of given type
|
97
|
+
Hash[ @registered_plugins.select{ | key, value | type.nil? || value[ :type ] == type } ]
|
98
|
+
|
99
|
+
end
|
100
|
+
|
101
|
+
# returns true if plugin is registered, plugin type can be given as optional parameter
|
102
|
+
def self.plugin_registered?( plugin_name, type = nil )
|
103
|
+
|
104
|
+
# check if given plugin is registered
|
105
|
+
if @registered_plugins.has_key?( plugin_name )
|
106
|
+
|
107
|
+
unless type.nil?
|
108
|
+
|
109
|
+
# plugin registered, compare that given plugin type matches
|
110
|
+
@registered_plugins[ plugin_name ][ :type ] == type
|
111
|
+
|
112
|
+
else
|
113
|
+
|
114
|
+
# plugin registered, no specific plugin type given
|
115
|
+
true
|
116
|
+
|
117
|
+
end
|
118
|
+
|
119
|
+
else
|
120
|
+
|
121
|
+
# plugin not registered, not found from registered_plugins list
|
122
|
+
false
|
123
|
+
|
124
|
+
end
|
125
|
+
|
126
|
+
end
|
127
|
+
|
128
|
+
# TODO: document me
|
129
|
+
def self.enabled_plugins
|
130
|
+
|
131
|
+
@enabled_plugins
|
132
|
+
|
133
|
+
end
|
134
|
+
|
135
|
+
# TODO: document me
|
136
|
+
def self.enable_plugin( plugin_name )
|
137
|
+
|
138
|
+
begin
|
139
|
+
|
140
|
+
# enable plugin
|
141
|
+
@registered_plugins[ plugin_name ][ :enabled ] = true
|
142
|
+
|
143
|
+
# add name to enabled plugins list
|
144
|
+
#@enabled_plugins << plugin_name unless @enabled_plugins.include?( plugin_name )
|
145
|
+
|
146
|
+
update_enabled_plugins_list
|
147
|
+
|
148
|
+
rescue
|
149
|
+
|
150
|
+
raise ArgumentError, "No such plugin registered #{ plugin_name }"
|
151
|
+
|
152
|
+
end
|
153
|
+
|
154
|
+
end
|
155
|
+
|
156
|
+
# TODO: document me
|
157
|
+
def self.disable_plugin( plugin_name )
|
158
|
+
|
159
|
+
begin
|
160
|
+
|
161
|
+
# disable plugin
|
162
|
+
@registered_plugins[ plugin_name ][ :enabled ] = false
|
163
|
+
|
164
|
+
# remove name from enabled plugins list
|
165
|
+
#@enabled_plugins.delete( plugin_name )
|
166
|
+
|
167
|
+
update_enabled_plugins_list
|
168
|
+
|
169
|
+
rescue
|
170
|
+
|
171
|
+
raise ArgumentError, "No such plugin registered #{ plugin_name }"
|
172
|
+
|
173
|
+
end
|
174
|
+
|
175
|
+
end
|
176
|
+
|
177
|
+
# TODO: document me
|
178
|
+
def self.plugin_enabled?( plugin_name )
|
179
|
+
|
180
|
+
@enabled_plugins.include?( plugin_name )
|
181
|
+
|
182
|
+
end
|
183
|
+
|
184
|
+
# TODO: document me
|
185
|
+
def self.register_plugin( plugin_module )
|
186
|
+
|
187
|
+
# retrieve plugin name
|
188
|
+
plugin_name = plugin_data_value( plugin_module, :plugin_name )
|
189
|
+
|
190
|
+
# throw exception if plugin is already registered
|
191
|
+
raise ArgumentError, "Plugin #{ plugin_name } is already registered" if @registered_plugins.has_key?( plugin_name )
|
192
|
+
|
193
|
+
# plugin configuration
|
194
|
+
@registered_plugins[ plugin_name ] = {
|
195
|
+
|
196
|
+
# store plugin type
|
197
|
+
:type => plugin_data_value( plugin_module, :plugin_type ),
|
198
|
+
|
199
|
+
# store plugin implementation module name
|
200
|
+
:plugin_module => plugin_module,
|
201
|
+
|
202
|
+
# set plugin to enabled state
|
203
|
+
:enabled => true
|
204
|
+
|
205
|
+
}
|
206
|
+
|
207
|
+
@plugin_order << plugin_name
|
208
|
+
|
209
|
+
# register plugin
|
210
|
+
plugin_module.register_plugin
|
211
|
+
|
212
|
+
# add name to enabled plugins list
|
213
|
+
#@enabled_plugins << plugin_name unless @enabled_plugins.include?( plugin_name )
|
214
|
+
|
215
|
+
update_enabled_plugins_list
|
216
|
+
|
217
|
+
end
|
218
|
+
|
219
|
+
# TODO: document me
|
220
|
+
def self.unregister_plugin( plugin_name )
|
221
|
+
|
222
|
+
begin
|
223
|
+
|
224
|
+
# call plugin unregister mechanism
|
225
|
+
@registered_plugins[ plugin_name ][ :plugin_module ].unregister_plugin
|
226
|
+
|
227
|
+
# remove from the plugins hash
|
228
|
+
@registered_plugins.delete( plugin_name )
|
229
|
+
|
230
|
+
# remove from the plugins hash
|
231
|
+
@enabled_plugins.delete( plugin_name )
|
232
|
+
|
233
|
+
update_enabled_plugins_list
|
234
|
+
|
235
|
+
# remove from plugins list (registration order)
|
236
|
+
@plugin_order.delete( plugin_name )
|
237
|
+
|
238
|
+
rescue
|
239
|
+
|
240
|
+
raise ArgumentError, "Failed to unregister plugin due to plugin #{ plugin_name.inspect } is not registered"
|
241
|
+
|
242
|
+
end
|
243
|
+
|
244
|
+
end
|
245
|
+
|
246
|
+
# TODO: document me
|
247
|
+
def self.load_plugin( plugin_name )
|
248
|
+
|
249
|
+
begin
|
250
|
+
|
251
|
+
# load plugin implementation
|
252
|
+
require plugin_name
|
253
|
+
|
254
|
+
rescue LoadError
|
255
|
+
|
256
|
+
raise RuntimeError, "Error while loading plugin #{ plugin_name.to_s }. Please verify that the plugin is installed properly (#{ $!.class }: #{ $!.message })"
|
257
|
+
|
258
|
+
end
|
259
|
+
|
260
|
+
end
|
261
|
+
|
262
|
+
# TODO: document me
|
263
|
+
def self.call_plugin_method( plugin_name, method_name, *args )
|
264
|
+
|
265
|
+
begin
|
266
|
+
|
267
|
+
@registered_plugins.fetch( plugin_name ){
|
268
|
+
|
269
|
+
# in case if plugin not found from registered plugins list
|
270
|
+
raise ArgumentError, "No such plugin registered #{ plugin_name }"
|
271
|
+
|
272
|
+
}[ :plugin_module ].send( method_name.to_sym, *args )
|
273
|
+
|
274
|
+
rescue ArgumentError
|
275
|
+
|
276
|
+
# raise argument errors as is
|
277
|
+
raise
|
278
|
+
|
279
|
+
rescue
|
280
|
+
|
281
|
+
# raise all other exceptions as PluginError
|
282
|
+
raise MobyUtil::PluginError, "Error occured during calling #{ method_name } method for #{ plugin_name } (#{ $!.class }: #{ $!.message })"
|
283
|
+
|
284
|
+
end
|
285
|
+
|
286
|
+
end
|
287
|
+
|
288
|
+
# initialize plugin service
|
289
|
+
initialize_class
|
290
|
+
|
291
|
+
# enable hooking for performance measurement & debug logging
|
292
|
+
TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
|
293
|
+
|
294
|
+
end # PluginService
|
295
|
+
|
296
|
+
end
|
297
|
+
|
298
|
+
module MobyUtil
|
299
|
+
|
300
|
+
# deprecated plugin service implementation; please use TDriver::PluginService instead of this
|
301
|
+
class PluginService
|
302
|
+
|
303
|
+
# deprecated
|
304
|
+
def self.instance
|
305
|
+
|
306
|
+
# retrieve caller information
|
307
|
+
file, line = caller.first.split(":")
|
308
|
+
|
309
|
+
# show warning
|
310
|
+
warn "#{ file }:#{ line } warning: deprecated method MobyUtil::PluginService.instance#method; please use static class TDriver::PluginService#method instead"
|
311
|
+
|
312
|
+
# redirect to new implementation
|
313
|
+
TDriver::PluginService
|
314
|
+
|
315
|
+
end
|
316
|
+
|
317
|
+
end
|
318
|
+
|
319
|
+
end
|
@@ -0,0 +1,25 @@
|
|
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
|
+
# Recorder module
|
21
|
+
require File.expand_path( File.join( File.dirname( __FILE__ ), 'recorder.rb' ) )
|
22
|
+
|
23
|
+
# Scripter module
|
24
|
+
require File.expand_path( File.join( File.dirname( __FILE__ ), 'scripter.rb' ) )
|
25
|
+
|
@@ -0,0 +1,72 @@
|
|
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
|
+
# Class for recording scripts from qt applications.
|
21
|
+
# Complete test script recording not supported.
|
22
|
+
# Application must be running when recording is started and
|
23
|
+
# must not be closed as a during the recording.
|
24
|
+
|
25
|
+
module MobyUtil
|
26
|
+
|
27
|
+
class Recorder
|
28
|
+
|
29
|
+
#TODO detect app start for later versions...
|
30
|
+
def self.start_rec( app )
|
31
|
+
|
32
|
+
#raise ArgumentError.new("Application must be defined.") unless app
|
33
|
+
app.check_type( MobyBase::TestObject, "Wrong argument type $1 for application object (expected $2)" )
|
34
|
+
|
35
|
+
app.start_recording
|
36
|
+
|
37
|
+
end
|
38
|
+
|
39
|
+
# Prints the recorded events as an tdriver script fragment.
|
40
|
+
def self.print_script( sut, app, object_identificators = ['text','icontext','label'] )
|
41
|
+
|
42
|
+
# verify that sut type is type of MobyBase::SUT
|
43
|
+
#raise ArgumentError.new("Sut must be defined.") unless sut
|
44
|
+
sut.check_type( MobyBase::SUT, "Wrong argument type $1 for SUT (expected $2)" )
|
45
|
+
|
46
|
+
#raise ArgumentError.new("Application must be defined.") unless app
|
47
|
+
app.check_type( MobyBase::TestObject, "Wrong argument type $1 for application object (expected $2)" )
|
48
|
+
|
49
|
+
#raise ArgumentError.new("Object identificators must be set, use defaults if not sure what the use.") unless object_identificators
|
50
|
+
object_identificators.check_type( Array, "Wrong argument type $1 for object identificators (expected $2)" )
|
51
|
+
|
52
|
+
xml_source = app.print_recordings
|
53
|
+
|
54
|
+
app.stop_recording
|
55
|
+
|
56
|
+
MobyUtil::Scripter.new( sut.id, object_identificators ).write_fragment(
|
57
|
+
|
58
|
+
#MobyBase::StateObject.new( :source_data => xml_source ),
|
59
|
+
sut.state_object( xml_source ),
|
60
|
+
app.name
|
61
|
+
|
62
|
+
)
|
63
|
+
|
64
|
+
end
|
65
|
+
|
66
|
+
# enable hooking for performance measurement & debug logging
|
67
|
+
TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
|
68
|
+
|
69
|
+
end # Recorder
|
70
|
+
|
71
|
+
end # MobyUtil
|
72
|
+
|