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,60 @@
|
|
|
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
|
+
Kernel::raise PluginError.new( "Plugin name not defined in implementation (%s)" % [ self.name ] )
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def self.plugin_type
|
|
32
|
+
|
|
33
|
+
Kernel::raise PluginError.new( "Plugin type not defined in implementation (%s)" % [ self.name ] )
|
|
34
|
+
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def self.plugin_required_tdriver_version
|
|
38
|
+
|
|
39
|
+
Kernel::raise PluginError.new( "Required TDriver version not defined in plugin implementation (%s)" % [ self.name ] )
|
|
40
|
+
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def self.register_plugin
|
|
44
|
+
|
|
45
|
+
# this method will be called when plugin is registered
|
|
46
|
+
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def self.unregister_plugin
|
|
50
|
+
|
|
51
|
+
# this method will be called when plugin is unregistered
|
|
52
|
+
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
# enable hooking for performance measurement & debug logging
|
|
56
|
+
MobyUtil::Hooking.instance.hook_methods( self ) if defined?( MobyUtil::Hooking )
|
|
57
|
+
|
|
58
|
+
end # Plugin
|
|
59
|
+
|
|
60
|
+
end # MobyUtil
|
|
@@ -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
|
+
module MobyUtil
|
|
21
|
+
|
|
22
|
+
# plugin service related errors
|
|
23
|
+
class PluginError < MobyUtil::CustomError; end;
|
|
24
|
+
|
|
25
|
+
end # MobyUtil
|
|
@@ -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,200 @@
|
|
|
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
|
+
# Plugin service implementation
|
|
23
|
+
class PluginService
|
|
24
|
+
|
|
25
|
+
include Singleton
|
|
26
|
+
|
|
27
|
+
# intialize plugin service
|
|
28
|
+
def initialize
|
|
29
|
+
|
|
30
|
+
@@registered_plugins = {}
|
|
31
|
+
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# return all or plugins of given type
|
|
35
|
+
def registered_plugins( type = nil )
|
|
36
|
+
|
|
37
|
+
# return all or plugins of given type
|
|
38
|
+
Hash[ @@registered_plugins.select{ | key, value | type.nil? || value[ :type ] == type } ]
|
|
39
|
+
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
# returns true if plugin is registered, plugin type can be given as optional parameter
|
|
43
|
+
def plugin_registered?( plugin_name, type = nil )
|
|
44
|
+
|
|
45
|
+
# check if given plugin is registered
|
|
46
|
+
if @@registered_plugins.has_key?( plugin_name )
|
|
47
|
+
|
|
48
|
+
unless type.nil?
|
|
49
|
+
|
|
50
|
+
# plugin registered, compare that given plugin type matches
|
|
51
|
+
@@registered_plugins[ plugin_name ][ :type ] == type
|
|
52
|
+
|
|
53
|
+
else
|
|
54
|
+
|
|
55
|
+
# plugin registered, no specific plugin type given
|
|
56
|
+
true
|
|
57
|
+
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
else
|
|
61
|
+
|
|
62
|
+
# plugin not registered, not found from @@registered_plugins hash
|
|
63
|
+
false
|
|
64
|
+
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def enable_plugin( plugin_name )
|
|
70
|
+
|
|
71
|
+
( @@registered_plugins[ plugin_name ][ :enabled ] = true ) rescue Kernel::raise( ArgumentError.new( "No such plugin registered %s" % [ plugin_name ] ) )
|
|
72
|
+
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
def disable_plugin( plugin_name )
|
|
76
|
+
|
|
77
|
+
( @@registered_plugins[ plugin_name ][ :enabled ] = false ) rescue Kernel::raise( ArgumentError.new( "No such plugin registered %s" % [ plugin_name ] ) )
|
|
78
|
+
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
def plugin_enabled?( plugin_name )
|
|
82
|
+
|
|
83
|
+
( @@registered_plugins[ plugin_name ][ :enabled ] ) rescue false
|
|
84
|
+
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
def register_plugin( plugin_module )
|
|
88
|
+
|
|
89
|
+
# retrieve plugin name
|
|
90
|
+
plugin_name = plugin_data_value( plugin_module, :plugin_name )
|
|
91
|
+
|
|
92
|
+
# throw exception if plugin is already registered
|
|
93
|
+
Kernel::raise ArgumentError.new( "Plugin %s is already registered" % [ plugin_name ] ) if @@registered_plugins.has_key?( plugin_name )
|
|
94
|
+
|
|
95
|
+
# plugin configuration
|
|
96
|
+
@@registered_plugins[ plugin_name ] = {
|
|
97
|
+
:type => plugin_data_value( plugin_module, :plugin_type ),
|
|
98
|
+
:plugin_module => plugin_module,
|
|
99
|
+
:enabled => true
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
# register plugin
|
|
103
|
+
plugin_module.register_plugin
|
|
104
|
+
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
def unregister_plugin( plugin_name )
|
|
108
|
+
|
|
109
|
+
# unregister plugin, raise exception if plugin is not registered
|
|
110
|
+
( @@registered_plugins[ plugin_name ][ :plugin_module ].unregister_plugin ) rescue Kernel::raise( ArgumentError.new( "Unregister failed due to plugin %s is not registered" % [ plugin_name ] ) )
|
|
111
|
+
|
|
112
|
+
# remove from the plugins hash
|
|
113
|
+
@@registered_plugins.delete( plugin_name )
|
|
114
|
+
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
def load_plugin( plugin_name )
|
|
118
|
+
|
|
119
|
+
begin
|
|
120
|
+
|
|
121
|
+
# load plugin implementation
|
|
122
|
+
require plugin_name
|
|
123
|
+
|
|
124
|
+
rescue LoadError => exception
|
|
125
|
+
|
|
126
|
+
Kernel::raise RuntimeError.new(
|
|
127
|
+
|
|
128
|
+
"Error while loading plugin %s. Please verify that the plugin is installed properly (%s: %s)" % [ plugin_name, exception.class, exception.message ]
|
|
129
|
+
|
|
130
|
+
)
|
|
131
|
+
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
def call_plugin_method( plugin_name, method_name, *args )
|
|
137
|
+
|
|
138
|
+
begin
|
|
139
|
+
|
|
140
|
+
plugin_module = @@registered_plugins[ plugin_name ][ :plugin_module ]
|
|
141
|
+
|
|
142
|
+
rescue
|
|
143
|
+
|
|
144
|
+
Kernel::raise( ArgumentError.new( "No such plugin registered %s" % [ plugin_name ] ) )
|
|
145
|
+
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
begin
|
|
149
|
+
|
|
150
|
+
plugin_module.send( method_name.to_sym, *args )
|
|
151
|
+
|
|
152
|
+
rescue Exception => exception
|
|
153
|
+
|
|
154
|
+
raise PluginError.new( "Error occured during calling %s method for %s (%s: %s)" % [ method_name, plugin_name, exception.class, exception.message ] )
|
|
155
|
+
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
private
|
|
161
|
+
|
|
162
|
+
def reset_plugins_list
|
|
163
|
+
|
|
164
|
+
@@registered_plugins = {}
|
|
165
|
+
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
def delete_plugin( plugin_name )
|
|
169
|
+
|
|
170
|
+
# remove from the plugins hash
|
|
171
|
+
@@registered_plugins.delete( plugin_name )
|
|
172
|
+
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
def plugin_data_value( plugin_module, value_name, optional = false )
|
|
176
|
+
|
|
177
|
+
begin
|
|
178
|
+
|
|
179
|
+
result = plugin_module.send( value_name.to_sym )
|
|
180
|
+
|
|
181
|
+
rescue NoMethodError
|
|
182
|
+
|
|
183
|
+
Kernel::raise RuntimeError.new( "Plugin must have %s value defined" % [ value_name.to_s ] ) if !optional
|
|
184
|
+
|
|
185
|
+
rescue => exception
|
|
186
|
+
|
|
187
|
+
Kernel::raise exception
|
|
188
|
+
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
result
|
|
192
|
+
|
|
193
|
+
end
|
|
194
|
+
|
|
195
|
+
# enable hooking for performance measurement & debug logging
|
|
196
|
+
MobyUtil::Hooking.instance.hook_methods( self ) if defined?( MobyUtil::Hooking )
|
|
197
|
+
|
|
198
|
+
end # PluginService
|
|
199
|
+
|
|
200
|
+
end # MobyUtil
|
|
@@ -0,0 +1,292 @@
|
|
|
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
|
+
|
|
22
|
+
# Class for recording scripts from qt applications.
|
|
23
|
+
# Complete test script recording not supported.
|
|
24
|
+
# Application must be running when recording is started and
|
|
25
|
+
# must not be closed as a during the recording.
|
|
26
|
+
|
|
27
|
+
module MobyUtil
|
|
28
|
+
|
|
29
|
+
class Recorder
|
|
30
|
+
|
|
31
|
+
#TODO detect app start for later versions...
|
|
32
|
+
def self.start_rec(app)
|
|
33
|
+
|
|
34
|
+
Kernel::raise ArgumentError.new("Application must be defined.") unless app
|
|
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
|
+
Kernel::raise ArgumentError.new("Sut must be defined.") unless sut
|
|
43
|
+
Kernel::raise ArgumentError.new("Application must be defined.") unless app
|
|
44
|
+
Kernel::raise ArgumentError.new("Object identificators must be set, use defaults if not sure what the use.") unless object_identificators
|
|
45
|
+
|
|
46
|
+
xml_source = app.print_recordings
|
|
47
|
+
app.stop_recording
|
|
48
|
+
xml_as_object = MobyBase::StateObject.new( xml_source )
|
|
49
|
+
scripter = Scripter.new(sut.id, object_identificators)
|
|
50
|
+
|
|
51
|
+
scripter.write_fragment(xml_as_object, app.name)
|
|
52
|
+
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
end # Recorder
|
|
57
|
+
|
|
58
|
+
class Scripter
|
|
59
|
+
|
|
60
|
+
def initialize(sut_id, object_identificators)
|
|
61
|
+
|
|
62
|
+
@_object_identificators = object_identificators
|
|
63
|
+
|
|
64
|
+
@_tap_max_time = Parameter[sut_id][:record_tap_time_treshold].to_i
|
|
65
|
+
@_tap_min_distance = Parameter[sut_id][:record_move_treshold].to_i
|
|
66
|
+
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def write_fragment(xml_as_object, app_name)
|
|
70
|
+
|
|
71
|
+
script = "# Insert the script fragment below into your test \n"
|
|
72
|
+
script << "# Add verification points if needed. \n \n"
|
|
73
|
+
script << "# For testing the script! Do not include in your own test scripts. \n"
|
|
74
|
+
script << "@app = sut.application(:name =>'" << app_name << "') \n"
|
|
75
|
+
script << "# To test the script make sure the application is in the same state as it was when recording was started. \n\n"
|
|
76
|
+
script << "#################################### \n"
|
|
77
|
+
script << "# Begin recorded script \n"
|
|
78
|
+
script << "#################################### \n \n"
|
|
79
|
+
|
|
80
|
+
event_list = xml_as_object.events
|
|
81
|
+
event_count = event_list.attribute('eventCount').to_i
|
|
82
|
+
|
|
83
|
+
mouse_down = false
|
|
84
|
+
points = Array.new
|
|
85
|
+
active_target = nil
|
|
86
|
+
scripting = false;
|
|
87
|
+
mouse_status = 0
|
|
88
|
+
previous_time = nil
|
|
89
|
+
event = nil
|
|
90
|
+
|
|
91
|
+
for i in 0...event_count
|
|
92
|
+
|
|
93
|
+
event = event_list.event(:id => i.to_s)
|
|
94
|
+
type = event.name
|
|
95
|
+
|
|
96
|
+
previous_time = event.attribute('timeStamp').to_i unless previous_time
|
|
97
|
+
|
|
98
|
+
if type == 'MouseButtonPress'
|
|
99
|
+
active_target = get_target_details(event.child(:id => i.to_s))
|
|
100
|
+
scripting = true
|
|
101
|
+
mouse_status = 1
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
duration = get_duration(previous_time, event.attribute('timeStamp').to_i)
|
|
105
|
+
|
|
106
|
+
point = {'x' => event.attribute('windowX'), 'y' => event.attribute('windowY'), 'interval' => duration}
|
|
107
|
+
points.push(point) if scripting
|
|
108
|
+
|
|
109
|
+
previous_time = event.attribute('timeStamp').to_i
|
|
110
|
+
|
|
111
|
+
if type == 'MouseButtonRelease' and scripting
|
|
112
|
+
|
|
113
|
+
#mouse status based on the previous (if target changed no press)
|
|
114
|
+
mouse_status = 3 if mouse_status == 1
|
|
115
|
+
mouse_status = 2 if mouse_status == 0
|
|
116
|
+
script << generate_command(active_target, points, mouse_status) << "\n"
|
|
117
|
+
points.clear
|
|
118
|
+
active_target = nil
|
|
119
|
+
scripting = false
|
|
120
|
+
|
|
121
|
+
end
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
if scripting and event
|
|
125
|
+
|
|
126
|
+
script << generate_command(active_target, points, mouse_status) << "\n"
|
|
127
|
+
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
script << "\n"
|
|
131
|
+
script << "#################################### \n"
|
|
132
|
+
script << "# End recorded script \n"
|
|
133
|
+
script << "#################################### \n"
|
|
134
|
+
script
|
|
135
|
+
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
private
|
|
139
|
+
|
|
140
|
+
def add_command( mouse_status, active_target, points, duration )
|
|
141
|
+
|
|
142
|
+
fragment << fragment
|
|
143
|
+
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
def get_target_details(test_object)
|
|
147
|
+
|
|
148
|
+
target = test_object.type
|
|
149
|
+
params = Array.new
|
|
150
|
+
|
|
151
|
+
params.push(":name=>'#{ test_object.name }'")
|
|
152
|
+
|
|
153
|
+
if test_object.name.empty?
|
|
154
|
+
|
|
155
|
+
params.clear
|
|
156
|
+
|
|
157
|
+
@_object_identificators.each do |attribute|
|
|
158
|
+
|
|
159
|
+
begin
|
|
160
|
+
|
|
161
|
+
value = test_object.attribute(attribute)
|
|
162
|
+
params.push(":#{ attribute } => '#{ value }'") unless value == ""
|
|
163
|
+
|
|
164
|
+
rescue MobyBase::AttributeNotFoundError
|
|
165
|
+
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
if params.size > 0
|
|
173
|
+
|
|
174
|
+
target << "( "
|
|
175
|
+
|
|
176
|
+
until params.size == 0
|
|
177
|
+
|
|
178
|
+
target << params.pop
|
|
179
|
+
target << ", " if params.size > 0
|
|
180
|
+
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
target << " )"
|
|
184
|
+
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
target
|
|
188
|
+
end
|
|
189
|
+
|
|
190
|
+
# mouse_status:
|
|
191
|
+
# 0 = no press or release
|
|
192
|
+
# 1 = press, no release
|
|
193
|
+
# 2 = release, no press
|
|
194
|
+
# 3 = press and release
|
|
195
|
+
def generate_command(target_details, points, mouse_status)
|
|
196
|
+
|
|
197
|
+
command = "@app."
|
|
198
|
+
|
|
199
|
+
if valid_gesture?(points)
|
|
200
|
+
|
|
201
|
+
command << target_details << ".gesture_points(\n\t[\n"
|
|
202
|
+
duration = 0
|
|
203
|
+
|
|
204
|
+
for i in 0...points.size
|
|
205
|
+
|
|
206
|
+
value = points[ i ]
|
|
207
|
+
command << "\t\t{'x' => " << value[ "x" ].to_s << ", 'y' => " << value[ "y" ].to_s << ", 'interval' => " << value[ "interval" ].to_s << " }"
|
|
208
|
+
command << ", \n" unless i == points.size - 1
|
|
209
|
+
duration = duration + value[ 'interval' ]
|
|
210
|
+
|
|
211
|
+
end
|
|
212
|
+
|
|
213
|
+
command << "\n\t], \n\t" << duration.to_s << ", \n\t"
|
|
214
|
+
|
|
215
|
+
case mouse_status
|
|
216
|
+
when 0
|
|
217
|
+
command << "{ :press => false, :release => false }"
|
|
218
|
+
when 1
|
|
219
|
+
command << "{ :press => true, :release => false }"
|
|
220
|
+
when 2
|
|
221
|
+
command << "{ :press => false, :release => true }"
|
|
222
|
+
when 3
|
|
223
|
+
command << "{ :press => true, :release => true }"
|
|
224
|
+
end
|
|
225
|
+
|
|
226
|
+
command << "\n)"
|
|
227
|
+
|
|
228
|
+
command
|
|
229
|
+
|
|
230
|
+
elsif mouse_status > 0
|
|
231
|
+
|
|
232
|
+
duration = 0
|
|
233
|
+
|
|
234
|
+
points.each{|value| duration = duration + value['interval']}
|
|
235
|
+
|
|
236
|
+
if mouse_status == 1
|
|
237
|
+
|
|
238
|
+
command << target_details << ".tap_down"
|
|
239
|
+
|
|
240
|
+
elsif duration < @_tap_max_time
|
|
241
|
+
|
|
242
|
+
command << target_details << ".tap"
|
|
243
|
+
|
|
244
|
+
else
|
|
245
|
+
|
|
246
|
+
command << target_details << ".long_tap( " << duration.to_s << " )"
|
|
247
|
+
|
|
248
|
+
end
|
|
249
|
+
|
|
250
|
+
end
|
|
251
|
+
end
|
|
252
|
+
|
|
253
|
+
def valid_gesture?(points)
|
|
254
|
+
|
|
255
|
+
return false if points.size < 2
|
|
256
|
+
|
|
257
|
+
min_x = -1
|
|
258
|
+
max_x = -1
|
|
259
|
+
min_y = -1
|
|
260
|
+
max_y = -1
|
|
261
|
+
|
|
262
|
+
for i in 0...points.size
|
|
263
|
+
|
|
264
|
+
value = points[i]
|
|
265
|
+
|
|
266
|
+
x = value['x'].to_i
|
|
267
|
+
y = value['y'].to_i
|
|
268
|
+
|
|
269
|
+
min_x = x if x < min_x or min_x == -1
|
|
270
|
+
max_x = x if x > max_x or max_x == -1
|
|
271
|
+
min_y = y if y < min_y or min_y == -1
|
|
272
|
+
max_y = y if y > max_y or max_y == -1
|
|
273
|
+
|
|
274
|
+
end
|
|
275
|
+
|
|
276
|
+
return false if (max_x - min_x).abs < @_tap_min_distance and (max_y - min_y).abs < @_tap_min_distance
|
|
277
|
+
|
|
278
|
+
true
|
|
279
|
+
end
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
def get_duration(start_time, end_time)
|
|
283
|
+
duration_millis = end_time - start_time
|
|
284
|
+
#we want this in second
|
|
285
|
+
duration_millis = duration_millis.to_f
|
|
286
|
+
duration_secs = duration_millis / 1000
|
|
287
|
+
duration_secs
|
|
288
|
+
end
|
|
289
|
+
|
|
290
|
+
end # Scripter
|
|
291
|
+
|
|
292
|
+
end
|