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,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
|
+
|
|
21
|
+
module MobyController
|
|
22
|
+
|
|
23
|
+
# Abstract class SutAdapter. Not supposed to be instantiated as is
|
|
24
|
+
class SutAdapter
|
|
25
|
+
|
|
26
|
+
end # SutAdapter
|
|
27
|
+
|
|
28
|
+
end # MobyController
|
|
@@ -0,0 +1,119 @@
|
|
|
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 MobyBase
|
|
22
|
+
|
|
23
|
+
class SutController
|
|
24
|
+
|
|
25
|
+
attr_accessor :sut_controllers, :execution_order
|
|
26
|
+
|
|
27
|
+
# Creating new SutController associates SutAdapter to the controller
|
|
28
|
+
# == params
|
|
29
|
+
# sut_adapter:: MobyController::SutAdapter descendant, e.g. MobyController::QT::SutAdapter
|
|
30
|
+
# == raises
|
|
31
|
+
# NameError:: No SUT controller found for %s (%s)
|
|
32
|
+
def initialize( sut_controllers, sut_adapter )
|
|
33
|
+
|
|
34
|
+
Kernel::raise ArgumentError.new( "SUT Controller(s) must be given in String format, got #{ sut_controllers.class }" ) unless sut_controllers.kind_of? String
|
|
35
|
+
|
|
36
|
+
@sut_adapter = sut_adapter
|
|
37
|
+
|
|
38
|
+
# empty sut controllers hash
|
|
39
|
+
@sut_controllers = {}
|
|
40
|
+
|
|
41
|
+
# empty sut controller execution order, this will be used when multiple sut controllers given
|
|
42
|
+
@execution_order = []
|
|
43
|
+
|
|
44
|
+
sut_controllers.split(";").each{ | sut_controller |
|
|
45
|
+
|
|
46
|
+
begin
|
|
47
|
+
|
|
48
|
+
# controller module to extend
|
|
49
|
+
controller_module = eval( ( module_name = "MobyController::#{ sut_controller }::SutController" ) )
|
|
50
|
+
|
|
51
|
+
# add sut_controller to execution order list
|
|
52
|
+
@execution_order << sut_controller
|
|
53
|
+
|
|
54
|
+
# store controller module to cache
|
|
55
|
+
@sut_controllers[ sut_controller ] = module_name.scan( /(.+)::/ )
|
|
56
|
+
|
|
57
|
+
# extend required controller behaviour
|
|
58
|
+
self.extend controller_module
|
|
59
|
+
|
|
60
|
+
rescue NameError
|
|
61
|
+
|
|
62
|
+
Kernel::raise MobyBase::ControllerNotFoundError.new( 'No SUT controller found for %s (%s)' % [ sut_controller, module_name ] )
|
|
63
|
+
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
# Function to execute a command on a SutController
|
|
71
|
+
# This method is not meant to be overwritten in descendants.
|
|
72
|
+
#
|
|
73
|
+
# Associates MobyCommand::CommandData implementation based on the MobyCommand class name,
|
|
74
|
+
# by finding implementation from the same module as the SutController instance.
|
|
75
|
+
#
|
|
76
|
+
# example: MobyController::QT::SutController instance associates MobyController::QT::Application (module)
|
|
77
|
+
# implementation to MobyCommand::Application command_data object
|
|
78
|
+
#
|
|
79
|
+
# == params
|
|
80
|
+
# command_data:: MobyCommand::CommandData descendant
|
|
81
|
+
# == returns
|
|
82
|
+
# command_data implementation specific return value
|
|
83
|
+
# == raises
|
|
84
|
+
# ArgumentError:: if command_data is not kind of MobyController::CommandData
|
|
85
|
+
# MobyBase::CommandNotFoundError:: if no implementation is found for the CommandData object
|
|
86
|
+
def execute_command( command_data )
|
|
87
|
+
|
|
88
|
+
Kernel::raise ArgumentError.new( 'Data not of type MobyController::CommandData' ) unless command_data.kind_of?( MobyCommand::CommandData )
|
|
89
|
+
|
|
90
|
+
@execution_order.each{ | controller |
|
|
91
|
+
|
|
92
|
+
begin
|
|
93
|
+
|
|
94
|
+
# extend command_data with combinination of command data object name and module name to be extended
|
|
95
|
+
eval 'command_data.extend %s::%s' % [ @sut_controllers[ controller ], command_data.class.name.scan( /::(.+)/ ) ]
|
|
96
|
+
|
|
97
|
+
# break if controller associated succesfully
|
|
98
|
+
break
|
|
99
|
+
|
|
100
|
+
rescue NameError
|
|
101
|
+
|
|
102
|
+
# raise exception only if none controller found
|
|
103
|
+
Kernel::raise MobyBase::ControllerNotFoundError.new( 'No controller found for CommandData object %s' % command_data.inspect ) unless controller.object_id != @execution_order.last.object_id
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
command_data.set_adapter( @sut_adapter )
|
|
109
|
+
command_data.execute
|
|
110
|
+
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
# enable hooking for performance measurement & debug logging
|
|
114
|
+
MobyUtil::Hooking.instance.hook_methods( self ) if defined?( MobyUtil::Hooking )
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
end # SutController
|
|
118
|
+
|
|
119
|
+
end # MobyBase
|
|
@@ -0,0 +1,287 @@
|
|
|
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 MobyBase
|
|
22
|
+
|
|
23
|
+
# Class to create SUT objects
|
|
24
|
+
# Hides actual SUT object from the clients -> clients should be able to use the instantiated SUT object as if it was any SUT
|
|
25
|
+
class SUTFactory
|
|
26
|
+
|
|
27
|
+
include Singleton
|
|
28
|
+
|
|
29
|
+
# Initialize the singleton
|
|
30
|
+
def initialize()
|
|
31
|
+
|
|
32
|
+
reset
|
|
33
|
+
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# Create/reset hash to store sut ids for all current suts
|
|
37
|
+
def reset
|
|
38
|
+
|
|
39
|
+
@_sut_list = {}
|
|
40
|
+
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def mapped_sut?( sut_id )
|
|
44
|
+
|
|
45
|
+
MobyUtil::Parameter[ :mappings, {} ].has_key?( sut_id.to_sym )
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def get_mapped_sut( sut_id )
|
|
50
|
+
|
|
51
|
+
MobyUtil::Parameter[ :mappings ][ sut_id.to_sym ].to_sym
|
|
52
|
+
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
# Function to create the actual SUT objects based on the 'sut' attribute.
|
|
56
|
+
# === params
|
|
57
|
+
# sut_type:: sut_type - sut type, supportes all types defined by SUTFactory constants
|
|
58
|
+
# id:: id - unique identifier for identifying particular SUT from each other. Is propagated to proper initializers.
|
|
59
|
+
# === returns
|
|
60
|
+
# return:: SUT object
|
|
61
|
+
# raise::
|
|
62
|
+
# ArgumentError:: SUT ID '%s' not found from tdriver_parameters.xml
|
|
63
|
+
def make( sut_id )
|
|
64
|
+
|
|
65
|
+
# cast into symbol just in case string was passed
|
|
66
|
+
sut_id = sut_id.to_sym
|
|
67
|
+
|
|
68
|
+
sut_id = get_mapped_sut( sut_id ) if mapped_sut?( sut_id )
|
|
69
|
+
|
|
70
|
+
# if sut is already connected, return existing sut
|
|
71
|
+
return get_sut_from_list( sut_id ) if sut_exists?( sut_id )
|
|
72
|
+
|
|
73
|
+
#mapped_id = MobyUtil::Parameter[ sut_id, nil ].to_sym
|
|
74
|
+
|
|
75
|
+
# check if the sut or an alias exists in tdriver_parameters.xml
|
|
76
|
+
#mapped_id = find_sut_or_mapping( sut_id )
|
|
77
|
+
|
|
78
|
+
# if sut is already connected, return existing sut
|
|
79
|
+
#return get_sut_from_list( mapped_id ) if (mapped_id != sut_id and sut_exists?( mapped_id ))
|
|
80
|
+
|
|
81
|
+
Kernel::raise ArgumentError.new( "The SUT '#{ sut_id }' was not defined in TDriver parameters XML" ) if MobyUtil::Parameter[ sut_id, nil ].nil?
|
|
82
|
+
|
|
83
|
+
# retrieve sut type from parameters, raise exception if sut type was not found
|
|
84
|
+
Kernel::raise RuntimeError.new( "SUT type not defined for #{ sut_id } in TDriver parameters/templates XML" ) if ( sut_type = MobyUtil::Parameter[ sut_id ][ :type, nil ] ).nil?
|
|
85
|
+
|
|
86
|
+
sut_type_symbol = sut_type.downcase.to_sym
|
|
87
|
+
|
|
88
|
+
# retrieve plugin name that implements given sut
|
|
89
|
+
sut_plugin = MobyUtil::Parameter[ sut_id ][ :sut_plugin, nil ]
|
|
90
|
+
|
|
91
|
+
# verify that sut plugin is defined in sut configuration
|
|
92
|
+
Kernel::raise RuntimeError.new( "SUT plugin not defined for %s (%s)" % [ sut_id, sut_type ] ) if sut_plugin.nil?
|
|
93
|
+
|
|
94
|
+
# flag to determine that should exception be raised; allow one retry, then set flag to true if error still occures
|
|
95
|
+
raise_exception = false
|
|
96
|
+
|
|
97
|
+
begin
|
|
98
|
+
|
|
99
|
+
# verify that sut plugin is registered
|
|
100
|
+
if MobyUtil::PluginService.instance.plugin_registered?( sut_plugin, :sut )
|
|
101
|
+
|
|
102
|
+
# create sut object
|
|
103
|
+
created_sut = MobyUtil::PluginService.instance.call_plugin_method( sut_plugin, :make_sut, sut_id )
|
|
104
|
+
|
|
105
|
+
else
|
|
106
|
+
|
|
107
|
+
# raise error if sut was not registered
|
|
108
|
+
Kernel::raise NotImplementedError.new( "No plugin/implementation for SUT type: %s" % [ sut_type ] )
|
|
109
|
+
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
rescue Exception => exception
|
|
113
|
+
|
|
114
|
+
# if sut was not registered, try to load it
|
|
115
|
+
MobyUtil::PluginService.instance.load_plugin( sut_plugin ) if exception.kind_of?( NotImplementedError )
|
|
116
|
+
|
|
117
|
+
if !raise_exception
|
|
118
|
+
|
|
119
|
+
raise_exception = true
|
|
120
|
+
retry
|
|
121
|
+
else
|
|
122
|
+
|
|
123
|
+
# still errors, raise original exception
|
|
124
|
+
Kernel::raise exception
|
|
125
|
+
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
# sut type version, default: nil
|
|
131
|
+
created_sut.instance_eval {
|
|
132
|
+
@ui_type = sut_type;
|
|
133
|
+
@ui_version = MobyUtil::Parameter[ sut_id ][ :version, nil ];
|
|
134
|
+
@input = MobyUtil::Parameter[ sut_id ][ :input_type, nil ];
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
# add behaviours to sut
|
|
138
|
+
created_sut.extend( MobyBehaviour::ObjectBehaviourComposition )
|
|
139
|
+
|
|
140
|
+
# retrieve list of optional extension plugins
|
|
141
|
+
@extension_plugins = MobyUtil::Parameter[ sut_id ][ :extension_plugins, "" ].split( ";" )
|
|
142
|
+
|
|
143
|
+
# load optional extension plugins
|
|
144
|
+
if @extension_plugins.count > 0
|
|
145
|
+
|
|
146
|
+
@extension_plugins.each{ | plugin_name |
|
|
147
|
+
|
|
148
|
+
raise_exception = false
|
|
149
|
+
|
|
150
|
+
begin
|
|
151
|
+
|
|
152
|
+
# verify that extension plugin is registered
|
|
153
|
+
unless MobyUtil::PluginService.instance.plugin_registered?( plugin_name, :extension )
|
|
154
|
+
|
|
155
|
+
# raise error if sut was not registered
|
|
156
|
+
Kernel::raise NotImplementedError.new( "Extension plugin not found %s" % [ plugin_name ] )
|
|
157
|
+
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
rescue Exception => exception
|
|
161
|
+
|
|
162
|
+
# if sut was not registered, try to load it
|
|
163
|
+
MobyUtil::PluginService.instance.load_plugin( plugin_name ) if exception.kind_of?( NotImplementedError )
|
|
164
|
+
|
|
165
|
+
if !raise_exception
|
|
166
|
+
|
|
167
|
+
raise_exception = true
|
|
168
|
+
retry
|
|
169
|
+
else
|
|
170
|
+
|
|
171
|
+
# still errors, raise original exception
|
|
172
|
+
Kernel::raise exception
|
|
173
|
+
|
|
174
|
+
end
|
|
175
|
+
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
# apply sut generic behaviours
|
|
183
|
+
created_sut.apply_behaviour!(
|
|
184
|
+
:object_type => [ 'sut' ],
|
|
185
|
+
:sut_type => [ '*', sut_type.upcase ],
|
|
186
|
+
:input_type => [ '*', created_sut.input.to_s ],
|
|
187
|
+
:version => [ '*', created_sut.ui_version.to_s ]
|
|
188
|
+
)
|
|
189
|
+
|
|
190
|
+
@_sut_list[ sut_id ] = { :sut => created_sut, :is_connected => true }
|
|
191
|
+
|
|
192
|
+
created_sut
|
|
193
|
+
|
|
194
|
+
end
|
|
195
|
+
|
|
196
|
+
def disconnect_sut( id )
|
|
197
|
+
|
|
198
|
+
#cast into symbol just in case string was passed
|
|
199
|
+
id = id.to_sym
|
|
200
|
+
Kernel::raise RuntimeError.new( "Not connected to device: #{ id }" ) unless sut_exists?( id ) && @_sut_list[ id ][ :is_connected ]
|
|
201
|
+
|
|
202
|
+
@_sut_list[ id ][ :sut ].disconnect
|
|
203
|
+
@_sut_list[ id ][ :is_connected ] = false
|
|
204
|
+
|
|
205
|
+
end
|
|
206
|
+
|
|
207
|
+
def reboot_sut( id )
|
|
208
|
+
|
|
209
|
+
id = id.to_sym
|
|
210
|
+
Kernel::raise RuntimeError.new( "Not connected to device: #{ id }" ) unless sut_exists?( id ) && @_sut_list[ id ][ :is_connected ]
|
|
211
|
+
|
|
212
|
+
@_sut_list[ id ][ :sut ].reboot
|
|
213
|
+
disconnect_sut( id )
|
|
214
|
+
end
|
|
215
|
+
|
|
216
|
+
def connected_suts
|
|
217
|
+
|
|
218
|
+
@_sut_list
|
|
219
|
+
|
|
220
|
+
end
|
|
221
|
+
|
|
222
|
+
private
|
|
223
|
+
|
|
224
|
+
# gets sut from sut-factorys list - if not connected tries to reconnect first
|
|
225
|
+
def get_sut_from_list( id )
|
|
226
|
+
|
|
227
|
+
if !@_sut_list[ id ][ :is_connected ]
|
|
228
|
+
|
|
229
|
+
@_sut_list[ id ][ :sut ].connect( id )
|
|
230
|
+
@_sut_list[ id ][ :is_connected ] = true
|
|
231
|
+
|
|
232
|
+
end
|
|
233
|
+
|
|
234
|
+
@_sut_list[ id ][ :sut ]
|
|
235
|
+
end
|
|
236
|
+
|
|
237
|
+
def sut_exists?( sut_id )
|
|
238
|
+
|
|
239
|
+
@_sut_list.has_key?( sut_id )
|
|
240
|
+
|
|
241
|
+
end
|
|
242
|
+
|
|
243
|
+
# Finds the sut definition matching the id, either directly or via a mapping
|
|
244
|
+
#
|
|
245
|
+
# === params
|
|
246
|
+
# id:: Symbol defining the id of the sut to search for
|
|
247
|
+
# === returns
|
|
248
|
+
# Symbol:: Either id if it was found in the parameter file or the id of a sut mapped to this id, or nil if no direct or mapped match was found
|
|
249
|
+
# === raises
|
|
250
|
+
# ArgumentError:: The id argument was not a Symbol
|
|
251
|
+
def find_sut_or_mapping( id )
|
|
252
|
+
|
|
253
|
+
Kernel::raise ArgumentError.new( "The id argument was not a Symbol." ) unless id.kind_of?( Symbol )
|
|
254
|
+
|
|
255
|
+
begin
|
|
256
|
+
|
|
257
|
+
# check if direct match exists
|
|
258
|
+
return id if MobyUtil::Parameter[ id ]
|
|
259
|
+
|
|
260
|
+
rescue MobyUtil::ParameterNotFoundError
|
|
261
|
+
|
|
262
|
+
# check if a mapping is defined for the id
|
|
263
|
+
begin
|
|
264
|
+
|
|
265
|
+
# return nil if no mapping exists
|
|
266
|
+
return nil if ( mapped_id = MobyUtil::Parameter[ :mappings ][ id ] ).nil?
|
|
267
|
+
|
|
268
|
+
# check if the mapped to sut id exists
|
|
269
|
+
return mapped_id if MobyUtil::Parameter[ ( mapped_id = mapped_id.to_sym ) ]
|
|
270
|
+
|
|
271
|
+
rescue MobyUtil::ParameterNotFoundError
|
|
272
|
+
|
|
273
|
+
# no mappings defined in tdriver_parameters.xml or the mapped to sut was not found
|
|
274
|
+
return nil
|
|
275
|
+
|
|
276
|
+
end # check if mapping exists
|
|
277
|
+
|
|
278
|
+
end # check if direct match exists
|
|
279
|
+
|
|
280
|
+
end
|
|
281
|
+
|
|
282
|
+
# enable hooking for performance measurement & debug logging
|
|
283
|
+
MobyUtil::Hooking.instance.hook_methods( self ) if defined?( MobyUtil::Hooking )
|
|
284
|
+
|
|
285
|
+
end # SUTFactory
|
|
286
|
+
|
|
287
|
+
end # MobyBase
|
|
@@ -0,0 +1,243 @@
|
|
|
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 MobyBehaviour
|
|
21
|
+
|
|
22
|
+
# == description
|
|
23
|
+
# Describes the behaviour of application and its associated methods
|
|
24
|
+
#
|
|
25
|
+
# == behaviour
|
|
26
|
+
# GenericApplication
|
|
27
|
+
#
|
|
28
|
+
# == requires
|
|
29
|
+
# *
|
|
30
|
+
#
|
|
31
|
+
# == input_type
|
|
32
|
+
# *
|
|
33
|
+
#
|
|
34
|
+
# == sut_type
|
|
35
|
+
# *
|
|
36
|
+
#
|
|
37
|
+
# == sut_version
|
|
38
|
+
# *
|
|
39
|
+
#
|
|
40
|
+
# == objects
|
|
41
|
+
# application
|
|
42
|
+
#
|
|
43
|
+
module Application
|
|
44
|
+
|
|
45
|
+
include MobyBehaviour::Behaviour
|
|
46
|
+
|
|
47
|
+
# == description
|
|
48
|
+
# Closes the application whether or not it is on foreground. Note: this will currently always try to close applications, also
|
|
49
|
+
# privilegied applications
|
|
50
|
+
#
|
|
51
|
+
# == params
|
|
52
|
+
#options_hash:: Hash, possible keys :force_kill (default nil) and :check_proces (default true).
|
|
53
|
+
#For backwards compatibility: instead of a Hash, the value can also be true, false or nil, in which case it is taken as the value of :force_kill
|
|
54
|
+
#:force_kill:: If key is set to true, the application process is killed if close fails. If set to nil, value of key will be taken as defined
|
|
55
|
+
#by 'application_close_kill' parameter in the TDriver parameter file.
|
|
56
|
+
#:check_process:: If key is set to true, success of the close method is verified by checking if the process is still active. If set to false,
|
|
57
|
+
#TDriver will only check that the application is no longer in the foreground.
|
|
58
|
+
#
|
|
59
|
+
# === raises
|
|
60
|
+
# TestObjectNotFoundError:: If this application is not the foreground application on the device under test.
|
|
61
|
+
# VerificationError:: If no application test object is found after close or if this application is still in the foreground after the close.
|
|
62
|
+
# ArgumentError:: Options_hash was not a Hash or one of the keys had an invalid type.
|
|
63
|
+
# === example
|
|
64
|
+
# @sut.application.close #closes anonymous foreground application
|
|
65
|
+
#
|
|
66
|
+
# @mce_app = @sut.run(:name => 'Mce.exe') # launches mce app
|
|
67
|
+
# @mce_app.close # closes above launched mce-application and verifies that correct application was closed
|
|
68
|
+
def close( options_hash = {} )
|
|
69
|
+
|
|
70
|
+
begin
|
|
71
|
+
|
|
72
|
+
# check if closable
|
|
73
|
+
Kernel::raise RuntimeError( "The application is of a type that cannot be closed." ) unless self.closable?
|
|
74
|
+
|
|
75
|
+
default_options = { :force_kill => nil, :check_process => true }
|
|
76
|
+
|
|
77
|
+
if options_hash.kind_of? Hash
|
|
78
|
+
close_options = default_options.merge options_hash
|
|
79
|
+
else
|
|
80
|
+
# support legacy option of defining only force_kill
|
|
81
|
+
close_options = default_options
|
|
82
|
+
if options_hash!=nil
|
|
83
|
+
#check that old force_kill_close argument is equal to true or false
|
|
84
|
+
Kernel::raise ArgumentError.new( "Incorrect value for argument options_hash, expected a Hash or a bool 'true' or 'false'" ) unless options_hash==true or options_hash==false
|
|
85
|
+
close_options[ :force_kill ] = options_hash
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
raise ArgumentError.new "The options_hash :force_kill key must be true or false if it is defined, the used value was \"#{close_options[ :force_kill ]}\"." unless [nil, true, false].include? close_options[ :force_kill ]
|
|
90
|
+
raise ArgumentError.new "The options_hash :check_process key must be true or false if it is defined, the used value was \"#{close_options[ :check_process ]}\"." unless [true, false].include? close_options[ :check_process ]
|
|
91
|
+
|
|
92
|
+
if close_options[ :force_kill ] != nil
|
|
93
|
+
flags_hash = { }
|
|
94
|
+
flags_hash[ :force_kill ] = close_options[ :force_kill ]
|
|
95
|
+
#execute_command( command_type = nil, app_name = nil, app_uid = nil, sut = nil, arguments = nil, environment = nil, events_to_listen = nil, signals_to_listen = nil, flags = nil)
|
|
96
|
+
@sut.execute_command( MobyCommand::Application.new( :Close, self.name, self.uid, self.sut, nil, nil, nil, nil, flags_hash) )
|
|
97
|
+
else
|
|
98
|
+
@sut.execute_command( MobyCommand::Application.new( :Close, self.name, self.uid, self.sut, nil ) )
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
# Disable logging
|
|
102
|
+
MobyUtil::Logger.instance.enabled = false if ( original_logger_state = MobyUtil::Logger.instance.enabled )
|
|
103
|
+
|
|
104
|
+
# verify close results
|
|
105
|
+
begin
|
|
106
|
+
|
|
107
|
+
MobyUtil::Retryable.until(
|
|
108
|
+
:timeout => MobyUtil::Parameter[ self.sut.id ][ :application_synchronization_timeout, '60' ].to_f,
|
|
109
|
+
:interval => MobyUtil::Parameter[ self.sut.id ][ :application_synchronization_retry_interval, '0.25' ].to_f,
|
|
110
|
+
:exception => MobyBase::VerificationError,
|
|
111
|
+
:unless => MobyBase::TestObjectNotFoundError ) {
|
|
112
|
+
|
|
113
|
+
# check if the application is still found or not
|
|
114
|
+
if ( close_options[ :check_process ] == true and @sut.application( :id => self.uid, :__timeout => 0 ) )
|
|
115
|
+
|
|
116
|
+
# the application did not close
|
|
117
|
+
raise MobyBase::VerificationError.new("Verification of close failed. The application that was to be closed is still running.")
|
|
118
|
+
|
|
119
|
+
elsif ( close_options[ :check_process ] == false )
|
|
120
|
+
|
|
121
|
+
if @sut.application( :__timeout => 0 ).uid == self.uid
|
|
122
|
+
# the application was still in the foreground
|
|
123
|
+
raise MobyBase::VerificationError.new("Verification of close failed. The application that was to be closed was still in the foreground.")
|
|
124
|
+
else
|
|
125
|
+
# The foreground application was not the one being closed.
|
|
126
|
+
raise MobyBase::TestObjectNotFoundError.new( "The foreground application was not the one being closed (id: #{self.uid})." )
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
else
|
|
130
|
+
|
|
131
|
+
# The application could not be found, break
|
|
132
|
+
break;
|
|
133
|
+
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
rescue MobyBase::TestObjectNotFoundError
|
|
139
|
+
|
|
140
|
+
#puts "app.close: sut.application --> test object not found error --> ok --> exit"
|
|
141
|
+
# everything ok: application not running anymore
|
|
142
|
+
|
|
143
|
+
rescue RuntimeError => e
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
if (e.message =~ /The application with Id \d+ is no longer available/)
|
|
147
|
+
# everything ok: application not running anymore
|
|
148
|
+
else
|
|
149
|
+
# something unexpected happened during the close, let exception through
|
|
150
|
+
raise e
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
ensure
|
|
156
|
+
|
|
157
|
+
# restore original state
|
|
158
|
+
MobyUtil::Logger.instance.enabled = original_logger_state
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
rescue Exception => exception
|
|
162
|
+
|
|
163
|
+
#puts "app.close: close app failed --> exit "
|
|
164
|
+
|
|
165
|
+
MobyUtil::Logger.instance.log "behaviour", "FAIL;Failed when closing.;#{ identity };close;"
|
|
166
|
+
Kernel::raise exception
|
|
167
|
+
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
#puts "app.close: close app passed --> exit "
|
|
171
|
+
|
|
172
|
+
MobyUtil::Logger.instance.log "behaviour", "PASS;Closed successfully.;#{ identity };close;"
|
|
173
|
+
#@sut.refresh
|
|
174
|
+
@sut.application
|
|
175
|
+
nil
|
|
176
|
+
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
# == description
|
|
180
|
+
# Returns executable name (exe) of foreground application
|
|
181
|
+
# === returns
|
|
182
|
+
# String:: Name(exe) of the application.
|
|
183
|
+
# === raises
|
|
184
|
+
# RuntimeError:: No executable name has been defined for this application.
|
|
185
|
+
# === example
|
|
186
|
+
# puts @sut.application.executable_name #prints foreground executable name to console
|
|
187
|
+
def executable_name
|
|
188
|
+
|
|
189
|
+
begin
|
|
190
|
+
|
|
191
|
+
exe_name = self.attribute( 'FullName' ).to_s
|
|
192
|
+
|
|
193
|
+
rescue MobyBase::AttributeNotFoundError
|
|
194
|
+
|
|
195
|
+
begin
|
|
196
|
+
|
|
197
|
+
exe_name = self.attribute( 'exepath' ).to_s
|
|
198
|
+
|
|
199
|
+
rescue MobyBase::AttributeNotFoundError
|
|
200
|
+
|
|
201
|
+
exe_name = ""
|
|
202
|
+
|
|
203
|
+
end
|
|
204
|
+
|
|
205
|
+
end
|
|
206
|
+
|
|
207
|
+
Kernel::raise RuntimeError.new( "No executable full name has been defined for this application." ) if exe_name.empty?
|
|
208
|
+
|
|
209
|
+
File.basename( exe_name.gsub( /\\/, '/' ) )
|
|
210
|
+
|
|
211
|
+
end
|
|
212
|
+
|
|
213
|
+
# == description
|
|
214
|
+
# Returns uid of foreground application
|
|
215
|
+
# === returns
|
|
216
|
+
# String:: UID of the application.
|
|
217
|
+
# === example
|
|
218
|
+
# puts @sut.application.uid #prints foreground executable uid to console
|
|
219
|
+
def uid
|
|
220
|
+
|
|
221
|
+
id
|
|
222
|
+
|
|
223
|
+
end
|
|
224
|
+
|
|
225
|
+
# == description
|
|
226
|
+
# Indicates whether this application can be closed with the ApplicationBehaviour::close method. Note: at the moment
|
|
227
|
+
# it always returns true!
|
|
228
|
+
# === returns
|
|
229
|
+
# Boolean:: True if closing is possible with the ApplicationBehaviour::close method
|
|
230
|
+
# === example
|
|
231
|
+
# puts @sut.application.closable #prints foreground application closable status to console (at the moment always true)
|
|
232
|
+
def closable?
|
|
233
|
+
|
|
234
|
+
true
|
|
235
|
+
|
|
236
|
+
end
|
|
237
|
+
|
|
238
|
+
# enable hooking for performance measurement & debug logging
|
|
239
|
+
MobyUtil::Hooking.instance.hook_methods( self ) if defined?( MobyUtil::Hooking )
|
|
240
|
+
|
|
241
|
+
end # ApplicationBehaviour
|
|
242
|
+
|
|
243
|
+
end # MobyBehaviour
|