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,44 @@
|
|
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 MobyUtil
|
22
|
+
|
23
|
+
class DBConnection
|
24
|
+
attr_accessor :db_type, :host, :database_name, :username, :password, :dbh
|
25
|
+
|
26
|
+
# == description
|
27
|
+
# Initialize connection object
|
28
|
+
#
|
29
|
+
def initialize( db_type, host, database_name, username, password )
|
30
|
+
@db_type = db_type.to_s.downcase
|
31
|
+
@host = host.to_s.downcase
|
32
|
+
@database_name = database_name
|
33
|
+
@username = username
|
34
|
+
@password = password
|
35
|
+
@dbh = nil
|
36
|
+
end
|
37
|
+
|
38
|
+
# enable hoo./base/test_object/factory.rb:king for performance measurement & debug logging
|
39
|
+
TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
|
40
|
+
|
41
|
+
end # class
|
42
|
+
|
43
|
+
end # module
|
44
|
+
|
@@ -0,0 +1,34 @@
|
|
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
|
+
# This error should be raised when no database type is defined
|
23
|
+
class DbTypeNotDefinedError < CustomError; end;
|
24
|
+
|
25
|
+
# This error should be raised when not supported db type is defined
|
26
|
+
class DbTypeNotSupportedError < CustomError; end;
|
27
|
+
|
28
|
+
# This error should be raised when there is connectivity problem with sql database
|
29
|
+
class SqlConnectError < CustomError; end;
|
30
|
+
|
31
|
+
# This error should be raised when there is problem with sql query
|
32
|
+
class SqlError < CustomError; end;
|
33
|
+
|
34
|
+
end
|
@@ -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
|
+
# dbaccess related errors
|
21
|
+
require File.expand_path( File.join( File.dirname( __FILE__ ), 'error.rb' ) )
|
22
|
+
|
23
|
+
# database access module implementation
|
24
|
+
require File.expand_path( File.join( File.dirname( __FILE__ ), 'access.rb' ) )
|
25
|
+
|
26
|
+
# database connection module implementation
|
27
|
+
require File.expand_path( File.join( File.dirname( __FILE__ ), 'connection.rb' ) )
|
28
|
+
|
@@ -0,0 +1,121 @@
|
|
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 AttributeFilter
|
23
|
+
|
24
|
+
# TODO: document me
|
25
|
+
def self.add_attribute( attribute )
|
26
|
+
|
27
|
+
_attribute = attribute.to_s
|
28
|
+
|
29
|
+
unless @attributes.include?( _attribute )
|
30
|
+
|
31
|
+
@attributes << _attribute.to_s
|
32
|
+
|
33
|
+
@attributes_string = @attributes.join( ',' )
|
34
|
+
|
35
|
+
yield if block_given?
|
36
|
+
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
|
41
|
+
# TODO: document me
|
42
|
+
def self.add_attributes( attributes )
|
43
|
+
|
44
|
+
updated_list = @attributes | attributes.collect{ | value | value.to_s }
|
45
|
+
|
46
|
+
unless updated_list == @attributes
|
47
|
+
|
48
|
+
@attributes = updated_list
|
49
|
+
|
50
|
+
@attributes_string = @attributes.join( ',' )
|
51
|
+
|
52
|
+
yield if block_given?
|
53
|
+
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
|
58
|
+
# TODO: document me
|
59
|
+
def self.has_attribute?( attribute )
|
60
|
+
|
61
|
+
@attributes.include?( attribute.to_s )
|
62
|
+
|
63
|
+
end
|
64
|
+
|
65
|
+
# TODO: document me
|
66
|
+
def self.filter_string
|
67
|
+
|
68
|
+
@attributes_string
|
69
|
+
|
70
|
+
end
|
71
|
+
|
72
|
+
# TODO: document me
|
73
|
+
def self.reset
|
74
|
+
|
75
|
+
@attributes_string = ""
|
76
|
+
|
77
|
+
@attributes = []
|
78
|
+
|
79
|
+
end
|
80
|
+
|
81
|
+
class << self
|
82
|
+
|
83
|
+
private
|
84
|
+
|
85
|
+
# TODO: document me
|
86
|
+
def initialize_class
|
87
|
+
|
88
|
+
@attributes_string = ""
|
89
|
+
|
90
|
+
@attributes = []
|
91
|
+
|
92
|
+
end
|
93
|
+
|
94
|
+
end
|
95
|
+
|
96
|
+
# initialize attribute filter class
|
97
|
+
initialize_class
|
98
|
+
|
99
|
+
# enable hooking for performance measurement & debug logging
|
100
|
+
TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
|
101
|
+
|
102
|
+
end # AttributeFilter
|
103
|
+
|
104
|
+
end # TDriver
|
105
|
+
|
106
|
+
# for backwards compatibility
|
107
|
+
module MobyUtil
|
108
|
+
|
109
|
+
class DynamicAttributeFilter
|
110
|
+
|
111
|
+
def self.instance
|
112
|
+
|
113
|
+
warn_caller '$1:$2 warning: deprecated class MobyUtil::DynamicAttributeFilter; please use static TDriver::AttributeFilter class instead'
|
114
|
+
|
115
|
+
TDriver::AttributeFilter
|
116
|
+
|
117
|
+
end
|
118
|
+
|
119
|
+
end # DynamicAttributeFilter
|
120
|
+
|
121
|
+
end # MobyUtil
|
@@ -0,0 +1,29 @@
|
|
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
|
+
# dynamic attribute filter module
|
23
|
+
'attribute_filter.rb'
|
24
|
+
|
25
|
+
].each{ | filename |
|
26
|
+
|
27
|
+
require File.expand_path( File.join( File.dirname( __FILE__ ), filename ) )
|
28
|
+
|
29
|
+
}
|
@@ -0,0 +1,22 @@
|
|
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
|
+
# fixture services module
|
21
|
+
require File.expand_path( File.join( File.dirname( __FILE__ ), 'service.rb' ) )
|
22
|
+
|
@@ -0,0 +1,211 @@
|
|
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 FixturePluginService
|
23
|
+
|
24
|
+
# remove all public methods
|
25
|
+
instance_methods.each{ | method |
|
26
|
+
|
27
|
+
undef_method( method ) unless method =~ /^__|^(methods|inspect|to_s|class|nil?|extend)/
|
28
|
+
|
29
|
+
}
|
30
|
+
|
31
|
+
# TODO: document me
|
32
|
+
def initialize( options = {} )
|
33
|
+
|
34
|
+
# verify that options is type of hash
|
35
|
+
options.check_type Hash, 'wrong argument type $1 for fixture service options (expected $2)'
|
36
|
+
|
37
|
+
# verify that name is defined in options hash
|
38
|
+
options.require_key :name
|
39
|
+
|
40
|
+
options.require_key :arguments
|
41
|
+
|
42
|
+
options.require_key :target
|
43
|
+
|
44
|
+
options.require_key :configuration
|
45
|
+
|
46
|
+
# store given options
|
47
|
+
@options = options
|
48
|
+
|
49
|
+
# store caller backtrace
|
50
|
+
@caller = caller
|
51
|
+
|
52
|
+
self
|
53
|
+
|
54
|
+
end
|
55
|
+
|
56
|
+
def method_missing( fixture_method, arguments = {} )
|
57
|
+
|
58
|
+
begin
|
59
|
+
|
60
|
+
arguments.check_type Hash, 'wrong argument type $1 for fixture method arguments (expected $2)'
|
61
|
+
|
62
|
+
result = nil
|
63
|
+
|
64
|
+
_async = @options[ :arguments ][ :async ].true?
|
65
|
+
|
66
|
+
_target = @options[ :target ]
|
67
|
+
|
68
|
+
_fixture_name = @options[ :name ].to_s
|
69
|
+
|
70
|
+
_fixture_method = fixture_method.to_s
|
71
|
+
|
72
|
+
_sut = _target.sut
|
73
|
+
|
74
|
+
params = { :name => _fixture_name.to_s, :command_name => _fixture_method, :parameters => arguments, :async => _async }
|
75
|
+
|
76
|
+
if _target.sut?
|
77
|
+
|
78
|
+
params.merge!( :application_id => nil, :object_id => _target.id, :object_type => :Application )
|
79
|
+
|
80
|
+
else
|
81
|
+
|
82
|
+
params.merge!( :application_id => _target.get_application_id, :object_id => _target.id, :object_type => _target.attribute( 'objectType' ).to_sym )
|
83
|
+
|
84
|
+
end
|
85
|
+
|
86
|
+
result = _sut.execute_command( MobyCommand::Fixture.new( params ) )
|
87
|
+
|
88
|
+
rescue
|
89
|
+
|
90
|
+
$logger.behaviour "FAIL;Failed when calling fixture #{ @options[:arguments ].inspect } with name #{ _fixture_name.inspect }, method #{ _fixture_method.inspect } and parameters #{ arguments.inspect }.;#{ _target.id.to_s };sut;{};fixture;"
|
91
|
+
|
92
|
+
raise MobyBase::BehaviourError.new("Fixture", "Failed when calling fixture #{ @options[:arguments ].inspect } with name #{ _fixture_name.inspect }, method #{ _fixture_method.inspect } and parameters #{ arguments.inspect }")
|
93
|
+
|
94
|
+
end
|
95
|
+
|
96
|
+
$logger.behaviour "PASS;The fixture command (#{ @options[ :arguments ]}) was executed successfully with name #{ _fixture_name.inspect }, method #{ _fixture_method.inspect } and parameters #{ arguments.inspect }.;#{ _target.id.to_s };sut;{};fixture;"
|
97
|
+
|
98
|
+
result
|
99
|
+
|
100
|
+
end
|
101
|
+
|
102
|
+
end # FixturePluginService
|
103
|
+
|
104
|
+
module FixtureSetupFunctions
|
105
|
+
|
106
|
+
def []( name )
|
107
|
+
|
108
|
+
name.check_type [ String, Symbol ], 'wrong argument type $1 for fixture name (expected $2)'
|
109
|
+
|
110
|
+
@target.parameter[ :fixtures ].fetch( name.to_sym ){ | name |
|
111
|
+
|
112
|
+
raise MobyBase::BehaviourError.new( "Fixture", "Failed to execute fixture due to #{ name.to_s.inspect } not found for #{ @target.sut.id.inspect }" )
|
113
|
+
|
114
|
+
}
|
115
|
+
|
116
|
+
end
|
117
|
+
|
118
|
+
def []=( name, plugin )
|
119
|
+
|
120
|
+
name.check_type [ String, Symbol ], 'wrong argument type $1 for fixture name (expected $2)'
|
121
|
+
|
122
|
+
plugin.check_type [ String ], 'wrong argument type $1 for fixture pluin name (expected $2)'
|
123
|
+
|
124
|
+
name = name.to_sym
|
125
|
+
|
126
|
+
plugin = plugin.to_s
|
127
|
+
|
128
|
+
# create fixtures configuration hash unless already exists
|
129
|
+
@target.parameter[ :fixtures ] = {} unless @target.parameter.has_key?( :fixtures )
|
130
|
+
|
131
|
+
if @target.parameter[ :fixtures ].has_key?( name )
|
132
|
+
|
133
|
+
# retrieve existing fixture configuration
|
134
|
+
fixture_hash = @target.parameter[ :fixtures ][ name ]
|
135
|
+
|
136
|
+
else
|
137
|
+
|
138
|
+
# fixture was not found from hash, add sut environment to hash
|
139
|
+
fixture_hash = { :env => @target.instance_variable_get(:@environment) }
|
140
|
+
|
141
|
+
end
|
142
|
+
|
143
|
+
# store plugin name to hash
|
144
|
+
fixture_hash[ :plugin ] = plugin
|
145
|
+
|
146
|
+
# store fixture settings to fixtures configuration hash
|
147
|
+
@target.parameter[ :fixtures ][ name ] = fixture_hash
|
148
|
+
|
149
|
+
self
|
150
|
+
|
151
|
+
end
|
152
|
+
|
153
|
+
end
|
154
|
+
|
155
|
+
class FixtureService
|
156
|
+
|
157
|
+
# remove all public methods
|
158
|
+
instance_methods.each{ | method |
|
159
|
+
|
160
|
+
undef_method( method ) unless method =~ /^__|^(methods|inspect|to_s|class|nil?|extend)/
|
161
|
+
|
162
|
+
}
|
163
|
+
|
164
|
+
# TODO: document me
|
165
|
+
def initialize( options = {} )
|
166
|
+
|
167
|
+
# verify that options is type of hash
|
168
|
+
options.check_type Hash, 'wrong argument type $1 for fixture service options (expected $2)'
|
169
|
+
|
170
|
+
# verify that target object is defined in options hash
|
171
|
+
options.require_key :target
|
172
|
+
|
173
|
+
# store given options
|
174
|
+
@options = options
|
175
|
+
|
176
|
+
# store sut variable
|
177
|
+
@target = options[ :target ]
|
178
|
+
|
179
|
+
# store caller backtrace
|
180
|
+
@caller = caller
|
181
|
+
|
182
|
+
# extend with fixture setup functions if self is kind of sut
|
183
|
+
extend FixtureSetupFunctions if @target.sut?
|
184
|
+
|
185
|
+
self
|
186
|
+
|
187
|
+
end
|
188
|
+
|
189
|
+
def method_missing( name, arguments = {} )
|
190
|
+
|
191
|
+
arguments.check_type Hash, 'wrong argument type $1 for fixture options (expected $2)'
|
192
|
+
|
193
|
+
_fixtures = $parameters[ @target.sut.id ][ :fixtures, {} ]
|
194
|
+
|
195
|
+
if _fixtures.has_key?( name )
|
196
|
+
|
197
|
+
FixturePluginService.new( :target => @target, :name => name, :arguments => arguments, :configuration => _fixtures[ name ] )
|
198
|
+
|
199
|
+
else
|
200
|
+
|
201
|
+
$logger.behaviour "FAIL;Failed to execute fixture due to #{ name.inspect } not foudn for #{ @target.sut.id.inspect }.;#{ @target.id.to_s };sut;{};fixture;"
|
202
|
+
|
203
|
+
raise MobyBase::BehaviourError.new( "Fixture", "Failed to execute fixture due to #{ name.to_s.inspect } not found for #{ @target.sut.id.inspect }" )
|
204
|
+
|
205
|
+
end
|
206
|
+
|
207
|
+
end
|
208
|
+
|
209
|
+
end # FixtureService
|
210
|
+
|
211
|
+
end # TDriver
|