testability-driver 1.0.3 → 1.0.4
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/lib/tdriver-devtools/behaviour/xml/rdoc_behaviour_xml_generator.rb +2 -2
- data/lib/tdriver-devtools/tdriver-devtools.rb +1 -1
- data/lib/tdriver-devtools/tests/feature_tests/lib/custom_rdoc_generator.rb +3 -3
- data/lib/tdriver/base/behaviour/behaviours/object_behaviour_composition.rb +6 -1
- data/lib/tdriver/base/behaviour/behaviours/object_behaviour_description.rb +5 -3
- data/lib/tdriver/base/behaviour/behaviours/object_composition.rb +1 -1
- data/lib/tdriver/base/behaviour/factory.rb +225 -225
- data/lib/tdriver/base/errors.rb +1 -1
- data/lib/tdriver/base/state_object.rb +227 -179
- data/lib/tdriver/base/sut/controller.rb +2 -2
- data/lib/tdriver/base/sut/factory.rb +190 -182
- data/lib/tdriver/base/sut/generic/behaviours/application.rb +69 -25
- data/lib/tdriver/base/sut/generic/behaviours/controller.rb +1 -1
- data/lib/tdriver/base/sut/generic/behaviours/find.rb +4 -4
- data/lib/tdriver/base/sut/generic/behaviours/flash_behaviour.rb +3 -3
- data/lib/tdriver/base/sut/generic/behaviours/sut.rb +350 -165
- data/lib/tdriver/base/sut/generic/behaviours/switchbox_behaviour.rb +9 -9
- data/lib/tdriver/base/sut/generic/behaviours/verification.rb +191 -103
- data/lib/tdriver/base/sut/generic/commands/application.rb +1 -1
- data/lib/tdriver/base/sut/generic/commands/key_sequence.rb +1 -1
- data/lib/tdriver/base/sut/generic/commands/screen_capture.rb +1 -1
- data/lib/tdriver/base/sut/generic/plugin.rb +1 -1
- data/lib/tdriver/base/sut/sut.rb +5 -1
- data/lib/tdriver/base/test_object/abstract.rb +136 -151
- data/lib/tdriver/base/test_object/adapter.rb +293 -82
- data/lib/tdriver/base/test_object/behaviours/syncronization.rb +20 -17
- data/lib/tdriver/base/test_object/behaviours/test_object.rb +159 -532
- data/lib/tdriver/base/test_object/cache.rb +1 -1
- data/lib/tdriver/base/test_object/factory.rb +254 -605
- data/lib/tdriver/base/test_object/identificator.rb +1 -1
- data/lib/tdriver/base/test_object/loader.rb +1 -1
- data/lib/tdriver/base/test_object/verification.rb +17 -17
- data/lib/tdriver/loader.rb +20 -9
- data/lib/tdriver/report/report.rb +5 -0
- data/lib/tdriver/report/report_creator.rb +2 -2
- data/lib/tdriver/report/report_cucumber_listener.rb +4 -4
- data/lib/tdriver/report/report_cucumber_reporter.rb +4 -4
- data/lib/tdriver/report/report_execution_statistics.rb +22 -22
- data/lib/tdriver/report/report_grouping.rb +2 -2
- data/lib/tdriver/report/report_javascript.rb +11 -4
- data/lib/tdriver/report/report_test_case_run.rb +2 -2
- data/lib/tdriver/report/report_test_run.rb +5 -5
- data/lib/tdriver/report/report_test_unit.rb +74 -26
- data/lib/tdriver/report/report_writer.rb +70 -13
- data/lib/tdriver/tdriver.rb +17 -8
- data/lib/tdriver/util/common/array.rb +1 -1
- data/lib/tdriver/util/common/crc16.rb +1 -1
- data/lib/tdriver/util/common/environment.rb +1 -1
- data/lib/tdriver/util/common/file.rb +18 -9
- data/lib/tdriver/util/common/gem.rb +1 -1
- data/lib/tdriver/util/common/hash.rb +21 -0
- data/lib/tdriver/util/common/kernel.rb +1 -1
- data/lib/tdriver/util/common/loader.rb +5 -2
- data/lib/tdriver/util/common/numeric.rb +54 -3
- data/lib/tdriver/util/common/retryable.rb +30 -12
- data/lib/tdriver/util/common/stackable.rb +185 -0
- data/lib/tdriver/util/common/string.rb +21 -5
- data/lib/tdriver/util/{dbaccess/dbaccess.rb → database/access.rb} +4 -1
- data/lib/tdriver/util/{dbaccess/dbconnection.rb → database/connection.rb} +3 -0
- data/lib/tdriver/util/{dbaccess → database}/error.rb +0 -1
- data/lib/tdriver/util/{dbaccess → database}/loader.rb +5 -6
- data/lib/tdriver/util/{dynamic_attribute_filter.rb → filters/dynamic_attributes.rb} +1 -1
- data/lib/tdriver/util/hooking/hooking.rb +477 -0
- data/lib/tdriver/util/loader.rb +35 -29
- data/lib/tdriver/util/localisation/error.rb +0 -1
- data/lib/tdriver/util/localisation/loader.rb +1 -4
- data/lib/tdriver/util/localisation/localisation.rb +30 -27
- data/lib/tdriver/util/{common.rb → logger/loader.rb} +2 -4
- data/lib/tdriver/util/logger/logger.rb +574 -0
- data/lib/tdriver/util/operator_data/loader.rb +4 -3
- data/lib/tdriver/util/operator_data/operator_data.rb +5 -5
- data/lib/tdriver/util/parameter/parameter.rb +7 -1
- data/lib/tdriver/util/parameter/parameter_hash.rb +1 -1
- data/lib/tdriver/util/parameter/parameter_template.rb +1 -1
- data/lib/tdriver/util/parameter/parameter_user_api.rb +28 -20
- data/lib/tdriver/util/parameter/parameter_xml.rb +1 -1
- data/lib/tdriver/util/plugin/abstract.rb +1 -1
- data/lib/tdriver/util/plugin/service.rb +1 -1
- data/lib/tdriver/util/{localisation.rb → recorder/loader.rb} +4 -3
- data/lib/tdriver/util/recorder/recorder.rb +66 -0
- data/lib/tdriver/util/recorder/scripter.rb +258 -0
- data/lib/tdriver/util/{stats.rb → statistics/statistics.rb} +7 -8
- data/lib/tdriver/util/user_data/error.rb +0 -1
- data/lib/tdriver/util/user_data/loader.rb +1 -2
- data/lib/tdriver/util/user_data/user_data.rb +6 -6
- data/lib/tdriver/util/video/camera.rb +67 -0
- data/lib/tdriver/util/video/camera_linux.rb +139 -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 +56 -5
- data/lib/tdriver/util/xml/builder.rb +2 -5
- data/lib/tdriver/util/{parameter.rb → xml/comment.rb} +10 -2
- data/lib/tdriver/util/xml/loader.rb +32 -22
- data/lib/tdriver/util/xml/nil_node.rb +2 -2
- data/lib/tdriver/util/xml/parsers/loader.rb +0 -1
- data/lib/tdriver/util/xml/parsers/nokogiri/abstraction.rb +18 -44
- data/lib/tdriver/util/xml/parsers/nokogiri/attribute.rb +9 -13
- data/lib/tdriver/util/xml/parsers/nokogiri/builder.rb +9 -3
- data/lib/tdriver/util/xml/parsers/nokogiri/comment.rb +39 -0
- data/lib/tdriver/util/xml/parsers/nokogiri/document.rb +6 -11
- data/lib/tdriver/util/xml/parsers/nokogiri/element.rb +2 -122
- data/lib/tdriver/util/xml/parsers/nokogiri/loader.rb +26 -16
- data/lib/tdriver/util/xml/parsers/nokogiri/node.rb +203 -0
- data/lib/tdriver/util/xml/parsers/nokogiri/nodeset.rb +1 -2
- data/lib/tdriver/util/xml/parsers/nokogiri/text.rb +2 -20
- data/lib/tdriver/util/xml/xml.rb +52 -20
- data/lib/tdriver/verify/verify.rb +238 -81
- data/xml/behaviours/generic.xml +12 -10
- metadata +156 -180
- data/lib/tdriver/base/test_object/factory_new.rb +0 -202
- data/lib/tdriver/util/hooking.rb +0 -434
- data/lib/tdriver/util/logger.rb +0 -506
- data/lib/tdriver/util/recorder.rb +0 -297
- data/lib/tdriver/util/video_utils.rb +0 -384
- data/lib/tdriver/util/xml/nil_element.rb +0 -89
|
@@ -117,7 +117,6 @@ module MobyUtil
|
|
|
117
117
|
@xml.empty?
|
|
118
118
|
|
|
119
119
|
end
|
|
120
|
-
|
|
121
120
|
|
|
122
121
|
def length
|
|
123
122
|
|
|
@@ -188,7 +187,7 @@ module MobyUtil
|
|
|
188
187
|
end
|
|
189
188
|
|
|
190
189
|
# enable hooking for performance measurement & debug logging
|
|
191
|
-
|
|
190
|
+
TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
|
|
192
191
|
|
|
193
192
|
end # Nodeset
|
|
194
193
|
|
|
@@ -25,28 +25,10 @@ module MobyUtil
|
|
|
25
25
|
|
|
26
26
|
module Text # behaviour
|
|
27
27
|
|
|
28
|
-
include
|
|
29
|
-
|
|
30
|
-
def parent
|
|
31
|
-
|
|
32
|
-
element_object( @xml.parent )
|
|
33
|
-
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
def to_s
|
|
37
|
-
|
|
38
|
-
@xml.content
|
|
39
|
-
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
def content
|
|
43
|
-
|
|
44
|
-
@xml.content
|
|
45
|
-
|
|
46
|
-
end
|
|
28
|
+
include Node
|
|
47
29
|
|
|
48
30
|
# enable hooking for performance measurement & debug logging
|
|
49
|
-
|
|
31
|
+
TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
|
|
50
32
|
|
|
51
33
|
end # Element
|
|
52
34
|
|
data/lib/tdriver/util/xml/xml.rb
CHANGED
|
@@ -21,10 +21,6 @@ module MobyUtil
|
|
|
21
21
|
|
|
22
22
|
module XML
|
|
23
23
|
|
|
24
|
-
# default values
|
|
25
|
-
#@@parser = MobyUtil::XML::LibXML
|
|
26
|
-
@@parser = MobyUtil::XML::Nokogiri
|
|
27
|
-
|
|
28
24
|
# Get current XML parser
|
|
29
25
|
# == params
|
|
30
26
|
# == return
|
|
@@ -45,9 +41,32 @@ module MobyUtil
|
|
|
45
41
|
# == raises
|
|
46
42
|
def self.current_parser=( value )
|
|
47
43
|
|
|
44
|
+
#raise RuntimeError, "Parser can be set only once per session" unless defined?( @@parser )
|
|
45
|
+
|
|
46
|
+
# set current parser
|
|
48
47
|
@@parser = value
|
|
49
48
|
|
|
50
|
-
|
|
49
|
+
# apply parser implementation to abstraction modules
|
|
50
|
+
[
|
|
51
|
+
MobyUtil::XML::Document,
|
|
52
|
+
MobyUtil::XML::Element,
|
|
53
|
+
MobyUtil::XML::Nodeset,
|
|
54
|
+
MobyUtil::XML::Attribute,
|
|
55
|
+
MobyUtil::XML::Text,
|
|
56
|
+
MobyUtil::XML::Builder,
|
|
57
|
+
MobyUtil::XML::Comment ].each do | _module |
|
|
58
|
+
|
|
59
|
+
_module.module_exec{
|
|
60
|
+
|
|
61
|
+
# include parser implementation to abstraction modules
|
|
62
|
+
include MobyUtil::KernelHelper.get_constant( "#{ @@parser }::#{ _module.name.split('::').last }")
|
|
63
|
+
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
# return current parser as result
|
|
69
|
+
value
|
|
51
70
|
|
|
52
71
|
end
|
|
53
72
|
|
|
@@ -65,7 +84,7 @@ module MobyUtil
|
|
|
65
84
|
|
|
66
85
|
begin
|
|
67
86
|
|
|
68
|
-
MobyUtil::XML::Document.new( nil
|
|
87
|
+
MobyUtil::XML::Document.new( nil ).tap{ | document |
|
|
69
88
|
|
|
70
89
|
# parse given string
|
|
71
90
|
document.xml = document.parse( xml_string )
|
|
@@ -80,37 +99,48 @@ module MobyUtil
|
|
|
80
99
|
dump_location = ""
|
|
81
100
|
|
|
82
101
|
# check if xml parse error logging is enabled
|
|
83
|
-
if
|
|
102
|
+
if $parameters[ :logging_xml_parse_error_dump, 'true' ].to_s.to_boolean
|
|
103
|
+
|
|
104
|
+
# construct filename for xml dump
|
|
105
|
+
filename = 'xml_error_dump'
|
|
106
|
+
|
|
107
|
+
# add timestamp to filename if not overwriting the existing dump file
|
|
108
|
+
unless $parameters[ :logging_xml_parse_error_dump_overwrite, 'false' ].to_s.to_boolean
|
|
84
109
|
|
|
85
|
-
|
|
86
|
-
|
|
110
|
+
filename << "_#{ Time.now.to_i }"
|
|
111
|
+
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
# add file extension
|
|
115
|
+
filename << '.xml'
|
|
87
116
|
|
|
88
117
|
# ... join filename with xml dump output path
|
|
89
|
-
path = File.join( MobyUtil::FileHelper.expand_path(
|
|
118
|
+
path = File.join( MobyUtil::FileHelper.expand_path( $parameters[ :logging_xml_parse_error_dump_path ] ), filename )
|
|
90
119
|
|
|
91
120
|
begin
|
|
92
121
|
|
|
93
122
|
# write xml string to file
|
|
94
123
|
File.open( path, "w" ){ | file | file << xml_string }
|
|
95
124
|
|
|
96
|
-
dump_location = "
|
|
125
|
+
dump_location = "Saved to #{ path }"
|
|
97
126
|
|
|
98
127
|
rescue
|
|
99
128
|
|
|
100
|
-
dump_location = "
|
|
129
|
+
dump_location = "Error while saving to file #{ path }"
|
|
101
130
|
|
|
102
131
|
end
|
|
103
132
|
|
|
104
|
-
|
|
105
133
|
end
|
|
106
134
|
|
|
107
135
|
# raise exception
|
|
108
|
-
Kernel::raise MobyUtil::XML::ParseError.new( "%s (%s)%s" % [ exception.message.gsub("\n", ''), exception.class, dump_location ] )
|
|
136
|
+
#Kernel::raise MobyUtil::XML::ParseError.new( "%s (%s)%s" % [ exception.message.gsub("\n", ''), exception.class, dump_location ] )
|
|
137
|
+
Kernel::raise MobyUtil::XML::ParseError, "#{ exception.message.gsub("\n", '') } (#{ exception.class }). #{ dump_location }"
|
|
109
138
|
|
|
110
139
|
else
|
|
111
140
|
|
|
112
141
|
# raise exception
|
|
113
|
-
Kernel::raise MobyUtil::XML::ParseError.new( "%s (%s)" % [ exception.message.gsub("\n", ''), exception.class ] )
|
|
142
|
+
#Kernel::raise MobyUtil::XML::ParseError.new( "%s (%s)" % [ exception.message.gsub("\n", ''), exception.class ] )
|
|
143
|
+
Kernel::raise MobyUtil::XML::ParseError, "#{ exception.message.gsub("\n", '') } (#{ exception.class })"
|
|
114
144
|
|
|
115
145
|
end
|
|
116
146
|
|
|
@@ -132,7 +162,7 @@ module MobyUtil
|
|
|
132
162
|
def self.parse_file( filename )
|
|
133
163
|
|
|
134
164
|
# raise exception if file not found
|
|
135
|
-
Kernel::raise IOError
|
|
165
|
+
Kernel::raise IOError, "File #{ filename.inspect } not found" unless File.exist?( filename )
|
|
136
166
|
|
|
137
167
|
self.parse_string( IO.read( filename ) )
|
|
138
168
|
|
|
@@ -160,7 +190,7 @@ module MobyUtil
|
|
|
160
190
|
|
|
161
191
|
begin
|
|
162
192
|
|
|
163
|
-
MobyUtil::XML::Builder.new.
|
|
193
|
+
MobyUtil::XML::Builder.new.tap{ | builder |
|
|
164
194
|
|
|
165
195
|
builder.build( &block )
|
|
166
196
|
|
|
@@ -168,16 +198,18 @@ module MobyUtil
|
|
|
168
198
|
|
|
169
199
|
rescue Exception => exception
|
|
170
200
|
|
|
171
|
-
Kernel::raise MobyUtil::XML::BuilderError
|
|
172
|
-
|
|
201
|
+
Kernel::raise MobyUtil::XML::BuilderError, "#{ exception.message } (#{ exception.class })"
|
|
173
202
|
|
|
174
203
|
end
|
|
175
204
|
|
|
176
205
|
end
|
|
177
206
|
|
|
178
207
|
# enable hooking for performance measurement & debug logging
|
|
179
|
-
|
|
208
|
+
TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
|
|
180
209
|
|
|
181
210
|
end # XML
|
|
182
211
|
|
|
183
212
|
end # MobyUtil
|
|
213
|
+
|
|
214
|
+
# set used parser module
|
|
215
|
+
MobyUtil::XML.current_parser = MobyUtil::XML::Nokogiri
|
|
@@ -1,20 +1,20 @@
|
|
|
1
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
|
-
##
|
|
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
18
|
############################################################################
|
|
19
19
|
|
|
20
20
|
module TDriverVerify
|
|
@@ -43,12 +43,12 @@ module TDriverVerify
|
|
|
43
43
|
|
|
44
44
|
begin
|
|
45
45
|
|
|
46
|
-
@@on_error_verify_block.call
|
|
46
|
+
@@on_error_verify_block.call
|
|
47
47
|
|
|
48
48
|
rescue Exception => exception
|
|
49
49
|
|
|
50
|
-
raise exception.class.new( "Exception was raised while executing on_error_verify_block. Reason: %s" % [ exception.message ])
|
|
51
|
-
|
|
50
|
+
raise exception.class.new( "Exception was raised while executing on_error_verify_block. Reason: %s" % [ exception.message ])
|
|
51
|
+
|
|
52
52
|
end
|
|
53
53
|
|
|
54
54
|
else
|
|
@@ -73,13 +73,14 @@ module TDriverVerify
|
|
|
73
73
|
|
|
74
74
|
def verify( timeout = nil, message = nil, &block )
|
|
75
75
|
|
|
76
|
-
logging_enabled =
|
|
76
|
+
logging_enabled = $logger.enabled
|
|
77
77
|
|
|
78
78
|
verify_caller = caller(1).first.to_s
|
|
79
79
|
|
|
80
80
|
begin
|
|
81
81
|
|
|
82
|
-
|
|
82
|
+
$logger.enabled = false
|
|
83
|
+
|
|
83
84
|
Kernel::raise ArgumentError.new("No block was given.") unless block_given?
|
|
84
85
|
Kernel::raise ArgumentError.new("Argument timeout was not an Integer.") unless timeout.nil? or timeout.kind_of?(Integer)
|
|
85
86
|
Kernel::raise ArgumentError.new("Argument message was not a String.") unless message.nil? or message.kind_of?(String)
|
|
@@ -102,7 +103,7 @@ module TDriverVerify
|
|
|
102
103
|
# no error => verification ok
|
|
103
104
|
break
|
|
104
105
|
|
|
105
|
-
rescue Exception => e
|
|
106
|
+
rescue Exception => e
|
|
106
107
|
|
|
107
108
|
raise if e.kind_of? MobyBase::ContinuousVerificationError
|
|
108
109
|
|
|
@@ -119,8 +120,8 @@ module TDriverVerify
|
|
|
119
120
|
|
|
120
121
|
rescue Exception
|
|
121
122
|
# failed to load line from file, do nothing
|
|
122
|
-
|
|
123
|
-
|
|
123
|
+
$logger.enabled = logging_enabled
|
|
124
|
+
$logger.log "behaviour" , "WARNING;Failed to load source line: #{e.backtrace.inspect}.;#{self.kind_of?(MobyBase::SUT) ? self.id.to_s + ';sut' : ';'};{};verify;"
|
|
124
125
|
end
|
|
125
126
|
|
|
126
127
|
if !source_contents.empty?
|
|
@@ -147,8 +148,8 @@ module TDriverVerify
|
|
|
147
148
|
|
|
148
149
|
raise if e.kind_of? MobyBase::ContinuousVerificationError
|
|
149
150
|
|
|
150
|
-
|
|
151
|
-
|
|
151
|
+
$logger.enabled = logging_enabled
|
|
152
|
+
$logger.log "behaviour" , "FAIL;Verification #{message.nil? ? '' : '\"' << message << '\" '}failed: #{e.to_s}#{timeout.nil? ? '' : ' using timeout ' + timeout.to_s}.;#{self.kind_of?(MobyBase::SUT) ? self.id.to_s + ';sut' : ';'};{};verify;"
|
|
152
153
|
Kernel::raise e
|
|
153
154
|
|
|
154
155
|
ensure
|
|
@@ -157,8 +158,8 @@ module TDriverVerify
|
|
|
157
158
|
|
|
158
159
|
end
|
|
159
160
|
|
|
160
|
-
|
|
161
|
-
|
|
161
|
+
$logger.enabled = logging_enabled
|
|
162
|
+
$logger.log "behaviour" , "PASS;Verification #{message.nil? ? '' : '\"' << message << '\" '}at #{verify_caller} was successful#{timeout.nil? ? '' : ' using timeout ' + timeout.to_s}.;#{self.kind_of?(MobyBase::SUT) ? self.id.to_s + ';sut' : ';'};{};verify;"
|
|
162
163
|
|
|
163
164
|
return nil
|
|
164
165
|
|
|
@@ -178,11 +179,11 @@ module TDriverVerify
|
|
|
178
179
|
# VerificationError:: The verification failed.
|
|
179
180
|
def verify_not( timeout = nil, message = nil, &block )
|
|
180
181
|
|
|
181
|
-
logging_enabled =
|
|
182
|
+
logging_enabled = $logger.enabled
|
|
182
183
|
verify_caller = caller(1).first.to_s
|
|
183
184
|
begin
|
|
184
185
|
|
|
185
|
-
|
|
186
|
+
$logger.enabled = false
|
|
186
187
|
Kernel::raise ArgumentError.new("No block was given.") unless block_given?
|
|
187
188
|
Kernel::raise ArgumentError.new("Argument timeout was not an Integer.") unless timeout.nil? or timeout.kind_of?(Integer)
|
|
188
189
|
Kernel::raise ArgumentError.new("Argument message was not a String.") unless message.nil? or message.kind_of?(String)
|
|
@@ -242,8 +243,8 @@ module TDriverVerify
|
|
|
242
243
|
|
|
243
244
|
raise if e.kind_of? MobyBase::ContinuousVerificationError
|
|
244
245
|
|
|
245
|
-
|
|
246
|
-
|
|
246
|
+
$logger.enabled = logging_enabled
|
|
247
|
+
$logger.log "behaviour" , "FAIL;Verification #{message.nil? ? '' : '\"' << message << '\" '}failed: #{e.to_s}#{timeout.nil? ? '' : ' using timeout ' + timeout.to_s}.;#{self.kind_of?(MobyBase::SUT) ? self.id.to_s + ';sut' : ';'};{};verify_not;"
|
|
247
248
|
Kernel::raise e
|
|
248
249
|
|
|
249
250
|
ensure
|
|
@@ -252,8 +253,8 @@ module TDriverVerify
|
|
|
252
253
|
|
|
253
254
|
end
|
|
254
255
|
|
|
255
|
-
|
|
256
|
-
|
|
256
|
+
$logger.enabled = logging_enabled
|
|
257
|
+
$logger.log "behaviour" , "PASS;Verification #{message.nil? ? '' : '\"' << message << '\" '}at #{verify_caller} was successful#{timeout.nil? ? '' : ' using timeout ' + timeout.to_s}.;#{self.kind_of?(MobyBase::SUT) ? self.id.to_s + ';sut' : ';'};{};verify_not;"
|
|
257
258
|
return nil
|
|
258
259
|
|
|
259
260
|
end
|
|
@@ -272,11 +273,11 @@ module TDriverVerify
|
|
|
272
273
|
# RuntimeError:: An unexpected error was encountered during verification.
|
|
273
274
|
def verify_true( timeout = nil, message = nil, &block )
|
|
274
275
|
|
|
275
|
-
logging_enabled =
|
|
276
|
+
logging_enabled = $logger.enabled
|
|
276
277
|
verify_caller = caller(1).first.to_s
|
|
277
278
|
|
|
278
279
|
begin
|
|
279
|
-
|
|
280
|
+
$logger.enabled = false
|
|
280
281
|
Kernel::raise ArgumentError.new("No block was given.") unless block_given?
|
|
281
282
|
Kernel::raise ArgumentError.new("Argument timeout was not an Integer.") unless timeout.nil? or timeout.kind_of?(Integer)
|
|
282
283
|
Kernel::raise ArgumentError.new("Argument message was not a String.") unless message.nil? or message.kind_of?(String)
|
|
@@ -299,7 +300,7 @@ module TDriverVerify
|
|
|
299
300
|
|
|
300
301
|
result = yield
|
|
301
302
|
|
|
302
|
-
rescue Exception => e
|
|
303
|
+
rescue Exception => e
|
|
303
304
|
|
|
304
305
|
#@@on_error_verify_block.call unless @@on_error_verify_block.nil?
|
|
305
306
|
|
|
@@ -316,12 +317,12 @@ module TDriverVerify
|
|
|
316
317
|
|
|
317
318
|
unless result == true
|
|
318
319
|
|
|
319
|
-
|
|
320
|
-
|
|
320
|
+
error_msg = "Verification #{message.nil? ? '' : '"' << message.to_s << '" '}at #{verify_caller} failed."
|
|
321
|
+
error_msg << MobyUtil::KernelHelper.find_source(verify_caller)
|
|
321
322
|
|
|
322
|
-
|
|
323
|
+
error_msg << "\nThe block did not return true. It returned: " << result.inspect
|
|
323
324
|
|
|
324
|
-
|
|
325
|
+
raise MobyBase::VerificationError.new( error_msg )
|
|
325
326
|
|
|
326
327
|
end
|
|
327
328
|
|
|
@@ -348,7 +349,7 @@ module TDriverVerify
|
|
|
348
349
|
|
|
349
350
|
raise if e.kind_of? MobyBase::ContinuousVerificationError
|
|
350
351
|
|
|
351
|
-
|
|
352
|
+
$logger.enabled = logging_enabled
|
|
352
353
|
|
|
353
354
|
# an unexpected error has occurred
|
|
354
355
|
Kernel::raise RuntimeError.new("An unexpected error was encountered during verification:\n" << e.inspect )
|
|
@@ -359,15 +360,15 @@ module TDriverVerify
|
|
|
359
360
|
|
|
360
361
|
rescue Exception => e
|
|
361
362
|
raise if e.kind_of? MobyBase::ContinuousVerificationError
|
|
362
|
-
|
|
363
|
-
|
|
363
|
+
$logger.enabled = logging_enabled
|
|
364
|
+
$logger.log "behaviour" , "FAIL;Verification #{message.nil? ? '' : '\"' << message << '\" '}failed:#{e.to_s}.\n#{timeout.nil? ? '' : ' using timeout ' + timeout.to_s}.;#{self.kind_of?(MobyBase::SUT) ? self.id.to_s + ';sut' : ';'};{};verify_true;"
|
|
364
365
|
Kernel::raise e
|
|
365
366
|
ensure
|
|
366
367
|
MobyBase::TestObjectFactory.instance.timeout = original_sync_timeout unless original_sync_timeout.nil?
|
|
367
368
|
end
|
|
368
369
|
|
|
369
|
-
|
|
370
|
-
|
|
370
|
+
$logger.enabled = logging_enabled
|
|
371
|
+
$logger.log "behaviour" , "PASS;Verification #{message.nil? ? '' : '\"' << message << '\" '}at #{verify_caller} was successful#{timeout.nil? ? '' : ' using timeout ' + timeout.to_s}.;#{self.kind_of?(MobyBase::SUT) ? self.id.to_s + ';sut' : ';'};{};verify_true;"
|
|
371
372
|
return nil
|
|
372
373
|
|
|
373
374
|
end
|
|
@@ -386,13 +387,13 @@ module TDriverVerify
|
|
|
386
387
|
# RuntimeError:: An unexpected error was encountered during verification.
|
|
387
388
|
def verify_false( timeout = nil, message = nil, &block )
|
|
388
389
|
|
|
389
|
-
logging_enabled =
|
|
390
|
+
logging_enabled = $logger.enabled
|
|
390
391
|
|
|
391
392
|
verify_caller = caller(1).first.to_s
|
|
392
393
|
|
|
393
394
|
begin
|
|
394
395
|
|
|
395
|
-
|
|
396
|
+
$logger.enabled = false
|
|
396
397
|
|
|
397
398
|
Kernel::raise ArgumentError.new("No block was given.") unless block_given?
|
|
398
399
|
|
|
@@ -423,7 +424,7 @@ module TDriverVerify
|
|
|
423
424
|
|
|
424
425
|
error_msg = "Verification #{message.nil? ? '' : '"' << message.to_s << '" '}at #{verify_caller} failed:"
|
|
425
426
|
error_msg << MobyUtil::KernelHelper.find_source(verify_caller)
|
|
426
|
-
error_msg << "The block did not return false. It returned: " << result.inspect
|
|
427
|
+
error_msg << "The block did not return false. It returned: " << result.inspect
|
|
427
428
|
raise MobyBase::VerificationError.new(error_msg) unless result == false
|
|
428
429
|
|
|
429
430
|
# break loop if no exceptions thrown
|
|
@@ -445,7 +446,7 @@ module TDriverVerify
|
|
|
445
446
|
rescue Exception => e
|
|
446
447
|
raise if e.kind_of? MobyBase::ContinuousVerificationError
|
|
447
448
|
# an unexpected error has occurred
|
|
448
|
-
|
|
449
|
+
$logger.enabled = logging_enabled
|
|
449
450
|
Kernel::raise RuntimeError.new("An unexpected error was encountered during verification:\n" << e.inspect )
|
|
450
451
|
|
|
451
452
|
end # begin, catch any VerificationErrors
|
|
@@ -458,8 +459,8 @@ module TDriverVerify
|
|
|
458
459
|
|
|
459
460
|
raise if e.kind_of? MobyBase::ContinuousVerificationError
|
|
460
461
|
|
|
461
|
-
|
|
462
|
-
|
|
462
|
+
$logger.enabled = logging_enabled
|
|
463
|
+
$logger.log "behaviour" , "FAIL;Verification #{message.nil? ? '' : '\"' << message << '\" '}failed:#{e.to_s}.\n #{timeout.nil? ? '' : ' using timeout ' + timeout.to_s}.;#{self.kind_of?(MobyBase::SUT) ? self.id.to_s + ';sut' : ';'};{};verify_false;"
|
|
463
464
|
|
|
464
465
|
Kernel::raise e
|
|
465
466
|
|
|
@@ -467,8 +468,8 @@ module TDriverVerify
|
|
|
467
468
|
MobyBase::TestObjectFactory.instance.timeout = original_sync_timeout unless original_sync_timeout.nil?
|
|
468
469
|
end
|
|
469
470
|
|
|
470
|
-
|
|
471
|
-
|
|
471
|
+
$logger.enabled = logging_enabled
|
|
472
|
+
$logger.log "behaviour" , "PASS;Verification #{message.nil? ? '' : '\"' << message << '\" '}at #{verify_caller} was successful#{timeout.nil? ? '' : ' using timeout ' + timeout.to_s}.;#{self.kind_of?(MobyBase::SUT) ? self.id.to_s + ';sut' : ';'};{};verify_false;"
|
|
472
473
|
return nil
|
|
473
474
|
|
|
474
475
|
end
|
|
@@ -487,10 +488,10 @@ module TDriverVerify
|
|
|
487
488
|
# VerificationError:: The verification failed.
|
|
488
489
|
# RuntimeError:: An unexpected error was encountered during verification.
|
|
489
490
|
def verify_equal( expected, timeout = nil, message = nil, &block )
|
|
490
|
-
logging_enabled =
|
|
491
|
+
logging_enabled = $logger.enabled
|
|
491
492
|
verify_caller = caller(1).first.to_s
|
|
492
493
|
begin
|
|
493
|
-
|
|
494
|
+
$logger.enabled = false
|
|
494
495
|
Kernel::raise ArgumentError.new("No block was given.") unless block_given?
|
|
495
496
|
Kernel::raise ArgumentError.new("Argument timeout was not an Integer.") unless timeout.nil? or timeout.kind_of?(Integer)
|
|
496
497
|
Kernel::raise ArgumentError.new("Argument message was not a String.") unless message.nil? or message.kind_of?(String)
|
|
@@ -521,7 +522,7 @@ module TDriverVerify
|
|
|
521
522
|
if result != expected
|
|
522
523
|
error_msg = "Verification #{message.nil? ? '' : '"' << message.to_s << '" '}at #{verify_caller} failed:"
|
|
523
524
|
error_msg << MobyUtil::KernelHelper.find_source(verify_caller)
|
|
524
|
-
error_msg << "\nThe block did not return #{expected.inspect}. It returned: " << result.inspect
|
|
525
|
+
error_msg << "\nThe block did not return #{expected.inspect}. It returned: " << result.inspect
|
|
525
526
|
raise MobyBase::VerificationError.new(error_msg)
|
|
526
527
|
end
|
|
527
528
|
# break loop if no exceptions thrown
|
|
@@ -555,19 +556,159 @@ module TDriverVerify
|
|
|
555
556
|
|
|
556
557
|
raise if e.kind_of? MobyBase::ContinuousVerificationError
|
|
557
558
|
|
|
558
|
-
|
|
559
|
-
|
|
559
|
+
$logger.enabled = logging_enabled
|
|
560
|
+
$logger.log "behaviour" , "FAIL;Verification #{message.nil? ? '' : '\"' << message << '\" '}failed:#{e.to_s}.\n#{timeout.nil? ? '' : ' using timeout ' + timeout.to_s}.;#{self.kind_of?(MobyBase::SUT) ? self.id.to_s + ';sut' : ';'};{};verify_equal;" << expected.to_s
|
|
560
561
|
Kernel::raise e
|
|
561
562
|
ensure
|
|
562
563
|
MobyBase::TestObjectFactory.instance.timeout = original_sync_timeout unless original_sync_timeout.nil?
|
|
563
564
|
end
|
|
564
565
|
|
|
565
|
-
|
|
566
|
-
|
|
566
|
+
$logger.enabled = logging_enabled
|
|
567
|
+
$logger.log "behaviour" , "PASS;Verification #{message.nil? ? '' : '\"' << message << '\" '}at #{verify_caller} was successful#{timeout.nil? ? '' : ' using timeout ' + timeout.to_s}.;#{self.kind_of?(MobyBase::SUT) ? self.id.to_s + ';sut' : ';'};{};verify_equal;" << expected.to_s
|
|
567
568
|
return nil
|
|
568
569
|
|
|
569
570
|
end
|
|
570
571
|
|
|
572
|
+
# Verifies that the block given to return value matches with expected regular expression pattern. Verification is synchronized with all connected suts.
|
|
573
|
+
# If this method is called for a sut, synchronization is only done with that sut.
|
|
574
|
+
#
|
|
575
|
+
# === params
|
|
576
|
+
# expected:: Regular expression
|
|
577
|
+
# timeout:: (optional) Integer defining the amount of seconds during which the verification must pass.
|
|
578
|
+
# message:: (optional) A String that is displayed as additional information if the verification fails.
|
|
579
|
+
# === returns
|
|
580
|
+
# nil
|
|
581
|
+
# === raises
|
|
582
|
+
# ArgumentError:: message was not a String or timeout an integer, or no block was given.
|
|
583
|
+
# TypeError:: if block result not type of String.
|
|
584
|
+
# VerificationError:: The verification failed.
|
|
585
|
+
# RuntimeError:: An unexpected error was encountered during verification.
|
|
586
|
+
def verify_regexp( expected, timeout = nil, message = nil, &block )
|
|
587
|
+
|
|
588
|
+
logging_enabled = $logger.enabled
|
|
589
|
+
|
|
590
|
+
verify_caller = caller( 1 ).first.to_s
|
|
591
|
+
|
|
592
|
+
begin
|
|
593
|
+
|
|
594
|
+
raise ArgumentError, "No block was given." unless block_given?
|
|
595
|
+
|
|
596
|
+
# verify argument types
|
|
597
|
+
timeout.check_type [ Integer, NilClass ], "wrong argument type $1 for timeout (expected $2)"
|
|
598
|
+
message.check_type [ String, NilClass ], "wrong argument type $1 for message (expected $2)"
|
|
599
|
+
expected.check_type Regexp, "wrong argument type $1 for expected result (expected $2)"
|
|
600
|
+
|
|
601
|
+
$logger.enabled = false
|
|
602
|
+
|
|
603
|
+
#Set the testobject timeout to 0 for the duration of the verify call
|
|
604
|
+
original_sync_timeout = MobyBase::TestObjectFactory.instance.timeout
|
|
605
|
+
|
|
606
|
+
MobyBase::TestObjectFactory.instance.timeout = 0
|
|
607
|
+
|
|
608
|
+
timeout_time = get_end_time( timeout )
|
|
609
|
+
|
|
610
|
+
loop do
|
|
611
|
+
|
|
612
|
+
counter = ref_counter
|
|
613
|
+
|
|
614
|
+
# catch errors thrown due to verification results
|
|
615
|
+
begin
|
|
616
|
+
|
|
617
|
+
# catch errors thrown in the provided block
|
|
618
|
+
begin
|
|
619
|
+
|
|
620
|
+
# execute block
|
|
621
|
+
result = yield
|
|
622
|
+
|
|
623
|
+
rescue Exception
|
|
624
|
+
|
|
625
|
+
raise if $!.kind_of?( MobyBase::ContinuousVerificationError )
|
|
626
|
+
|
|
627
|
+
error_msg = "Verification #{ message.nil? ? '' : '"' << message.to_s << '" '}at #{ verify_caller } failed as an exception was thrown when the verification block was executed."
|
|
628
|
+
|
|
629
|
+
error_msg << MobyUtil::KernelHelper.find_source( verify_caller )
|
|
630
|
+
|
|
631
|
+
error_msg << "\nDetails: \n#{ $!.inspect }"
|
|
632
|
+
|
|
633
|
+
raise MobyBase::VerificationError, error_msg
|
|
634
|
+
|
|
635
|
+
end
|
|
636
|
+
|
|
637
|
+
# verify that result value is type of string
|
|
638
|
+
result.check_type String, "wrong variable type $1 for result (expected $2)"
|
|
639
|
+
|
|
640
|
+
# result verification
|
|
641
|
+
unless result =~ expected
|
|
642
|
+
|
|
643
|
+
error_msg = "Verification #{ message.nil? ? '' : '"' << message.to_s << '" '}at #{ verify_caller } failed:"
|
|
644
|
+
|
|
645
|
+
error_msg << MobyUtil::KernelHelper.find_source( verify_caller )
|
|
646
|
+
|
|
647
|
+
error_msg << "\nThe block did not match with pattern #{ expected.inspect }. It returned: #{ result.inspect }"
|
|
648
|
+
|
|
649
|
+
raise MobyBase::VerificationError, error_msg
|
|
650
|
+
|
|
651
|
+
end
|
|
652
|
+
|
|
653
|
+
# break loop if no exceptions thrown
|
|
654
|
+
break
|
|
655
|
+
|
|
656
|
+
rescue MobyBase::VerificationError
|
|
657
|
+
|
|
658
|
+
# refresh and retry unless timeout reached
|
|
659
|
+
|
|
660
|
+
raise $! if Time.new > timeout_time
|
|
661
|
+
|
|
662
|
+
sleep TIMEOUT_CYCLE_SECONDS
|
|
663
|
+
|
|
664
|
+
refresh_suts if counter == ref_counter
|
|
665
|
+
|
|
666
|
+
rescue MobyBase::ContinuousVerificationError
|
|
667
|
+
|
|
668
|
+
raise
|
|
669
|
+
|
|
670
|
+
rescue TypeError
|
|
671
|
+
|
|
672
|
+
raise $!
|
|
673
|
+
|
|
674
|
+
rescue Exception
|
|
675
|
+
|
|
676
|
+
raise if $!.kind_of?( MobyBase::ContinuousVerificationError )
|
|
677
|
+
|
|
678
|
+
# an unexpected error has occurred
|
|
679
|
+
raise RuntimeError, "An unexpected error was encountered during verification:\n#{ $!.inspect }"
|
|
680
|
+
|
|
681
|
+
end # begin, catch any VerificationErrors
|
|
682
|
+
|
|
683
|
+
end # do
|
|
684
|
+
|
|
685
|
+
rescue Exception
|
|
686
|
+
|
|
687
|
+
execute_on_error_verify_block unless @@on_error_verify_block.nil?
|
|
688
|
+
|
|
689
|
+
raise if $!.kind_of?( MobyBase::ContinuousVerificationError )
|
|
690
|
+
|
|
691
|
+
$logger.enabled = logging_enabled
|
|
692
|
+
|
|
693
|
+
$logger.log "behaviour" , "FAIL;Verification #{message.nil? ? '' : '\"' << message << '\" '}failed:#{ $!.to_s }.\n#{ timeout.nil? ? '' : ' using timeout ' + timeout.to_s }.;#{ self.kind_of?( MobyBase::SUT ) ? "#{ self.id.to_s };sut" : ';' };{};verify_regexp;#{ expected.inspect }"
|
|
694
|
+
|
|
695
|
+
raise $!
|
|
696
|
+
|
|
697
|
+
ensure
|
|
698
|
+
|
|
699
|
+
MobyBase::TestObjectFactory.instance.timeout = original_sync_timeout
|
|
700
|
+
|
|
701
|
+
$logger.enabled = logging_enabled
|
|
702
|
+
|
|
703
|
+
end
|
|
704
|
+
|
|
705
|
+
$logger.log "behaviour", "PASS;Verification #{ message.nil? ? '' : '\"' << message << '\" ' }at #{ verify_caller } was successful#{ timeout.nil? ? '' : ' using timeout ' + timeout.to_s}.;#{ self.kind_of?( MobyBase::SUT ) ? "#{ self.id.to_s };sut" : ';'};{};verify_regexp;#{ expected.inspect }"
|
|
706
|
+
|
|
707
|
+
nil
|
|
708
|
+
|
|
709
|
+
end
|
|
710
|
+
|
|
711
|
+
|
|
571
712
|
# Verifies that the given signal is emitted.
|
|
572
713
|
#
|
|
573
714
|
# === params
|
|
@@ -582,12 +723,12 @@ module TDriverVerify
|
|
|
582
723
|
# VerificationError:: The verification failed.
|
|
583
724
|
def verify_signal( timeout, signal_name, message = nil, &block )
|
|
584
725
|
|
|
585
|
-
logging_enabled =
|
|
726
|
+
logging_enabled = $logger.enabled
|
|
586
727
|
verify_caller = caller(1).first.to_s
|
|
587
728
|
|
|
588
729
|
begin
|
|
589
730
|
|
|
590
|
-
|
|
731
|
+
$logger.enabled = false
|
|
591
732
|
|
|
592
733
|
Kernel::raise ArgumentError.new("Argument timeout was not a non negative Integer.") unless (timeout.kind_of?(Integer) && timeout >= 0)
|
|
593
734
|
Kernel::raise ArgumentError.new("Argument message was not a non empty String.") unless (message.nil? || (message.kind_of?(String) && !message.empty?))
|
|
@@ -601,7 +742,7 @@ module TDriverVerify
|
|
|
601
742
|
|
|
602
743
|
error_msg = "Verification #{message.nil? ? '' : '"' << message.to_s << '" '}at #{verify_caller} failed:"
|
|
603
744
|
error_msg << MobyUtil::KernelHelper.find_source(verify_caller)
|
|
604
|
-
error_msg << "The signal #{signal_name} was not emitted in #{timeout} seconds."
|
|
745
|
+
error_msg << "The signal #{signal_name} was not emitted in #{timeout} seconds."
|
|
605
746
|
error_msg << "\nNested exception:\n" << e.inspect
|
|
606
747
|
Kernel::raise MobyBase::VerificationError.new(error_msg)
|
|
607
748
|
|
|
@@ -611,13 +752,13 @@ module TDriverVerify
|
|
|
611
752
|
|
|
612
753
|
execute_on_error_verify_block unless @@on_error_verify_block.nil?
|
|
613
754
|
|
|
614
|
-
|
|
615
|
-
|
|
755
|
+
$logger.enabled = logging_enabled
|
|
756
|
+
$logger.log "behaviour" , "FAIL;Verification #{message.nil? ? '' : '\"' << message << '\" '}failed: #{e.to_s} using timeout '#{timeout}.;#{self.kind_of?(MobyBase::SUT) ? self.id.to_s + ';sut' : ';'};{};verify_signal;#{signal_name}"
|
|
616
757
|
Kernel::raise e
|
|
617
758
|
end
|
|
618
759
|
|
|
619
|
-
|
|
620
|
-
|
|
760
|
+
$logger.enabled = logging_enabled
|
|
761
|
+
$logger.log "behaviour" , "PASS;Verification #{message.nil? ? '' : '\"' << message << '\" '}at #{verify_caller} was successful#{timeout.nil? ? '' : ' using timeout ' + timeout.to_s}.;#{self.kind_of?(MobyBase::SUT) ? self.id.to_s + ';sut' : ';'};{};verify_signal;#{signal_name}"
|
|
621
762
|
return nil
|
|
622
763
|
|
|
623
764
|
end
|
|
@@ -647,12 +788,14 @@ module TDriverVerify
|
|
|
647
788
|
counter
|
|
648
789
|
end
|
|
649
790
|
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
791
|
+
def verify_refresh(b_use_id=true)
|
|
792
|
+
if self.kind_of? MobyBase::SUT
|
|
793
|
+
begin
|
|
794
|
+
appid = self.get_application_id
|
|
795
|
+
rescue
|
|
796
|
+
appid='-1'
|
|
797
|
+
end
|
|
798
|
+
if appid != "-1" && b_use_id
|
|
656
799
|
self.refresh({:id => appid})
|
|
657
800
|
else
|
|
658
801
|
self.refresh
|
|
@@ -660,21 +803,35 @@ module TDriverVerify
|
|
|
660
803
|
else
|
|
661
804
|
#refresh all connected suts
|
|
662
805
|
MobyBase::SUTFactory.instance.connected_suts.each do |sut_id, sut_attributes|
|
|
663
|
-
|
|
664
|
-
|
|
806
|
+
begin
|
|
807
|
+
appid = sut_attributes[:sut].get_application_id
|
|
808
|
+
rescue
|
|
809
|
+
appid='-1'
|
|
810
|
+
end
|
|
811
|
+
if appid != "-1" && b_use_id
|
|
665
812
|
sut_attributes[:sut].refresh({:id => appid}) if sut_attributes[:is_connected]
|
|
666
813
|
else
|
|
667
814
|
sut_attributes[:sut].refresh if sut_attributes[:is_connected]
|
|
668
815
|
end
|
|
669
816
|
end
|
|
670
817
|
end
|
|
818
|
+
end
|
|
671
819
|
|
|
820
|
+
# Refresh ui state inside verify
|
|
821
|
+
def refresh_suts
|
|
822
|
+
begin
|
|
823
|
+
verify_refresh
|
|
672
824
|
# Ignore all availability errors
|
|
673
|
-
rescue RuntimeError => e
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
825
|
+
rescue RuntimeError, MobyBase::ApplicationNotAvailableError => e
|
|
826
|
+
begin
|
|
827
|
+
verify_refresh(false)
|
|
828
|
+
rescue RuntimeError, MobyBase::ApplicationNotAvailableError => e
|
|
829
|
+
# This occurs when no applications are registered to sut
|
|
830
|
+
if !(e.message =~ /no longer available/)
|
|
831
|
+
puts 'Raising exception'
|
|
832
|
+
# all other errors are passed up
|
|
833
|
+
raise e
|
|
834
|
+
end
|
|
678
835
|
end
|
|
679
836
|
end
|
|
680
837
|
end
|