testability-driver 1.1.0 → 1.1.1
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/base/behaviour/factory.rb +82 -51
- data/lib/tdriver/base/sut/controller.rb +33 -24
- data/lib/tdriver/base/sut/factory.rb +24 -21
- data/lib/tdriver/base/sut/generic/behaviours/application.rb +103 -34
- data/lib/tdriver/base/sut/generic/behaviours/sut.rb +56 -2
- data/lib/tdriver/base/sut/generic/commands/application.rb +248 -4
- data/lib/tdriver/base/sut/generic/plugin.rb +1 -1
- data/lib/tdriver/base/test_object/adapter.rb +67 -16
- data/lib/tdriver/base/test_object/behaviours/test_object.rb +14 -4
- data/lib/tdriver/loader.rb +1 -3
- data/lib/tdriver/report/error_recovery/tdriver_error_recovery.rb +6 -5
- data/lib/tdriver/report/error_recovery/tdriver_error_recovery_settings.rb +9 -1
- data/lib/tdriver/report/report.rb +3 -0
- data/lib/tdriver/report/report_api.rb +29 -23
- data/lib/tdriver/report/report_crash_file_capture.rb +2 -0
- data/lib/tdriver/report/report_creator.rb +74 -46
- data/lib/tdriver/report/report_test_case_run.rb +86 -68
- data/lib/tdriver/report/report_test_run.rb +46 -2
- data/lib/tdriver/report/report_writer.rb +35 -13
- data/lib/tdriver/tdriver.rb +3 -0
- data/lib/tdriver/util/plugin/service.rb +168 -76
- data/lib/tdriver/util/recorder/scripter.rb +76 -40
- data/lib/tdriver/version.rb +1 -1
- data/xml/templates/generic.xml +6 -1
- metadata +2 -2
@@ -29,6 +29,8 @@ module MobyBase
|
|
29
29
|
@@behaviours = []
|
30
30
|
@@behaviours_cache = {}
|
31
31
|
@@modules_cache = {}
|
32
|
+
|
33
|
+
@@plugin_cache = []
|
32
34
|
|
33
35
|
# behaviour xml files path
|
34
36
|
@@path = File.join( MobyUtil::FileHelper.tdriver_home, '/behaviours/*.xml' )
|
@@ -126,60 +128,50 @@ module MobyBase
|
|
126
128
|
# merge user-defined rules on top of default rules set
|
127
129
|
#rules = { :sut_type => ['*'], :object_type => ['*'], :input_type => ['*'], :version => ['*'] }.merge!( rules )
|
128
130
|
|
131
|
+
raise ArgumentError, 'Target object not defined in rules hash' if rules[ :object ].nil?
|
132
|
+
|
129
133
|
rules.default = ['*']
|
130
134
|
|
131
|
-
|
135
|
+
# retrieve enabled plugins from PluginService
|
136
|
+
enabled_plugins = TDriver::PluginService.enabled_plugins
|
132
137
|
|
133
138
|
# apply behaviours to target object
|
134
|
-
|
139
|
+
get_object_behaviours( rules ).each{ | behaviour_index |
|
135
140
|
|
136
141
|
behaviour_data = @@behaviours[ behaviour_index ]
|
137
142
|
|
138
|
-
# skip if required plugin is not registered or enabled
|
139
|
-
next
|
140
|
-
|
141
|
-
#MobyUtil::PluginService.instance.plugin_registered?( plugin ) && MobyUtil::PluginService.instance.plugin_enabled?( plugin )
|
142
|
-
|
143
|
-
# verify if plugin is enabled -- exception will be catched if plugin is not registered
|
144
|
-
MobyUtil::PluginService.instance.plugin_enabled?( plugin ) rescue false
|
145
|
-
|
146
|
-
}.include?( false )
|
143
|
+
# skip if required plugin is not registered or enabled; compare requires array and enabled_plugins array
|
144
|
+
next unless ( behaviour_data[ :requires ] - enabled_plugins ).empty?
|
147
145
|
|
148
146
|
begin
|
149
147
|
|
150
|
-
#behaviour_module = MobyUtil::KernelHelper.get_constant( behaviour_data[ :module ][ :name ] )
|
151
|
-
|
152
148
|
# retrieve behaviour module from cache and extend target object
|
153
149
|
rules[ :object ].extend(
|
150
|
+
|
154
151
|
@@modules_cache.fetch( behaviour_data[ :module ][ :name ] ){ | name |
|
152
|
+
|
155
153
|
# ... or store to cache for the next time if not found
|
156
154
|
@@modules_cache[ name ] = MobyUtil::KernelHelper.get_constant( name )
|
155
|
+
|
157
156
|
}
|
157
|
+
|
158
158
|
)
|
159
159
|
|
160
|
-
rescue NameError
|
160
|
+
rescue NameError
|
161
|
+
|
162
|
+
raise NameError, "Implementation for behaviour #{ behaviour_data[ :name ] } does not exist. (#{ behaviour_data[ :module ][ :name ] })"
|
161
163
|
|
162
|
-
Kernel::raise exception.class.new(
|
163
|
-
"Implementation for behaviour %s does not exist. (%s)" % [ behaviour_data[ :name ], behaviour_data[ :module ][ :name ] ]
|
164
|
-
)
|
165
164
|
|
166
|
-
rescue
|
165
|
+
rescue
|
167
166
|
|
168
|
-
|
169
|
-
"Error while applying %s (%s) behaviour to target object. Reason: %s (%s)" % [
|
170
|
-
behaviour_data[ :name ],
|
171
|
-
behaviour_data[ :module ][ :name ],
|
172
|
-
exception.message,
|
173
|
-
exception.class
|
174
|
-
]
|
175
|
-
)
|
167
|
+
raise RuntimeError, "Error while applying #{ behaviour_data[ :name ] } (#{ behaviour_data[ :module ][ :name ] }) behaviour to target object. Reason: #{ $!.message } (#{ $!.class })"
|
176
168
|
|
177
169
|
end
|
178
170
|
|
179
171
|
# add behaviour information to test object
|
180
172
|
rules[ :object ].instance_exec{
|
181
173
|
|
182
|
-
@object_behaviours.push( behaviour_index ) unless @object_behaviours.include? behaviour_index
|
174
|
+
@object_behaviours.push( behaviour_index ) unless @object_behaviours.include?( behaviour_index )
|
183
175
|
|
184
176
|
}
|
185
177
|
|
@@ -197,7 +189,7 @@ module MobyBase
|
|
197
189
|
|
198
190
|
begin
|
199
191
|
|
200
|
-
Dir.glob( behaviour_files ).each
|
192
|
+
Dir.glob( behaviour_files ).each{ | behaviour |
|
201
193
|
|
202
194
|
@file_name = behaviour
|
203
195
|
|
@@ -341,47 +333,86 @@ module MobyBase
|
|
341
333
|
|
342
334
|
end
|
343
335
|
|
336
|
+
=begin
|
344
337
|
def get_object_behaviours( rules )
|
345
338
|
|
346
|
-
|
347
|
-
|
339
|
+
# calculate hash for behaviour rules / hash value will be used to identify similar objects
|
340
|
+
behaviour_hash = Hash[ rules.select{ | key, value | key != :object } ].hash
|
348
341
|
|
349
|
-
|
342
|
+
if @@behaviours_cache.has_key?( behaviour_hash )
|
350
343
|
|
351
|
-
|
352
|
-
|
344
|
+
# retrieve behaviour module indexes from cache
|
345
|
+
@@behaviours_cache[ behaviour_hash ]
|
353
346
|
|
354
|
-
|
347
|
+
else
|
355
348
|
|
356
|
-
|
349
|
+
rules.default = [ '*' ]
|
357
350
|
|
358
|
-
|
351
|
+
extended_modules = []
|
359
352
|
|
360
|
-
|
353
|
+
@@behaviours.each_with_index{ | behaviour, index |
|
361
354
|
|
362
|
-
|
355
|
+
if ( ( rules[ :name ] == behaviour[ :name ] ) ||
|
363
356
|
|
364
|
-
|
357
|
+
( rules[ :name ] == [ '*' ] &&
|
365
358
|
|
366
|
-
# ( !( rules[ :sut_type ] & behaviour[ :sut_type ] ).empty? ) &&
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
359
|
+
# ( !( rules[ :sut_type ] & behaviour[ :sut_type ] ).empty? ) &&
|
360
|
+
( !( rules[ :object_type ] & behaviour[ :object_type ] ).empty? ) &&
|
361
|
+
( !( rules[ :input_type ] & behaviour[ :input_type ] ).empty? ) &&
|
362
|
+
( !( rules[ :env ] & behaviour[ :env ] ).empty? ) &&
|
363
|
+
( !( rules[ :version ] & behaviour[ :version ] ).empty? ) ) )
|
371
364
|
|
372
|
-
|
373
|
-
|
365
|
+
# retrieve list of extended modules
|
366
|
+
extended_modules << index
|
374
367
|
|
375
|
-
|
368
|
+
end
|
376
369
|
|
377
|
-
|
370
|
+
}
|
378
371
|
|
379
|
-
|
380
|
-
|
372
|
+
# store behaviour module indexes to cache
|
373
|
+
@@behaviours_cache[ behaviour_hash ] = extended_modules
|
381
374
|
|
382
|
-
|
375
|
+
end
|
383
376
|
|
384
377
|
end
|
378
|
+
=end
|
379
|
+
|
380
|
+
def get_object_behaviours( rule )
|
381
|
+
|
382
|
+
# calculate hash for behaviour rule / hash value will be used to identify similar objects
|
383
|
+
@@behaviours_cache.fetch( rule.delete_keys( :object ).hash ){ | behaviour_hash |
|
384
|
+
|
385
|
+
rule.default = [ '*' ]
|
386
|
+
|
387
|
+
@@behaviours_cache[ behaviour_hash ] = @@behaviours.each_with_index.collect{ | behaviour, index |
|
388
|
+
|
389
|
+
case rule[ :name ]
|
390
|
+
|
391
|
+
when behaviour[ :name ]
|
392
|
+
|
393
|
+
index
|
394
|
+
|
395
|
+
when [ '*' ]
|
396
|
+
|
397
|
+
index if (
|
398
|
+
!( rule[ :object_type ] & behaviour[ :object_type ] ).empty? &&
|
399
|
+
!( rule[ :input_type ] & behaviour[ :input_type ] ).empty? &&
|
400
|
+
!( rule[ :env ] & behaviour[ :env ] ).empty? &&
|
401
|
+
!( rule[ :version ] & behaviour[ :version ] ).empty?
|
402
|
+
)
|
403
|
+
|
404
|
+
else
|
405
|
+
|
406
|
+
nil
|
407
|
+
|
408
|
+
end
|
409
|
+
|
410
|
+
}.compact
|
411
|
+
|
412
|
+
}
|
413
|
+
|
414
|
+
end
|
415
|
+
|
385
416
|
|
386
417
|
def get_behaviour_from_cache( target, sut_type, object_type, sut_version, input_type )
|
387
418
|
|
@@ -84,30 +84,39 @@ module MobyBase
|
|
84
84
|
# TypeError:: Wrong argument type $1 for command_data (expected $2)
|
85
85
|
# MobyBase::CommandNotFoundError:: if no implementation is found for the CommandData object
|
86
86
|
def execute_command( command_data )
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
87
|
+
command_data.check_type( MobyCommand::CommandData, "Wrong argument type $1 for command_data (expected $2)" )
|
88
|
+
|
89
|
+
@execution_order.each{ | controller |
|
90
|
+
|
91
|
+
begin
|
92
|
+
|
93
|
+
# extend command_data with combinination of command data object name and module name to be extended
|
94
|
+
eval 'command_data.extend %s::%s' % [ @sut_controllers[ controller ].first.first, command_data.class.name.scan( /::(.+)/ ).first.first ]
|
95
|
+
|
96
|
+
# break if controller associated succesfully
|
97
|
+
break
|
98
|
+
|
99
|
+
rescue NameError
|
100
|
+
|
101
|
+
# raise exception only if none controller found
|
102
|
+
Kernel::raise MobyBase::ControllerNotFoundError.new( 'No controller found for CommandData object %s' % command_data.inspect ) unless controller.object_id != @execution_order.last.object_id
|
103
|
+
end
|
104
|
+
|
105
|
+
}
|
106
|
+
|
107
|
+
command_data.set_adapter( @sut_adapter )
|
108
|
+
retries = 0
|
109
|
+
begin
|
110
|
+
command_data.execute
|
111
|
+
rescue Errno::EPIPE, IOError => e
|
112
|
+
raise if retries == 1
|
113
|
+
retries += 1
|
114
|
+
if MobyBase::SUTFactory.instance.connected_suts.include?(@sut_adapter.sut_id.to_sym)
|
115
|
+
@sut_adapter.disconnect
|
116
|
+
@sut_adapter.connect(@sut_adapter.sut_id)
|
117
|
+
end
|
118
|
+
retry
|
119
|
+
end
|
111
120
|
end
|
112
121
|
|
113
122
|
# enable hooking for performance measurement & debug logging
|
@@ -73,13 +73,13 @@ module MobyBase
|
|
73
73
|
sut = $parameters[ sut_id, nil ]
|
74
74
|
|
75
75
|
# raise exception if sut was not found
|
76
|
-
|
76
|
+
raise ArgumentError, "#{ sut_id.to_s } not defined in TDriver parameters XML" if sut.nil?
|
77
77
|
|
78
78
|
# retrieve sut type from parameters
|
79
79
|
sut_type = sut[ :type, nil ]
|
80
80
|
|
81
81
|
# raise exception if sut type was not found
|
82
|
-
|
82
|
+
raise RuntimeError, "SUT parameter 'type' not defined for #{ sut_id.to_s } in TDriver parameters/templates XML" if sut_type.nil?
|
83
83
|
|
84
84
|
sut_type_symbol = sut_type.downcase.to_sym
|
85
85
|
|
@@ -90,7 +90,7 @@ module MobyBase
|
|
90
90
|
sut_env = sut[ :env, '*' ]
|
91
91
|
|
92
92
|
# verify that sut plugin is defined in sut configuration
|
93
|
-
|
93
|
+
raise RuntimeError, "SUT parameter 'sut_plugin' not defined for #{ sut_id.to_s } (#{ sut_type.to_s })" if sut_plugin.nil?
|
94
94
|
|
95
95
|
# flag to determine that should exception be raised; allow one retry, then set flag to true if error still occures
|
96
96
|
raise_exception = false
|
@@ -98,26 +98,27 @@ module MobyBase
|
|
98
98
|
begin
|
99
99
|
|
100
100
|
# verify that sut plugin is registered
|
101
|
-
if
|
101
|
+
if TDriver::PluginService.plugin_registered?( sut_plugin, :sut )
|
102
102
|
|
103
103
|
# create sut object
|
104
|
-
created_sut =
|
104
|
+
created_sut = TDriver::PluginService.call_plugin_method( sut_plugin, :make_sut, sut_id )
|
105
105
|
|
106
106
|
else
|
107
107
|
|
108
108
|
# raise error if sut was not registered
|
109
|
-
|
109
|
+
raise NotImplementedError, "No plugin implementation found for SUT type: #{ sut_type }"
|
110
110
|
|
111
111
|
end
|
112
112
|
|
113
113
|
rescue Exception => exception
|
114
114
|
|
115
115
|
# if sut was not registered, try to load it
|
116
|
-
|
116
|
+
TDriver::PluginService.load_plugin( sut_plugin ) if exception.kind_of?( NotImplementedError )
|
117
117
|
|
118
118
|
if !raise_exception
|
119
119
|
|
120
120
|
raise_exception = true
|
121
|
+
|
121
122
|
retry
|
122
123
|
|
123
124
|
else
|
@@ -161,29 +162,31 @@ module MobyBase
|
|
161
162
|
|
162
163
|
begin
|
163
164
|
|
164
|
-
|
165
|
-
|
165
|
+
# verify that extension plugin is registered
|
166
|
+
unless TDriver::PluginService.plugin_registered?( plugin_name, :extension )
|
166
167
|
|
167
|
-
|
168
|
-
|
168
|
+
# raise error if sut was not registered
|
169
|
+
raise NotImplementedError, "Extension plugin not found #{ plugin_name }"
|
169
170
|
|
170
|
-
|
171
|
+
end
|
171
172
|
|
172
173
|
rescue Exception => exception
|
173
174
|
|
174
|
-
|
175
|
-
|
175
|
+
# if sut was not registered, try to load it
|
176
|
+
TDriver::PluginService.load_plugin( plugin_name ) if exception.kind_of?( NotImplementedError )
|
176
177
|
|
177
|
-
|
178
|
+
if !raise_exception
|
178
179
|
|
179
|
-
|
180
|
-
retry
|
181
|
-
else
|
180
|
+
raise_exception = true
|
182
181
|
|
183
|
-
|
184
|
-
Kernel::raise exception
|
182
|
+
retry
|
185
183
|
|
186
|
-
|
184
|
+
else
|
185
|
+
|
186
|
+
# still errors, raise original exception
|
187
|
+
Kernel::raise exception
|
188
|
+
|
189
|
+
end
|
187
190
|
|
188
191
|
end
|
189
192
|
|
@@ -99,38 +99,53 @@ module MobyBehaviour
|
|
99
99
|
begin
|
100
100
|
|
101
101
|
# check if closable
|
102
|
-
|
102
|
+
raise RuntimeError, 'The application is of a type that cannot be closed.' unless closable?
|
103
103
|
|
104
|
+
# default options
|
104
105
|
default_options = { :force_kill => nil, :check_process => true }
|
105
|
-
|
106
|
+
|
107
|
+
# for backwards compatibility
|
106
108
|
if options_hash.kind_of?( Hash )
|
107
109
|
|
110
|
+
# merge user defined options with default options
|
108
111
|
close_options = default_options.merge( options_hash )
|
109
112
|
|
110
113
|
else
|
111
114
|
|
112
|
-
# support legacy option of defining only force_kill
|
115
|
+
# support legacy option of defining only force_kill as argument
|
113
116
|
close_options = default_options
|
114
117
|
|
118
|
+
# if options defined
|
115
119
|
if options_hash != nil
|
116
120
|
|
121
|
+
# workaround/backwards compatibility: allow string as hash key value
|
122
|
+
options_hash = options_hash.to_boolean if options_hash.kind_of?( String )
|
123
|
+
|
117
124
|
# verify options_hash value
|
118
|
-
options_hash.check_type( [
|
125
|
+
options_hash.check_type( [ FalseClass, TrueClass ], "Wrong argument type $1 for options hash (expected $2)" )
|
119
126
|
|
127
|
+
# store force_kill value
|
120
128
|
close_options[ :force_kill ] = options_hash
|
121
129
|
|
122
130
|
end
|
123
131
|
|
124
132
|
end
|
133
|
+
|
134
|
+
# workaround/backwards compatibility: allow string as hash key value
|
135
|
+
close_options[ :force_kill ] = close_options[ :force_kill ].to_boolean if close_options[ :force_kill ].kind_of?( String )
|
125
136
|
|
126
|
-
# verify :force_kill
|
137
|
+
# verify :force_kill value type
|
127
138
|
close_options[ :force_kill ].check_type( [ NilClass, TrueClass, FalseClass ], "Wrong argument type $1 for :force_kill (expected $2)" )
|
128
139
|
|
129
|
-
#
|
140
|
+
# workaround/backwards compatibility: allow string as hash key value
|
141
|
+
close_options[ :check_process ] = close_options[ :check_process ].to_boolean if close_options[ :check_process ].kind_of?( String )
|
142
|
+
|
143
|
+
# verify :check_process value type
|
130
144
|
close_options[ :check_process ].check_type( [ TrueClass, FalseClass ], "Wrong argument type $1 for :check_process (expected $2)" )
|
131
145
|
|
132
|
-
if close_options[ :force_kill ] != nil
|
146
|
+
if close_options[ :force_kill ] != nil
|
133
147
|
|
148
|
+
=begin
|
134
149
|
@sut.execute_command(
|
135
150
|
MobyCommand::Application.new(
|
136
151
|
:Close, # command_type
|
@@ -139,6 +154,7 @@ module MobyBehaviour
|
|
139
154
|
self.sut, # sut
|
140
155
|
nil, # arguments
|
141
156
|
nil, # environment
|
157
|
+
nil, # working directory
|
142
158
|
nil, # events_to_listen
|
143
159
|
nil, # signals_to_listen
|
144
160
|
{ # flags
|
@@ -146,41 +162,73 @@ module MobyBehaviour
|
|
146
162
|
}
|
147
163
|
)
|
148
164
|
)
|
165
|
+
=end
|
166
|
+
|
167
|
+
@sut.execute_command(
|
168
|
+
MobyCommand::Application.new(
|
169
|
+
:Close, # command_type
|
170
|
+
{
|
171
|
+
:application_name => self.name,
|
172
|
+
:application_uid => self.uid,
|
173
|
+
:sut => self.sut,
|
174
|
+
:flags => { :force_kill => close_options[ :force_kill ] }
|
175
|
+
}
|
176
|
+
)
|
177
|
+
)
|
149
178
|
|
150
179
|
else
|
151
180
|
|
181
|
+
=begin
|
152
182
|
@sut.execute_command(
|
153
183
|
MobyCommand::Application.new(
|
154
184
|
:Close,
|
155
185
|
self.name,
|
156
186
|
self.uid,
|
157
|
-
self.sut
|
158
|
-
|
187
|
+
self.sut
|
188
|
+
)
|
189
|
+
)
|
190
|
+
=end
|
191
|
+
|
192
|
+
@sut.execute_command(
|
193
|
+
MobyCommand::Application.new(
|
194
|
+
:Close,
|
195
|
+
{
|
196
|
+
:application_name => self.name,
|
197
|
+
:application_uid => self.uid,
|
198
|
+
:sut => self.sut
|
199
|
+
}
|
159
200
|
)
|
160
201
|
)
|
161
202
|
|
162
203
|
end
|
163
204
|
|
164
|
-
#
|
205
|
+
# store start time
|
206
|
+
start_time = Time.now
|
207
|
+
|
208
|
+
# store original logger state
|
165
209
|
original_logger_state = $logger.enabled
|
210
|
+
|
211
|
+
# disable logging
|
166
212
|
$logger.enabled = false
|
167
213
|
|
168
|
-
#
|
169
|
-
|
170
|
-
start_time = Time.now
|
171
|
-
timeout_time = $parameters[ self.sut.id ][ :application_synchronization_timeout, '60' ].to_f
|
172
|
-
begin
|
214
|
+
# retrieve application synchronization timeout value
|
215
|
+
timeout_time = $parameters[ self.sut.id ][ :application_synchronization_timeout, '60' ].to_f
|
173
216
|
|
174
|
-
|
217
|
+
# create application identification hash
|
218
|
+
application_identification_hash = { :type => 'application', :id => @id }
|
175
219
|
|
220
|
+
begin
|
221
|
+
|
222
|
+
# verify close results
|
176
223
|
MobyUtil::Retryable.until(
|
177
224
|
:timeout => timeout_time,
|
178
225
|
:interval => $parameters[ self.sut.id ][ :application_synchronization_retry_interval, '0.25' ].to_f,
|
179
226
|
:exception => MobyBase::VerificationError,
|
180
|
-
:unless => [MobyBase::TestObjectNotFoundError, MobyBase::ApplicationNotAvailableError]
|
227
|
+
:unless => [ MobyBase::TestObjectNotFoundError, MobyBase::ApplicationNotAvailableError ]
|
228
|
+
){
|
181
229
|
|
182
230
|
# raises MobyBase::ApplicationNotAvailableError if application was not found
|
183
|
-
@sut.refresh( application_identification_hash, [{:className=>
|
231
|
+
@sut.refresh( application_identification_hash, [ {:className => 'application', :tasId => @id } ] )
|
184
232
|
|
185
233
|
# retrieve application object from sut.xml_data
|
186
234
|
matches, unused_rule = TDriver::TestObjectAdapter.get_objects( @sut.xml_data, application_identification_hash, true )
|
@@ -189,7 +237,7 @@ module MobyBehaviour
|
|
189
237
|
if ( close_options[ :check_process ] == true )
|
190
238
|
|
191
239
|
# the application did not close
|
192
|
-
raise MobyBase::VerificationError
|
240
|
+
raise MobyBase::VerificationError, "Verification of close failed. The application that was to be closed is still running." if matches.count > 0 && (Time.now - start_time) >= timeout_time
|
193
241
|
|
194
242
|
elsif ( close_options[ :check_process ] == false )
|
195
243
|
|
@@ -214,7 +262,7 @@ module MobyBehaviour
|
|
214
262
|
# The application could not be found, break
|
215
263
|
break
|
216
264
|
|
217
|
-
}
|
265
|
+
} # MobyUtil::Retryable.until
|
218
266
|
|
219
267
|
rescue MobyBase::TestObjectNotFoundError
|
220
268
|
|
@@ -224,14 +272,10 @@ module MobyBehaviour
|
|
224
272
|
|
225
273
|
# everything ok: application not running anymore
|
226
274
|
|
227
|
-
rescue RuntimeError
|
275
|
+
rescue RuntimeError
|
228
276
|
|
229
|
-
|
230
|
-
|
231
|
-
# something unexpected happened during the close, let exception through
|
232
|
-
raise e
|
233
|
-
|
234
|
-
end
|
277
|
+
# something unexpected happened during the close, let exception through
|
278
|
+
raise unless $!.message =~ /The application with Id \d+ is no longer available/
|
235
279
|
|
236
280
|
ensure
|
237
281
|
|
@@ -240,14 +284,16 @@ module MobyBehaviour
|
|
240
284
|
|
241
285
|
end
|
242
286
|
|
243
|
-
rescue Exception
|
287
|
+
rescue Exception
|
288
|
+
|
289
|
+
$logger.behaviour "FAIL;Failed when closing.;#{ identity };close;"
|
244
290
|
|
245
|
-
|
246
|
-
|
291
|
+
# let exception through
|
292
|
+
raise
|
247
293
|
|
248
294
|
end
|
249
295
|
|
250
|
-
$logger.
|
296
|
+
$logger.behaviour "PASS;Closed successfully.;#{ identity };close;"
|
251
297
|
|
252
298
|
#@sut.application
|
253
299
|
|
@@ -345,9 +391,20 @@ module MobyBehaviour
|
|
345
391
|
#
|
346
392
|
#
|
347
393
|
def bring_to_foreground
|
348
|
-
@sut.execute_command(MobyCommand::Application.new(:BringToForeground, nil, self.uid, self.sut))
|
349
|
-
end
|
350
394
|
|
395
|
+
#@sut.execute_command(MobyCommand::Application.new(:BringToForeground, nil, self.uid, self.sut))
|
396
|
+
|
397
|
+
@sut.execute_command(
|
398
|
+
MobyCommand::Application.new(
|
399
|
+
:BringToForeground,
|
400
|
+
{
|
401
|
+
:application_uid => self.uid,
|
402
|
+
:sut => self.sut
|
403
|
+
}
|
404
|
+
)
|
405
|
+
)
|
406
|
+
|
407
|
+
end
|
351
408
|
|
352
409
|
# == description
|
353
410
|
# Kills the application process
|
@@ -359,7 +416,19 @@ module MobyBehaviour
|
|
359
416
|
#
|
360
417
|
def kill
|
361
418
|
|
362
|
-
|
419
|
+
#@sut.execute_command( MobyCommand::Application.new( :Kill, self.executable_name, self.uid, self.sut ) )
|
420
|
+
|
421
|
+
@sut.execute_command(
|
422
|
+
MobyCommand::Application.new(
|
423
|
+
:Kill,
|
424
|
+
{
|
425
|
+
:application_name => self.executable_name,
|
426
|
+
:application_uid => self.uid,
|
427
|
+
:sut => self.sut
|
428
|
+
}
|
429
|
+
)
|
430
|
+
)
|
431
|
+
|
363
432
|
|
364
433
|
end
|
365
434
|
|