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,210 @@
|
|
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
|
+
# SwitchboxBehaviour related behaviour
|
24
|
+
#
|
25
|
+
# == behaviour
|
26
|
+
# GenericSwitchboxBehaviour
|
27
|
+
#
|
28
|
+
# == requires
|
29
|
+
# *
|
30
|
+
#
|
31
|
+
# == input_type
|
32
|
+
# *
|
33
|
+
#
|
34
|
+
# == sut_type
|
35
|
+
# *
|
36
|
+
#
|
37
|
+
# == sut_version
|
38
|
+
# *
|
39
|
+
#
|
40
|
+
# == objects
|
41
|
+
# sut
|
42
|
+
#
|
43
|
+
module SwitchboxBehaviour
|
44
|
+
|
45
|
+
include MobyBehaviour::Behaviour
|
46
|
+
|
47
|
+
# == description
|
48
|
+
# Instructs the SUT to reboot
|
49
|
+
# == returns
|
50
|
+
# NilClass
|
51
|
+
# description: -
|
52
|
+
# example: -
|
53
|
+
# == exceptions
|
54
|
+
# BehaviourError
|
55
|
+
# description: switchbox_sleep_before_powerup_in_reboot not defined for sut in tdriver_parameters.xml
|
56
|
+
# BehaviourError
|
57
|
+
# description: switchbox_sleep_after_powerup_in_reboot not defined for sut in tdriver_parameters.xml
|
58
|
+
# BehaviourError
|
59
|
+
# description: switchbox_sleep_before_powerup_in_reboot need to be non-negative integer smaller than 50 seconds
|
60
|
+
# BehaviourError
|
61
|
+
# description: switchbox_sleep_in_reboot could not be converted to integer
|
62
|
+
# BehaviourError
|
63
|
+
# description: switchbox_sleep_after_powerup_in_reboot need to be non-negative integer smaller than 500 seconds
|
64
|
+
# BehaviourError
|
65
|
+
# description: switchbox_sleep_after_powerup_in_reboot could not be converted to integer
|
66
|
+
def reset
|
67
|
+
str_sleep_time_before_powerup = parameter(:switchbox_sleep_before_powerup_in_reboot)
|
68
|
+
raise BehaviourError.new("reboot", "switchbox_sleep_before_powerup_in_reboot not defined for sut in tdriver_parameters.xml") if str_sleep_time_before_powerup == nil
|
69
|
+
|
70
|
+
str_sleep_time_after_powerup = parameter(:switchbox_sleep_after_powerup_in_reboot)
|
71
|
+
raise BehaviourError.new("reboot", "switchbox_sleep_after_powerup_in_reboot not defined for sut in tdriver_parameters.xml") if str_sleep_time_after_powerup == nil
|
72
|
+
|
73
|
+
str_commands_after_powerup = parameter(:switchbox_commands_after_powerup_in_reboot)
|
74
|
+
|
75
|
+
begin
|
76
|
+
sleep_time_before_powerup = str_sleep_time_before_powerup.to_i
|
77
|
+
raise BehaviourError.new("reboot", "switchbox_sleep_before_powerup_in_reboot need to be non-negative integer smaller than 50 seconds") if sleep_time_before_powerup < 0 or sleep_time_before_powerup > 50
|
78
|
+
|
79
|
+
rescue
|
80
|
+
raise BehaviourError.new("reboot", "switchbox_sleep_in_reboot could not be converted to integer")
|
81
|
+
end
|
82
|
+
|
83
|
+
begin
|
84
|
+
sleep_time_after_powerup = str_sleep_time_after_powerup.to_i
|
85
|
+
raise BehaviourError.new("reboot", "switchbox_sleep_after_powerup_in_reboot need to be non-negative integer smaller than 500 seconds") if sleep_time_after_powerup < 0 or sleep_time_after_powerup > 500
|
86
|
+
|
87
|
+
rescue
|
88
|
+
raise BehaviourError.new("reboot", "switchbox_sleep_after_powerup_in_reboot could not be converted to integer")
|
89
|
+
end
|
90
|
+
|
91
|
+
begin
|
92
|
+
disconnect
|
93
|
+
rescue
|
94
|
+
end
|
95
|
+
|
96
|
+
power_down
|
97
|
+
|
98
|
+
sleep sleep_time_before_powerup
|
99
|
+
power_up
|
100
|
+
sleep sleep_time_after_powerup
|
101
|
+
|
102
|
+
MobyUtil::Retryable.until( :timeout => 60, :interval => 5 ) {
|
103
|
+
system(str_commands_after_powerup) if str_commands_after_powerup != nil
|
104
|
+
if $parameters[ :ats4_error_recovery_enabled, false ]!='true'
|
105
|
+
$logger.behaviour "PASS;TDriver attempting reconnect"
|
106
|
+
connect( id )
|
107
|
+
$logger.behaviour "PASS;TDriver connected"
|
108
|
+
else
|
109
|
+
$logger.behaviour "PASS;ATS4 handling reconnection"
|
110
|
+
end
|
111
|
+
|
112
|
+
}
|
113
|
+
end
|
114
|
+
|
115
|
+
# == description
|
116
|
+
# Instructs the switchbox to power down the sut
|
117
|
+
# == returns
|
118
|
+
# Boolean
|
119
|
+
# description: Current power status
|
120
|
+
# example: false
|
121
|
+
# == exceptions
|
122
|
+
# BehaviourError
|
123
|
+
# description: Failed to power down
|
124
|
+
def power_down
|
125
|
+
str_command_arr = []
|
126
|
+
|
127
|
+
str_command = parameter(:switchbox_powerdown_command_sequence)
|
128
|
+
|
129
|
+
switchbox_sequence_timeout = parameter(:switchbox_timeout_between_command_sequence)
|
130
|
+
|
131
|
+
raise BehaviourError.new("power_down", "switchbox_timeout_between_command_sequence not defined for sut in tdriver_parameters.xml") if switchbox_sequence_timeout == nil
|
132
|
+
|
133
|
+
raise BehaviourError.new("power_down", "switchbox_powerdown_command not defined for sut in tdriver_parameters.xml") if str_command == nil
|
134
|
+
|
135
|
+
str_result = parameter(:switchbox_powerdown_command_success_string)
|
136
|
+
raise BehaviourError.new("power_down", "switchbox_powerdown_command_success string not defined for sut in tdriver_parameters.xml") if str_result == nil
|
137
|
+
|
138
|
+
#generate the sequence
|
139
|
+
str_command_arr = str_command.split('|')
|
140
|
+
|
141
|
+
#execute switchbox command
|
142
|
+
str_command_arr.each do |foobox_command|
|
143
|
+
$logger.behaviour "PASS;Executing powerdown command #{foobox_command}"
|
144
|
+
std_out = system(foobox_command)
|
145
|
+
$logger.behaviour "PASS;Powerdown command #{foobox_command} executed"
|
146
|
+
sleep switchbox_sequence_timeout.to_i
|
147
|
+
raise BehaviourError.new("power_down", "Failed to power down") unless std_out.to_s.downcase.include?(str_result.to_s.downcase)
|
148
|
+
end
|
149
|
+
@switch_box_power_status = false
|
150
|
+
end
|
151
|
+
|
152
|
+
|
153
|
+
# == description
|
154
|
+
# Instructs the switchbox to power up the sut
|
155
|
+
# == returns
|
156
|
+
# Boolean
|
157
|
+
# description: Current power status
|
158
|
+
# example: true
|
159
|
+
# == exceptions
|
160
|
+
# BehaviourError
|
161
|
+
# description: Failed to power up
|
162
|
+
def power_up
|
163
|
+
str_command_arr = []
|
164
|
+
|
165
|
+
switchbox_sequence_timeout = parameter(:switchbox_timeout_between_command_sequence)
|
166
|
+
|
167
|
+
raise BehaviourError.new("power_down", "switchbox_timeout_between_command_sequence not defined for sut in tdriver_parameters.xml") if switchbox_sequence_timeout == nil
|
168
|
+
|
169
|
+
str_command = parameter(:switchbox_powerup_command_sequence)
|
170
|
+
raise BehaviourError.new("power_up", "switchbox_powerup_command not defined for sut in tdriver_parameters.xml") if str_command == nil
|
171
|
+
|
172
|
+
str_result = parameter(:switchbox_powerup_command_success_string)
|
173
|
+
raise BehaviourError.new("power_up", "switchbox_powerup_command_success string not defined for sut in tdriver_parameters.xml") if str_result == nil
|
174
|
+
|
175
|
+
#generate the sequence
|
176
|
+
str_command_arr = str_command.split('|')
|
177
|
+
|
178
|
+
#execute switchbox command
|
179
|
+
str_command_arr.each do |foobox_command|
|
180
|
+
$logger.behaviour "PASS;Executing powerup command #{foobox_command}"
|
181
|
+
std_out = system(foobox_command)
|
182
|
+
$logger.behaviour "PASS;Ppowerup command #{foobox_command} executed"
|
183
|
+
sleep switchbox_sequence_timeout.to_i
|
184
|
+
raise BehaviourError.new("power_up", "Failed to power up") unless std_out.to_s.downcase.include?(str_result.to_s.downcase)
|
185
|
+
end
|
186
|
+
|
187
|
+
@switch_box_power_status = true
|
188
|
+
end
|
189
|
+
|
190
|
+
# == description
|
191
|
+
# Gets the current power status of the switchbox
|
192
|
+
# == returns
|
193
|
+
# Boolean
|
194
|
+
# description: Current power status
|
195
|
+
# example: true
|
196
|
+
def power_status
|
197
|
+
if @switch_box_power_status == nil
|
198
|
+
false
|
199
|
+
else
|
200
|
+
@switch_box_power_status
|
201
|
+
end
|
202
|
+
end
|
203
|
+
|
204
|
+
# enable hooking for performance measurement & debug logging
|
205
|
+
TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
|
206
|
+
|
207
|
+
end
|
208
|
+
|
209
|
+
end
|
210
|
+
|
@@ -0,0 +1,222 @@
|
|
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
|
+
# Defines methods for verification of test object state. These methods can only be called from non-sut objects
|
24
|
+
#
|
25
|
+
# == behaviour
|
26
|
+
# GenericVerification
|
27
|
+
#
|
28
|
+
# == requires
|
29
|
+
# *
|
30
|
+
#
|
31
|
+
# == input_type
|
32
|
+
# *
|
33
|
+
#
|
34
|
+
# == sut_type
|
35
|
+
# *
|
36
|
+
#
|
37
|
+
# == sut_version
|
38
|
+
# *
|
39
|
+
#
|
40
|
+
# == objects
|
41
|
+
# *;application;sut
|
42
|
+
#
|
43
|
+
module Verification
|
44
|
+
|
45
|
+
include MobyBehaviour::Behaviour
|
46
|
+
|
47
|
+
# == description
|
48
|
+
# Checks if a child test object matching the given criteria can be found, under this application object or test object.
|
49
|
+
# NOTE: This won't work with the visibleOnScreen attribute unless you disable the sut parameter use_find_object.
|
50
|
+
#
|
51
|
+
# == arguments
|
52
|
+
# *attributes
|
53
|
+
# Hash
|
54
|
+
# description: Hash containing attributes that the object must have
|
55
|
+
# example: {}
|
56
|
+
#
|
57
|
+
# == returns
|
58
|
+
# TrueClass
|
59
|
+
# description: if the object exists on the sut display
|
60
|
+
# example: true
|
61
|
+
#
|
62
|
+
# FalseClass
|
63
|
+
# description: if the object exists on the sut display
|
64
|
+
# example: false
|
65
|
+
#
|
66
|
+
# == exceptions
|
67
|
+
# TypeError
|
68
|
+
# description: Wrong argument type <class> for test object type (expected String)
|
69
|
+
#
|
70
|
+
# ArgumentError
|
71
|
+
# description: The test object type argument must not be empty
|
72
|
+
#
|
73
|
+
# ArgumentError
|
74
|
+
# description: Test object attributes hash argument must not be empty
|
75
|
+
#
|
76
|
+
# TypeError
|
77
|
+
# description: Wrong argument type <class> for test object attributes (expected Hash)
|
78
|
+
def test_object_exists?( *attributes )
|
79
|
+
|
80
|
+
begin
|
81
|
+
|
82
|
+
# store original number of arguments
|
83
|
+
arguments_count = attributes.count
|
84
|
+
|
85
|
+
# verify that correct number of arguments were given
|
86
|
+
if ( 1..2 ).include?( arguments_count )
|
87
|
+
|
88
|
+
# retrieve and remove first argument from array
|
89
|
+
first = attributes.shift
|
90
|
+
|
91
|
+
if first.kind_of?( Hash )
|
92
|
+
|
93
|
+
# wrong number of arguments were given
|
94
|
+
raise ArgumentError if attributes.count > 0
|
95
|
+
|
96
|
+
# store first argument as attributes hash
|
97
|
+
attributes = first
|
98
|
+
|
99
|
+
# verify that attributes hash is not empty
|
100
|
+
attributes.not_empty( 'Test object attributes hash argument must not be empty' )
|
101
|
+
|
102
|
+
elsif first.kind_of?( String )
|
103
|
+
|
104
|
+
# print deprecated method usage warning
|
105
|
+
warn "deprecated method usage; use object#test_object_exists?( Hash ) instead of object#test_object_exists?( String, [ Hash ] )"
|
106
|
+
|
107
|
+
# verify that type is not empty string
|
108
|
+
first.not_empty( 'The test object type argument must not be empty' )
|
109
|
+
|
110
|
+
# retrieve attributes from argument; optional argument when type is kind of String
|
111
|
+
attributes = attributes.shift || {}
|
112
|
+
|
113
|
+
# verify that attributes argument type is correct (Hash)
|
114
|
+
attributes.check_type Hash, 'wrong argument type $1 for test object attributes (expected $2)'
|
115
|
+
|
116
|
+
# store test object type to attributes hash
|
117
|
+
attributes[ :type ] = first
|
118
|
+
|
119
|
+
else
|
120
|
+
|
121
|
+
# verify that first argument type is correct (Hash or String)
|
122
|
+
first.check_type Hash, 'wrong argument type $1 for test object type (expected $2)'
|
123
|
+
|
124
|
+
end
|
125
|
+
|
126
|
+
else
|
127
|
+
|
128
|
+
# wrong number of arguments were given
|
129
|
+
raise ArgumentError
|
130
|
+
|
131
|
+
end
|
132
|
+
|
133
|
+
rescue ArgumentError
|
134
|
+
|
135
|
+
# raise argument error; pass with proper description
|
136
|
+
raise ArgumentError, "wrong number of arguments (#{ arguments_count } for 1)"
|
137
|
+
|
138
|
+
end
|
139
|
+
|
140
|
+
# make clone of original attributes
|
141
|
+
attributes_clone = attributes.clone
|
142
|
+
|
143
|
+
# If empty or only special attributes then add :type => '*' to search all
|
144
|
+
attributes_clone[ :type ] = '*' if attributes_clone.select{ | key, value | key.to_s !~ /^__/ ? true : false }.empty?
|
145
|
+
|
146
|
+
# translate the symbol values into string using sut's localisation setting
|
147
|
+
@sut.translate_values!( attributes_clone )
|
148
|
+
|
149
|
+
# default result (raises exception)
|
150
|
+
result = nil
|
151
|
+
|
152
|
+
# disable logging temporarly
|
153
|
+
$logger.push_enabled( false )
|
154
|
+
|
155
|
+
begin
|
156
|
+
|
157
|
+
# raise exception if multiple objects found; call child method, disable logging and allow multiple objects
|
158
|
+
raise MobyBase::MultipleTestObjectsIdentifiedError if child( attributes_clone.merge( :__logging => false, :__multiple_objects => true ) ).count > 1
|
159
|
+
|
160
|
+
# return true as return value
|
161
|
+
result = true
|
162
|
+
|
163
|
+
# result behaviour description
|
164
|
+
description = "Test object with attributes #{ attributes.inspect } was found."
|
165
|
+
|
166
|
+
rescue Exception
|
167
|
+
|
168
|
+
case $!
|
169
|
+
|
170
|
+
when MobyBase::MultipleTestObjectsIdentifiedError
|
171
|
+
|
172
|
+
# return true as return value
|
173
|
+
result = true
|
174
|
+
|
175
|
+
# result behaviour description
|
176
|
+
description = "Multiple objects with attributes #{ attributes.inspect } were found."
|
177
|
+
|
178
|
+
when MobyBase::TestObjectNotFoundError
|
179
|
+
|
180
|
+
# return false as return value
|
181
|
+
result = false
|
182
|
+
|
183
|
+
# result behaviour description
|
184
|
+
description = "Test object with attributes #{ attributes.inspect } was not found."
|
185
|
+
|
186
|
+
else
|
187
|
+
|
188
|
+
# store exception to be raised
|
189
|
+
result = $!
|
190
|
+
|
191
|
+
# result behaviour description
|
192
|
+
description = "Test object with attributes #{ attributes.inspect } was not found due to unexpected error (#{ $!.class }: #{ $!.message.inspect })"
|
193
|
+
|
194
|
+
end
|
195
|
+
|
196
|
+
ensure
|
197
|
+
|
198
|
+
# determines that will result be logged to behaviour level
|
199
|
+
$logger.enabled = ( attributes[ :__logging ] == 'true' ? true : false )
|
200
|
+
|
201
|
+
# behaviour logging
|
202
|
+
$logger.behaviour "#{ ( result == true ? 'PASS' : 'FAIL' ) };#{ description };#{ ( sut? ? id.to_s : '' ) };test_object_exists?;"
|
203
|
+
|
204
|
+
# restore original logger state
|
205
|
+
$logger.pop_enabled
|
206
|
+
|
207
|
+
# raise exception if neccessery
|
208
|
+
raise result if result.kind_of?( Exception )
|
209
|
+
|
210
|
+
end
|
211
|
+
|
212
|
+
# return value
|
213
|
+
result
|
214
|
+
|
215
|
+
end
|
216
|
+
|
217
|
+
# enable hooking for performance measurement & debug logging
|
218
|
+
TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
|
219
|
+
|
220
|
+
end # module VerificationBehaviour
|
221
|
+
|
222
|
+
end # module MobyBase
|
@@ -0,0 +1,43 @@
|
|
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 TDriver.
|
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 MobyCommand
|
21
|
+
|
22
|
+
class AgentCommand < MobyCommand::CommandData
|
23
|
+
|
24
|
+
attr_accessor :parameters
|
25
|
+
|
26
|
+
# == description
|
27
|
+
# Agent command holds the required parameters to execute a agent information queries in the target.
|
28
|
+
# == arguments
|
29
|
+
# params
|
30
|
+
# Hash
|
31
|
+
# description: Hash for holding the parameters need by the agent information query operation.
|
32
|
+
# example: {}
|
33
|
+
def initialize( parameters = {} )
|
34
|
+
|
35
|
+
parameters.check_type Hash, 'wrong argument type $1 for agent service command object (expected $2)'
|
36
|
+
|
37
|
+
@parameters = parameters
|
38
|
+
|
39
|
+
end
|
40
|
+
|
41
|
+
end # AgentCommand
|
42
|
+
|
43
|
+
end # MobyCommand
|