testability-driver 1.3.1 → 1.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/start_app_perf +6 -6
- data/lib/tdriver-devtools/behaviour/xml/rdoc_behaviour_xml_generator.rb +4 -4
- data/lib/tdriver-devtools/doc/xslt/template.xsl +103 -21
- data/lib/tdriver/base/behaviour/behaviours/object_behaviour_description.rb +1 -1
- data/lib/tdriver/base/command_data/loader.rb +6 -2
- data/lib/tdriver/base/loader.rb +21 -14
- data/lib/tdriver/base/state_object.rb +1 -1
- data/lib/tdriver/base/sut/controller.rb +8 -2
- data/lib/tdriver/base/sut/generic/behaviours/sut.rb +103 -46
- data/lib/tdriver/base/sut/generic/behaviours/switchbox_behaviour.rb +2 -2
- data/lib/tdriver/base/sut/generic/behaviours/verification.rb +1 -1
- data/lib/tdriver/base/sut/generic/commands/application.rb +18 -278
- data/lib/tdriver/base/sut/generic/commands/key_sequence.rb +1 -1
- data/lib/tdriver/base/sut/sut.rb +1 -1
- data/lib/tdriver/base/test_object/abstract.rb +1 -1
- data/lib/tdriver/base/test_object/adapter.rb +4 -1
- data/lib/tdriver/base/test_object/behaviours/syncronization.rb +3 -3
- data/lib/tdriver/base/test_object/behaviours/test_object.rb +61 -24
- data/lib/tdriver/base/test_object/cache.rb +6 -4
- data/lib/tdriver/base/test_object/factory.rb +4 -2
- data/lib/tdriver/base/test_object/loader.rb +23 -14
- data/lib/tdriver/base/test_object/xml/abstraction.rb +63 -0
- data/lib/tdriver/base/test_object/xml/adapter.rb +4 -1
- data/lib/tdriver/report/report_test_run.rb +1 -1
- data/lib/tdriver/report/report_writer.rb +4 -3
- data/lib/tdriver/util/common/boolean.rb +10 -13
- data/lib/tdriver/util/common/environment.rb +8 -7
- data/lib/tdriver/util/common/hash.rb +5 -5
- data/lib/tdriver/util/common/numeric.rb +5 -5
- data/lib/tdriver/util/common/object.rb +3 -3
- data/lib/tdriver/util/common/retryable.rb +65 -2
- data/lib/tdriver/util/common/string.rb +4 -4
- data/lib/tdriver/util/database/access.rb +9 -11
- data/lib/tdriver/util/fixture/service.rb +54 -0
- data/lib/tdriver/util/localisation/localisation.rb +3 -2
- data/lib/tdriver/util/logger/logger.rb +55 -41
- data/lib/tdriver/util/parameter/parameter.rb +38 -7
- data/lib/tdriver/util/xml/abstraction.rb +8 -8
- data/lib/tdriver/util/xml/builder.rb +1 -1
- data/lib/tdriver/util/xml/xml.rb +11 -11
- data/lib/tdriver/verify/verify.rb +33 -36
- data/lib/tdriver/version.rb +1 -1
- data/xml/defaults/sut_generic.xml +1 -29
- data/xml/templates/generic.xml +28 -0
- metadata +48 -17
@@ -102,7 +102,7 @@ module MobyBehaviour
|
|
102
102
|
=end
|
103
103
|
|
104
104
|
# == description
|
105
|
-
# Return all test object attributes
|
105
|
+
# Return all test object attributes. Please see [link="#GenericTestObject:[]"][][/link] method for alternative approach.
|
106
106
|
# == returns
|
107
107
|
# Hash
|
108
108
|
# description: Test object attributes
|
@@ -160,12 +160,12 @@ module MobyBehaviour
|
|
160
160
|
end
|
161
161
|
|
162
162
|
# == description
|
163
|
-
# Function returns a attribute of test object
|
163
|
+
# Function returns a attribute of test object. Please see [link="#GenericTestObject:[]"][][/link] method for alternative approach.
|
164
164
|
#
|
165
165
|
# == arguments
|
166
166
|
# name
|
167
167
|
# String
|
168
|
-
# description: String
|
168
|
+
# description: String defining the name of the attribute to get
|
169
169
|
# example: "name"
|
170
170
|
#
|
171
171
|
# == returns
|
@@ -198,6 +198,41 @@ module MobyBehaviour
|
|
198
198
|
|
199
199
|
end
|
200
200
|
|
201
|
+
# == description
|
202
|
+
# Wrapper method to returns one or all test object attributes. This method calls [link="#GenericTestObject:attribute"]attribute[/link] or [link="#GenericTestObject:attributes"]attributes[/link] depending on the given argument.
|
203
|
+
#
|
204
|
+
# == arguments
|
205
|
+
# name
|
206
|
+
# String
|
207
|
+
# description: Attribute name
|
208
|
+
# example: "attribute_name"
|
209
|
+
# NilClass
|
210
|
+
# description: Return all attributes
|
211
|
+
# example: nil
|
212
|
+
#
|
213
|
+
# == returns
|
214
|
+
# String
|
215
|
+
# description: Value of the attribute
|
216
|
+
# example: "value"
|
217
|
+
#
|
218
|
+
# Hash
|
219
|
+
# description: Hash of all attributes
|
220
|
+
# example: {:x=>"0", :y=>"0"}
|
221
|
+
#
|
222
|
+
def []( name = nil )
|
223
|
+
|
224
|
+
if name.nil?
|
225
|
+
|
226
|
+
attributes
|
227
|
+
|
228
|
+
else
|
229
|
+
|
230
|
+
attribute( name )
|
231
|
+
|
232
|
+
end
|
233
|
+
|
234
|
+
end
|
235
|
+
|
201
236
|
# == description
|
202
237
|
# Returns the parent test object for the current object in question, according to the UI object hierarchy. For getting the test object that was actually used
|
203
238
|
# as the parent when the test object instance was created, see [link="#GenericTestObject:parent"]parent[/link] method.
|
@@ -221,7 +256,7 @@ module MobyBehaviour
|
|
221
256
|
# retrieve parent element attributes
|
222
257
|
parent_attributes = @test_object_adapter.test_object_element_attributes( parent_element )
|
223
258
|
|
224
|
-
if
|
259
|
+
if get_application_id && parent_attributes[ 'type' ] != 'application'
|
225
260
|
|
226
261
|
parent = @sut.child(
|
227
262
|
|
@@ -288,7 +323,7 @@ module MobyBehaviour
|
|
288
323
|
)
|
289
324
|
|
290
325
|
# update childs if required, returns true or false
|
291
|
-
update( xml_data )
|
326
|
+
update( xml_data ) unless @sut.use_find_objects
|
292
327
|
|
293
328
|
nil
|
294
329
|
|
@@ -586,7 +621,7 @@ module MobyBehaviour
|
|
586
621
|
#test_object.update( _xml_data )
|
587
622
|
test_object.send( :update, _xml_data )
|
588
623
|
|
589
|
-
}
|
624
|
+
} unless @sut.use_find_objects
|
590
625
|
|
591
626
|
#end
|
592
627
|
|
@@ -605,9 +640,9 @@ module MobyBehaviour
|
|
605
640
|
# disable optimizer for this call since it will not work
|
606
641
|
@_enable_optimizer = false
|
607
642
|
|
608
|
-
if
|
643
|
+
if @sut.use_find_objects == true
|
609
644
|
|
610
|
-
|
645
|
+
@sut.use_find_objects = false
|
611
646
|
|
612
647
|
@_enable_optimizer = true
|
613
648
|
|
@@ -620,7 +655,7 @@ module MobyBehaviour
|
|
620
655
|
# TODO: document me
|
621
656
|
def enable_optimizer
|
622
657
|
|
623
|
-
|
658
|
+
@sut.use_find_objects = true if @_enable_optimizer
|
624
659
|
|
625
660
|
@_enable_optimizer = false
|
626
661
|
|
@@ -804,25 +839,27 @@ module MobyBehaviour
|
|
804
839
|
# ?
|
805
840
|
def deactivate
|
806
841
|
|
807
|
-
|
842
|
+
if @_active
|
808
843
|
|
809
|
-
|
844
|
+
@_active = false
|
810
845
|
|
811
|
-
|
812
|
-
|
813
|
-
|
814
|
-
|
815
|
-
|
816
|
-
|
817
|
-
|
818
|
-
|
819
|
-
|
846
|
+
# iterate through all test objects child test objects
|
847
|
+
@child_object_cache.each_object{ | test_object |
|
848
|
+
|
849
|
+
# deactivate test object
|
850
|
+
test_object.__send__( :deactivate )
|
851
|
+
|
852
|
+
}
|
853
|
+
|
854
|
+
# remove test objects from cache
|
855
|
+
@child_object_cache.remove_objects
|
856
|
+
|
857
|
+
# remove from parent objects children objects cache
|
858
|
+
@parent.instance_variable_get( :@child_object_cache ).remove_object( self )
|
820
859
|
|
821
|
-
|
822
|
-
@child_object_cache.remove_objects
|
860
|
+
nil
|
823
861
|
|
824
|
-
|
825
|
-
@parent.instance_variable_get( :@child_object_cache ).remove_object( self )
|
862
|
+
end
|
826
863
|
|
827
864
|
end
|
828
865
|
|
@@ -95,7 +95,9 @@ module TDriver
|
|
95
95
|
test_object_hash = test_object.hash
|
96
96
|
|
97
97
|
if @objects.has_key?( test_object_hash )
|
98
|
+
|
98
99
|
warn( "warning: Test object (#{ test_object_hash }) already exists in cache" )
|
100
|
+
|
99
101
|
end
|
100
102
|
|
101
103
|
@objects[ test_object_hash ] = test_object
|
@@ -106,13 +108,13 @@ module TDriver
|
|
106
108
|
|
107
109
|
# TODO: document me
|
108
110
|
def remove_object( test_object )
|
109
|
-
|
111
|
+
|
110
112
|
test_object_hash = test_object.hash
|
111
113
|
|
112
|
-
raise ArgumentError, "Test object (#{ value.hash }) not found from cache" unless @objects.has_key?( test_object_hash )
|
113
|
-
|
114
114
|
@objects.delete( test_object_hash )
|
115
|
-
|
115
|
+
|
116
|
+
#raise ArgumentError, "Test object (#{ test_object_hash }) not found from cache" unless @objects.has_key?( test_object_hash )
|
117
|
+
|
116
118
|
self
|
117
119
|
|
118
120
|
end
|
@@ -633,11 +633,13 @@ module TDriver
|
|
633
633
|
|
634
634
|
end
|
635
635
|
|
636
|
-
def self.set_timeout(
|
636
|
+
def self.set_timeout( value )
|
637
637
|
|
638
638
|
warn "warning: deprecated method TDriver::TestObjectFactory#set_timeout( value ); please use TDriver::TestObjectFactory#timeout=( value ) instead"
|
639
639
|
|
640
|
-
|
640
|
+
value.check_type( Numeric, "Wrong argument type $1 for timeout value (expected $2)" )
|
641
|
+
|
642
|
+
@timeout = value
|
641
643
|
|
642
644
|
end
|
643
645
|
|
@@ -17,26 +17,35 @@
|
|
17
17
|
##
|
18
18
|
############################################################################
|
19
19
|
|
20
|
-
|
21
|
-
require File.expand_path( File.join( File.dirname( __FILE__ ), 'abstract' ) )
|
20
|
+
[
|
22
21
|
|
23
|
-
# load test object
|
24
|
-
|
22
|
+
# load test object abstract class
|
23
|
+
'abstract',
|
25
24
|
|
26
|
-
# load test object factory
|
27
|
-
|
25
|
+
# load test object factory
|
26
|
+
'factory',
|
28
27
|
|
29
|
-
# load test object cache
|
30
|
-
|
28
|
+
# load test object cache
|
29
|
+
'cache',
|
31
30
|
|
32
|
-
# load test object adapter
|
33
|
-
|
31
|
+
# load test object adapter abstraction
|
32
|
+
'xml/abstraction',
|
34
33
|
|
35
|
-
# load test object adapter
|
36
|
-
|
34
|
+
# load test object adapter
|
35
|
+
'xml/adapter',
|
37
36
|
|
38
|
-
# load
|
39
|
-
|
37
|
+
# load test object adapter
|
38
|
+
'adapter',
|
39
|
+
|
40
|
+
# load verify ui module
|
41
|
+
'verification'
|
42
|
+
|
43
|
+
].each{ | filename |
|
44
|
+
|
45
|
+
require File.expand_path( File.join( File.dirname( __FILE__ ), filename ) )
|
46
|
+
|
47
|
+
}
|
40
48
|
|
41
49
|
# load test object behaviours
|
42
50
|
MobyUtil::FileHelper.load_modules( File.expand_path( File.join( File.dirname( __FILE__ ), 'behaviours' ) ) )
|
51
|
+
|
@@ -0,0 +1,63 @@
|
|
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 TDriver
|
21
|
+
|
22
|
+
module Abstraction
|
23
|
+
|
24
|
+
module TestObjectAdapter
|
25
|
+
|
26
|
+
# TODO: document me
|
27
|
+
def identify_test_object_adapter_from_data( source )
|
28
|
+
|
29
|
+
# verify check that source data is given in correct format
|
30
|
+
source.check_type [ String, MobyUtil::XML::Element ], 'wrong argument type $1 for XML data source (expected $2)'
|
31
|
+
|
32
|
+
# parse if given source is type of string
|
33
|
+
source = MobyUtil::XML.parse_string( source ).root if source.kind_of?( String )
|
34
|
+
|
35
|
+
# determine xml format
|
36
|
+
if source.kind_of?( MobyUtil::XML::Element )
|
37
|
+
|
38
|
+
# detect optimized xml format
|
39
|
+
if source.xpath('.//obj[1]').count > 0
|
40
|
+
|
41
|
+
TDriver::OptimizedXML::TestObjectAdapter
|
42
|
+
|
43
|
+
# or deprecated xml format
|
44
|
+
elsif source.xpath('.//object[1]').count > 0
|
45
|
+
|
46
|
+
TDriver::TestObjectAdapter
|
47
|
+
|
48
|
+
# or raise exception if format was not detected
|
49
|
+
else
|
50
|
+
|
51
|
+
raise RuntimeError, 'Unsupported XML data format'
|
52
|
+
|
53
|
+
end
|
54
|
+
|
55
|
+
end # if
|
56
|
+
|
57
|
+
end # identify_test_object_adapter
|
58
|
+
|
59
|
+
end # TestObjectAdapter
|
60
|
+
|
61
|
+
end # Abstraction
|
62
|
+
|
63
|
+
end # TDriver
|
@@ -507,10 +507,10 @@ display: block;
|
|
507
507
|
|
508
508
|
def reporter_link_to_code(log_line,folder=nil)
|
509
509
|
begin
|
510
|
-
|
511
|
-
time_stamp=t.strftime( "%Y%m%d%H%M%S" )
|
512
|
-
|
510
|
+
stackno=0
|
513
511
|
log_line.gsub(/([\w \*\/\w\/\.-]+)\:(\d+)/) do |match|
|
512
|
+
t = Time.now
|
513
|
+
time_stamp="#{t.strftime( "%Y%m%d%H%M%S" )}#{stackno}"
|
514
514
|
line=match[/\:(\d+)/]
|
515
515
|
f=match[/([\w \*\/\w\/\.-]+)/]
|
516
516
|
file="#{File.dirname(f.strip)}/#{File.basename(f.strip)}"
|
@@ -523,6 +523,7 @@ display: block;
|
|
523
523
|
'">'+match+'</a>'
|
524
524
|
log_line=log_line.gsub(match,link_to_stack)
|
525
525
|
end
|
526
|
+
stackno+=1
|
526
527
|
end
|
527
528
|
rescue Exception => e
|
528
529
|
puts e.message
|
@@ -17,35 +17,32 @@
|
|
17
17
|
##
|
18
18
|
############################################################################
|
19
19
|
|
20
|
-
# extend Ruby TrueClass
|
20
|
+
# extend Ruby TrueClass class functionality
|
21
21
|
class TrueClass
|
22
22
|
|
23
|
+
# TODO: document me
|
23
24
|
def true?
|
24
|
-
|
25
|
-
/^true$/i.match( self.to_s ) != nil
|
26
|
-
|
25
|
+
true
|
27
26
|
end
|
28
|
-
|
27
|
+
|
28
|
+
# TODO: document me
|
29
29
|
def false?
|
30
|
-
|
31
30
|
false
|
32
|
-
|
33
31
|
end
|
34
32
|
|
35
33
|
end
|
36
34
|
|
35
|
+
# extend Ruby FalseClass class functionality
|
37
36
|
class FalseClass
|
38
37
|
|
39
|
-
|
40
|
-
|
38
|
+
# TODO: document me
|
39
|
+
def true?
|
41
40
|
false
|
42
|
-
|
43
41
|
end
|
44
42
|
|
43
|
+
# TODO: document me
|
45
44
|
def false?
|
46
|
-
|
47
|
-
/^false$/i.match( self.to_s ) != nil
|
48
|
-
|
45
|
+
true
|
49
46
|
end
|
50
47
|
|
51
48
|
end
|
@@ -21,13 +21,14 @@ module MobyUtil
|
|
21
21
|
|
22
22
|
class EnvironmentHelper
|
23
23
|
|
24
|
-
UNKNOWN
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
24
|
+
unless defined?( UNKNOWN )
|
25
|
+
LINUX = :linux
|
26
|
+
SOLARIS = :solaris
|
27
|
+
WINDOWS = :windows
|
28
|
+
OSX = :osx
|
29
|
+
CYGWIN = :cygwin
|
30
|
+
UNKNOWN = :unknown # keep this as last constant
|
31
|
+
end
|
31
32
|
|
32
33
|
def self.java?
|
33
34
|
|
@@ -63,7 +63,7 @@ class Hash
|
|
63
63
|
|
64
64
|
end
|
65
65
|
|
66
|
-
# verify that receiver object contains
|
66
|
+
# verify that receiver object contains given key. Raises exception is key not found.
|
67
67
|
def require_key( key, message = 'required key $1 not found from hash' )
|
68
68
|
|
69
69
|
# store caller backtrace before calling fetch
|
@@ -149,7 +149,7 @@ class Hash
|
|
149
149
|
|
150
150
|
end
|
151
151
|
|
152
|
-
# store key and
|
152
|
+
# store key and value to hash if not already defined
|
153
153
|
def default_value( key, value )
|
154
154
|
|
155
155
|
self[ key ] = value unless has_key?( key )
|
@@ -204,7 +204,7 @@ class Hash
|
|
204
204
|
# TODO: document me
|
205
205
|
def to_attributes
|
206
206
|
|
207
|
-
|
207
|
+
collect{ | key, value |
|
208
208
|
|
209
209
|
"#{ key.to_s }=\"#{ value.to_s.encode_to_xml }\""
|
210
210
|
|
@@ -215,7 +215,7 @@ class Hash
|
|
215
215
|
# TODO: document me
|
216
216
|
def recursive_merge( other )
|
217
217
|
|
218
|
-
|
218
|
+
merge( other ){ | key, old_value, new_value |
|
219
219
|
|
220
220
|
new_value
|
221
221
|
|
@@ -243,7 +243,7 @@ class Hash
|
|
243
243
|
# TODO: document me
|
244
244
|
def recursive_merge!( other )
|
245
245
|
|
246
|
-
|
246
|
+
replace(
|
247
247
|
|
248
248
|
recursive_merge( other )
|
249
249
|
|