testability-driver 0.9.2 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (108) hide show
  1. data/lib/tdriver/base/behaviour/behaviours/object_behaviour_composition.rb +1 -1
  2. data/lib/tdriver/base/behaviour/behaviours/object_behaviour_description.rb +11 -7
  3. data/lib/tdriver/base/behaviour/behaviours/object_composition.rb +8 -0
  4. data/lib/tdriver/base/behaviour/factory.rb +229 -209
  5. data/lib/tdriver/base/errors.rb +3 -0
  6. data/lib/tdriver/base/state_object.rb +11 -20
  7. data/lib/tdriver/base/sut/controller.rb +4 -4
  8. data/lib/tdriver/base/sut/factory.rb +205 -170
  9. data/lib/tdriver/base/sut/generic/behaviours/application.rb +256 -174
  10. data/lib/tdriver/base/sut/generic/behaviours/find.rb +17 -11
  11. data/lib/tdriver/base/sut/generic/behaviours/flash_behaviour.rb +57 -66
  12. data/lib/tdriver/base/sut/generic/behaviours/sut.rb +578 -497
  13. data/lib/tdriver/base/sut/generic/behaviours/switchbox_behaviour.rb +41 -15
  14. data/lib/tdriver/base/sut/generic/behaviours/verification.rb +48 -19
  15. data/lib/tdriver/base/sut/generic/commands/fixture.rb +47 -0
  16. data/lib/tdriver/base/sut/generic/commands/key_sequence.rb +25 -13
  17. data/lib/tdriver/base/sut/generic/commands/screen_capture.rb +16 -10
  18. data/lib/tdriver/base/sut/generic/plugin.rb +9 -3
  19. data/lib/tdriver/base/sut/sut.rb +41 -33
  20. data/lib/tdriver/base/test_object/abstract.rb +26 -3
  21. data/lib/tdriver/base/test_object/adapter.rb +399 -0
  22. data/lib/tdriver/base/test_object/behaviours/syncronization.rb +56 -14
  23. data/lib/tdriver/base/test_object/behaviours/test_object.rb +663 -197
  24. data/lib/tdriver/base/test_object/cache.rb +132 -0
  25. data/lib/tdriver/base/test_object/factory.rb +677 -426
  26. data/lib/tdriver/base/test_object/factory_new.rb +202 -0
  27. data/lib/tdriver/base/test_object/identificator.rb +24 -17
  28. data/lib/tdriver/base/test_object/loader.rb +9 -3
  29. data/lib/tdriver/base/test_object/verification.rb +181 -0
  30. data/lib/tdriver/loader.rb +1 -1
  31. data/lib/tdriver/report/report.rb +2 -0
  32. data/lib/tdriver/report/report_api.rb +4 -4
  33. data/lib/tdriver/report/report_creator.rb +29 -3
  34. data/lib/tdriver/report/report_data_presentation.rb +7 -3
  35. data/lib/tdriver/report/report_execution_statistics.rb +80 -21
  36. data/lib/tdriver/report/report_javascript.rb +192 -0
  37. data/lib/tdriver/report/report_test_case_run.rb +22 -0
  38. data/lib/tdriver/report/report_test_run.rb +62 -55
  39. data/lib/tdriver/report/report_writer.rb +57 -56
  40. data/lib/tdriver/tdriver.rb +14 -41
  41. data/lib/tdriver/util/common/error.rb +1 -0
  42. data/lib/tdriver/util/common/exceptions.rb +12 -0
  43. data/lib/tdriver/util/common/file.rb +12 -6
  44. data/lib/tdriver/util/common/gem.rb +2 -1
  45. data/lib/tdriver/util/common/hash.rb +152 -0
  46. data/lib/tdriver/util/common/kernel.rb +49 -34
  47. data/lib/tdriver/util/common/loader.rb +21 -17
  48. data/lib/tdriver/util/common/numeric.rb +39 -0
  49. data/lib/tdriver/util/common/object.rb +115 -0
  50. data/lib/tdriver/util/common/string.rb +55 -2
  51. data/lib/tdriver/util/dbaccess/dbaccess.rb +194 -161
  52. data/lib/tdriver/util/dynamic_attribute_filter.rb +6 -0
  53. data/lib/tdriver/util/hooking.rb +2 -2
  54. data/lib/tdriver/util/loader.rb +2 -2
  55. data/lib/tdriver/util/localisation/localisation.rb +277 -18
  56. data/lib/tdriver/util/logger.rb +142 -13
  57. data/lib/tdriver/util/parameter/parameter_hash.rb +8 -5
  58. data/lib/tdriver/util/parameter/parameter_xml.rb +18 -2
  59. data/lib/tdriver/util/recorder.rb +17 -12
  60. data/lib/tdriver/util/user_data/user_data.rb +3 -2
  61. data/lib/tdriver/util/{video_rec.rb → video_utils.rb} +136 -16
  62. data/lib/tdriver/util/xml/abstraction.rb +7 -0
  63. data/lib/tdriver/util/xml/attribute.rb +32 -0
  64. data/lib/tdriver/util/xml/loader.rb +8 -2
  65. data/lib/tdriver/util/xml/nil_node.rb +95 -0
  66. data/lib/tdriver/util/xml/parsers/nokogiri/abstraction.rb +46 -7
  67. data/lib/tdriver/util/xml/parsers/nokogiri/attribute.rb +19 -9
  68. data/lib/tdriver/util/xml/parsers/nokogiri/document.rb +1 -1
  69. data/lib/tdriver/util/xml/parsers/nokogiri/element.rb +13 -1
  70. data/lib/tdriver/util/xml/parsers/nokogiri/loader.rb +6 -0
  71. data/lib/tdriver/util/xml/parsers/nokogiri/nodeset.rb +27 -15
  72. data/lib/tdriver/util/xml/parsers/nokogiri/text.rb +57 -0
  73. data/lib/tdriver/util/xml/text.rb +32 -0
  74. data/lib/tdriver/util/xml/xml.rb +35 -22
  75. data/lib/tdriver/version.rb +1 -1
  76. data/lib/tdriver-devtools/behaviour/xml/rdoc_behaviour_xml_generator.rb +41 -34
  77. data/lib/tdriver-devtools/doc/generate.rb +31 -6
  78. data/lib/tdriver-devtools/doc/xslt/template.xsl +46 -25
  79. data/lib/tdriver-devtools/tests/feature_tests/example/behaviour_example.rb +100 -0
  80. data/lib/tdriver-devtools/tests/feature_tests/update +1 -1
  81. data/lib/tdriver.rb +0 -3
  82. data/xml/behaviours/generic.xml +1 -1
  83. data/xml/defaults/generic.xml +4 -90
  84. data/xml/templates/generic.xml +33 -25
  85. metadata +21 -29
  86. data/lib/tdriver-devtools/behaviour/xml_generator/example/flick-example.rb +0 -245
  87. data/lib/tdriver-devtools/behaviour/xml_generator/example/sut.rb +0 -964
  88. data/lib/tdriver-devtools/behaviour/xml_generator/generate.rb +0 -68
  89. data/lib/tdriver-devtools/behaviour/xml_generator/lib/custom_rdoc_generator.rb +0 -1865
  90. data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.argument.default.template +0 -1
  91. data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.argument.template +0 -3
  92. data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.argument_type.template +0 -4
  93. data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.exception.template +0 -4
  94. data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.method.arguments.template +0 -4
  95. data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.method.deprecated.template +0 -3
  96. data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.method.exceptions.template +0 -3
  97. data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.method.info.template +0 -1
  98. data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.method.returns.template +0 -3
  99. data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.method.tables.template +0 -3
  100. data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.method.template +0 -12
  101. data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.returns.template +0 -5
  102. data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.table.item.template +0 -1
  103. data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.table.row.template +0 -2
  104. data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.table.template +0 -7
  105. data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.template +0 -14
  106. data/lib/tdriver-devtools/behaviour/xml_generator/update +0 -3
  107. data/lib/tdriver-devtools/tests/feature_tests/example/flick-example.rb +0 -233
  108. data/lib/tdriver-devtools/tests/feature_tests/example/impl.rb +0 -194
@@ -40,204 +40,286 @@ module MobyBehaviour
40
40
  # == objects
41
41
  # application
42
42
  #
43
- module Application
44
-
45
- include MobyBehaviour::Behaviour
46
-
47
- # == description
48
- # Closes the application whether or not it is on foreground. Note: this will currently always try to close applications, also
49
- # privilegied applications
50
- #
51
- # == params
52
- #options_hash:: Hash, possible keys :force_kill (default nil) and :check_proces (default true).
53
- #For backwards compatibility: instead of a Hash, the value can also be true, false or nil, in which case it is taken as the value of :force_kill
54
- #:force_kill:: If key is set to true, the application process is killed if close fails. If set to nil, value of key will be taken as defined
55
- #by 'application_close_kill' parameter in the TDriver parameter file.
56
- #:check_process:: If key is set to true, success of the close method is verified by checking if the process is still active. If set to false,
57
- #TDriver will only check that the application is no longer in the foreground.
58
- #
59
- # === raises
60
- # TestObjectNotFoundError:: If this application is not the foreground application on the device under test.
61
- # VerificationError:: If no application test object is found after close or if this application is still in the foreground after the close.
62
- # ArgumentError:: Options_hash was not a Hash or one of the keys had an invalid type.
63
- # === example
64
- # @sut.application.close #closes anonymous foreground application
65
- #
66
- # @mce_app = @sut.run(:name => 'Mce.exe') # launches mce app
67
- # @mce_app.close # closes above launched mce-application and verifies that correct application was closed
68
- def close( options_hash = {} )
69
-
70
- begin
71
-
72
- # check if closable
73
- Kernel::raise RuntimeError( "The application is of a type that cannot be closed." ) unless self.closable?
74
-
75
- default_options = { :force_kill => nil, :check_process => true }
76
-
77
- if options_hash.kind_of? Hash
78
- close_options = default_options.merge options_hash
79
- else
80
- # support legacy option of defining only force_kill
81
- close_options = default_options
82
- if options_hash!=nil
83
- #check that old force_kill_close argument is equal to true or false
84
- Kernel::raise ArgumentError.new( "Incorrect value for argument options_hash, expected a Hash or a bool 'true' or 'false'" ) unless options_hash==true or options_hash==false
85
- close_options[ :force_kill ] = options_hash
86
- end
87
- end
88
-
89
- raise ArgumentError.new "The options_hash :force_kill key must be true or false if it is defined, the used value was \"#{close_options[ :force_kill ]}\"." unless [nil, true, false].include? close_options[ :force_kill ]
90
- raise ArgumentError.new "The options_hash :check_process key must be true or false if it is defined, the used value was \"#{close_options[ :check_process ]}\"." unless [true, false].include? close_options[ :check_process ]
91
-
92
- if close_options[ :force_kill ] != nil
93
- flags_hash = { }
94
- flags_hash[ :force_kill ] = close_options[ :force_kill ]
95
- #execute_command( command_type = nil, app_name = nil, app_uid = nil, sut = nil, arguments = nil, environment = nil, events_to_listen = nil, signals_to_listen = nil, flags = nil)
96
- @sut.execute_command( MobyCommand::Application.new( :Close, self.name, self.uid, self.sut, nil, nil, nil, nil, flags_hash) )
97
- else
98
- @sut.execute_command( MobyCommand::Application.new( :Close, self.name, self.uid, self.sut, nil ) )
99
- end
100
-
101
- # Disable logging
102
- MobyUtil::Logger.instance.enabled = false if ( original_logger_state = MobyUtil::Logger.instance.enabled )
103
-
104
- # verify close results
105
- begin
106
-
107
- MobyUtil::Retryable.until(
108
- :timeout => MobyUtil::Parameter[ self.sut.id ][ :application_synchronization_timeout, '60' ].to_f,
109
- :interval => MobyUtil::Parameter[ self.sut.id ][ :application_synchronization_retry_interval, '0.25' ].to_f,
110
- :exception => MobyBase::VerificationError,
111
- :unless => MobyBase::TestObjectNotFoundError ) {
112
-
113
- # check if the application is still found or not
114
- if ( close_options[ :check_process ] == true and @sut.application( :id => self.uid, :__timeout => 0 ) )
115
-
116
- # the application did not close
117
- raise MobyBase::VerificationError.new("Verification of close failed. The application that was to be closed is still running.")
118
-
119
- elsif ( close_options[ :check_process ] == false )
120
-
121
- if @sut.application( :__timeout => 0 ).uid == self.uid
122
- # the application was still in the foreground
123
- raise MobyBase::VerificationError.new("Verification of close failed. The application that was to be closed was still in the foreground.")
124
- else
125
- # The foreground application was not the one being closed.
126
- raise MobyBase::TestObjectNotFoundError.new( "The foreground application was not the one being closed (id: #{self.uid})." )
127
- end
128
-
129
- else
130
-
131
- # The application could not be found, break
132
- break;
133
-
134
- end
135
-
136
- }
137
-
138
- rescue MobyBase::TestObjectNotFoundError
139
-
140
- #puts "app.close: sut.application --> test object not found error --> ok --> exit"
141
- # everything ok: application not running anymore
142
-
143
- rescue RuntimeError => e
144
-
145
-
146
- if (e.message =~ /The application with Id \d+ is no longer available/)
147
- # everything ok: application not running anymore
148
- else
149
- # something unexpected happened during the close, let exception through
150
- raise e
151
- end
152
-
153
-
154
-
155
- ensure
156
-
157
- # restore original state
158
- MobyUtil::Logger.instance.enabled = original_logger_state
159
- end
160
-
161
- rescue Exception => exception
162
-
163
- #puts "app.close: close app failed --> exit "
43
+ module Application
44
+
45
+ include MobyBehaviour::Behaviour
46
+
47
+ # == description
48
+ # Closes application and optionally verifies that it is closed. A Hash argument can be used to set any of the optional parameters. Keys not set in the hash will use default values. Close can be set to force kill the application process if close fails. It can also be set to not check if the application process is terminated, in which case close is considered to be successful if the application is no longer in the foreground.\n
49
+ # \n
50
+ # [b]NOTE:[/b] this will currently always try to close applications, also privilegied applications. \n
51
+ # \n
52
+ # [b]For backwards compatibility:[/b] Instead of using a Hash as argument, the value can also be true, false or nil which will be taken as the value of :force_kill
53
+ #
54
+ # == arguments
55
+ # options_hash
56
+ # Hash
57
+ # description: See supported hash keys from [link="#close_hash_keys"]close application options hash keys table[/link]
58
+ # example: {:force_kill => true, :check_process => false}
59
+ # TrueClass
60
+ # description: For backwards compatibility: same as :force_kill => true
61
+ # example: true
62
+ # FalseClass
63
+ # description: For backwards compatibility: same as :force_kill => false
64
+ # example: false
65
+ # NilClass
66
+ # description: For backwards compatibility: same as :force_kill => nil (uses 'application_close_kill' from TDriver parameters file)
67
+ # example: nil
68
+ #
69
+ # == tables
70
+ # close_hash_keys
71
+ # title: Close application options hash keys
72
+ # |Key|Type|Description|Default|Required|
73
+ # |:force_kill|TrueClass, FalseClass|If this options is set to true, the application process is killed if close fails. Setting this option to nil (default value), will cause close to use the value defined in the 'application_close_kill' parameter as defined in the TDriver parameter file.|nil|No|
74
+ # |:check_process|TrueClass, FalseClass|If this options is set to true, success of the close method is verified by checking if the process is still active. If it is set to false, TDriver will only check that the application is no longer in the foreground.|true|No|
75
+ #
76
+ # == returns
77
+ # NilClass
78
+ # description: -
79
+ # example: -
80
+ #
81
+ # == exceptions
82
+ # TestObjectNotFoundError
83
+ # description: If this application is not the foreground application on the device under test.
84
+ #
85
+ # VerificationError
86
+ # description: If no application test object is found after close or if this application is still in the foreground after the close.
87
+ #
88
+ # TypeError
89
+ # description: Wrong argument type %s for options_hash (expected a Hash, TrueClass or FalseClass)
90
+ #
91
+ # TypeError
92
+ # description: Wrong argument type %s for :force_kill (expected NilClass, TrueClass or FalseClass)
93
+ #
94
+ # TypeError
95
+ # description: Wrong argument type %s for :check_process (expected TrueClass or FalseClass)
96
+ #
97
+ def close( options_hash = {} )
98
+
99
+ begin
100
+
101
+ # check if closable
102
+ Kernel::raise RuntimeError( "The application is of a type that cannot be closed." ) unless self.closable?
103
+
104
+ default_options = { :force_kill => nil, :check_process => true }
105
+
106
+ if options_hash.kind_of?( Hash )
107
+
108
+ close_options = default_options.merge( options_hash )
109
+
110
+ else
111
+
112
+ # support legacy option of defining only force_kill
113
+ close_options = default_options
114
+
115
+ if options_hash != nil
116
+
117
+ # verify options_hash value
118
+ options_hash.check_type( [ Hash, FalseClass, TrueClass ], "Wrong argument type $1 for options hash (expected $2)" )
119
+
120
+ close_options[ :force_kill ] = options_hash
121
+
122
+ end
123
+
124
+ end
125
+
126
+ # verify :force_kill variable type
127
+ close_options[ :force_kill ].check_type( [ NilClass, TrueClass, FalseClass ], "Wrong argument type $1 for :force_kill (expected $2)" )
128
+
129
+ # verify :check_process variable type
130
+ close_options[ :check_process ].check_type( [ TrueClass, FalseClass ], "Wrong argument type $1 for :check_process (expected $2)" )
131
+
132
+ if close_options[ :force_kill ] != nil
133
+
134
+ @sut.execute_command(
135
+ MobyCommand::Application.new(
136
+ :Close, # command_type
137
+ self.name, # app_name
138
+ self.uid, # app_uid
139
+ self.sut, # sut
140
+ nil, # arguments
141
+ nil, # environment
142
+ nil, # events_to_listen
143
+ nil, # signals_to_listen
144
+ { # flags
145
+ :force_kill => close_options[ :force_kill ]
146
+ }
147
+ )
148
+ )
149
+
150
+ else
151
+
152
+ @sut.execute_command(
153
+ MobyCommand::Application.new(
154
+ :Close,
155
+ self.name,
156
+ self.uid,
157
+ self.sut,
158
+ nil
159
+ )
160
+ )
161
+
162
+ end
163
+
164
+ # Disable logging
165
+ MobyUtil::Logger.instance.enabled = false if ( original_logger_state = MobyUtil::Logger.instance.enabled )
166
+
167
+ # verify close results
168
+ begin
164
169
 
165
- MobyUtil::Logger.instance.log "behaviour", "FAIL;Failed when closing.;#{ identity };close;"
166
- Kernel::raise exception
170
+ MobyUtil::Retryable.until(
171
+ :timeout => MobyUtil::Parameter[ self.sut.id ][ :application_synchronization_timeout, '60' ].to_f,
172
+ :interval => MobyUtil::Parameter[ self.sut.id ][ :application_synchronization_retry_interval, '0.25' ].to_f,
173
+ :exception => MobyBase::VerificationError,
174
+ :unless => [MobyBase::TestObjectNotFoundError, MobyBase::ApplicationNotAvailableError] ) {
167
175
 
168
- end
176
+ # check if the application is still found or not
177
+ if ( close_options[ :check_process ] == true and @sut.application( :id => self.uid, :__timeout => 0 ) )
169
178
 
170
- #puts "app.close: close app passed --> exit "
179
+ # the application did not close
180
+ raise MobyBase::VerificationError.new("Verification of close failed. The application that was to be closed is still running.")
181
+
182
+ elsif ( close_options[ :check_process ] == false )
171
183
 
172
- MobyUtil::Logger.instance.log "behaviour", "PASS;Closed successfully.;#{ identity };close;"
173
- #@sut.refresh
174
- @sut.application
175
- nil
184
+ if @sut.application( :__timeout => 0 ).uid == self.uid
185
+ # the application was still in the foreground
186
+ raise MobyBase::VerificationError.new("Verification of close failed. The application that was to be closed was still in the foreground.")
176
187
 
177
- end
188
+ else
178
189
 
179
- # == description
180
- # Returns executable name (exe) of foreground application
181
- # === returns
182
- # String:: Name(exe) of the application.
183
- # === raises
184
- # RuntimeError:: No executable name has been defined for this application.
185
- # === example
186
- # puts @sut.application.executable_name #prints foreground executable name to console
187
- def executable_name
190
+ # The foreground application was not the one being closed.
191
+ raise MobyBase::TestObjectNotFoundError.new( "The foreground application was not the one being closed (id: #{self.uid})." )
188
192
 
189
- begin
193
+ end
190
194
 
191
- exe_name = self.attribute( 'FullName' ).to_s
195
+ else
196
+
197
+ # The application could not be found, break
198
+ break;
192
199
 
193
- rescue MobyBase::AttributeNotFoundError
200
+ end
194
201
 
195
- begin
202
+ }
196
203
 
197
- exe_name = self.attribute( 'exepath' ).to_s
204
+ rescue MobyBase::TestObjectNotFoundError
198
205
 
199
- rescue MobyBase::AttributeNotFoundError
206
+ # everything ok: application not running anymore
200
207
 
201
- exe_name = ""
208
+ rescue MobyBase::ApplicationNotAvailableError
202
209
 
203
- end
210
+ # everything ok: application not running anymore
204
211
 
205
- end
212
+ rescue RuntimeError => e
213
+
214
+
215
+ unless ( e.message =~ /The application with Id \d+ is no longer available/ )
206
216
 
207
- Kernel::raise RuntimeError.new( "No executable full name has been defined for this application." ) if exe_name.empty?
217
+ # something unexpected happened during the close, let exception through
218
+ raise e
208
219
 
209
- File.basename( exe_name.gsub( /\\/, '/' ) )
220
+ end
210
221
 
211
- end
222
+ ensure
212
223
 
213
- # == description
214
- # Returns uid of foreground application
215
- # === returns
216
- # String:: UID of the application.
217
- # === example
218
- # puts @sut.application.uid #prints foreground executable uid to console
219
- def uid
224
+ # restore original state
225
+ MobyUtil::Logger.instance.enabled = original_logger_state
220
226
 
221
- id
227
+ end
222
228
 
223
- end
224
-
225
- # == description
226
- # Indicates whether this application can be closed with the ApplicationBehaviour::close method. Note: at the moment
227
- # it always returns true!
228
- # === returns
229
- # Boolean:: True if closing is possible with the ApplicationBehaviour::close method
230
- # === example
231
- # puts @sut.application.closable #prints foreground application closable status to console (at the moment always true)
232
- def closable?
229
+ rescue Exception => exception
233
230
 
234
- true
231
+ MobyUtil::Logger.instance.log "behaviour", "FAIL;Failed when closing.;#{ identity };close;"
232
+ Kernel::raise exception
235
233
 
236
- end
234
+ end
237
235
 
238
- # enable hooking for performance measurement & debug logging
239
- MobyUtil::Hooking.instance.hook_methods( self ) if defined?( MobyUtil::Hooking )
236
+ MobyUtil::Logger.instance.log "behaviour", "PASS;Closed successfully.;#{ identity };close;"
240
237
 
241
- end # ApplicationBehaviour
238
+ @sut.application
239
+ nil
240
+
241
+ end
242
+
243
+ # == description
244
+ # Returns executable name (exe) of foreground application
245
+ # == returns
246
+ # String
247
+ # description: Application's executable name
248
+ # example: "calculator"
249
+ # == exceptions
250
+ # RuntimeError
251
+ # description: No executable name has been defined for this application.
252
+ # == example
253
+ # puts @sut.application.executable_name #prints foreground executable name to console
254
+ def executable_name
255
+
256
+ begin
257
+
258
+ exe_name = self.attribute( 'FullName' ).to_s
259
+
260
+ rescue MobyBase::AttributeNotFoundError
261
+
262
+ begin
263
+
264
+ exe_name = self.attribute( 'exepath' ).to_s
265
+
266
+ rescue MobyBase::AttributeNotFoundError
267
+
268
+ exe_name = ""
269
+
270
+ end
271
+
272
+ end
273
+
274
+ Kernel::raise RuntimeError.new( "Application does not have 'FullName' or 'exepath' attribute defined" ) if exe_name.empty?
275
+
276
+ File.basename( exe_name.gsub( /\\/, '/' ) )
277
+
278
+ end
279
+
280
+ # == description
281
+ # Returns uid of foreground application
282
+ # == returns
283
+ # String
284
+ # description: Unique ID of the application.
285
+ # example: "2197"
286
+ # == example
287
+ # puts @sut.application.uid #prints foreground executable uid to console
288
+ def uid
289
+
290
+ id
291
+
292
+ end
293
+
294
+ # == nodoc
295
+ # TODO: document all the possible values and then make public
296
+ def environment
297
+
298
+ @environment
299
+
300
+ end
301
+
302
+ # == nodoc
303
+ # TODO: to be removed?
304
+ # == description
305
+ # Indicates whether this application can be closed with the ApplicationBehaviour::close method. Note: at the moment
306
+ # it always returns true!
307
+ # === returns
308
+ # Boolean:: True if closing is possible with the ApplicationBehaviour::close method
309
+ # === example
310
+ # puts @sut.application.closable #prints foreground application closable status to console (at the moment always true)
311
+ def closable?
312
+
313
+ #file, line = caller.first.split(":")
314
+ #$stderr.puts "%s:%s warning: TestObject#closable? is deprecated" % [ file, line ]
315
+
316
+ true
317
+
318
+ end
319
+
320
+ # enable hooking for performance measurement & debug logging
321
+ MobyUtil::Hooking.instance.hook_methods( self ) if defined?( MobyUtil::Hooking )
322
+
323
+ end # ApplicationBehaviour
242
324
 
243
325
  end # MobyBehaviour