testability-driver 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (116) hide show
  1. data/lib/tdriver-devtools/behaviour/xml/rdoc_behaviour_xml_generator.rb +2 -2
  2. data/lib/tdriver-devtools/tdriver-devtools.rb +1 -1
  3. data/lib/tdriver-devtools/tests/feature_tests/lib/custom_rdoc_generator.rb +3 -3
  4. data/lib/tdriver/base/behaviour/behaviours/object_behaviour_composition.rb +6 -1
  5. data/lib/tdriver/base/behaviour/behaviours/object_behaviour_description.rb +5 -3
  6. data/lib/tdriver/base/behaviour/behaviours/object_composition.rb +1 -1
  7. data/lib/tdriver/base/behaviour/factory.rb +225 -225
  8. data/lib/tdriver/base/errors.rb +1 -1
  9. data/lib/tdriver/base/state_object.rb +227 -179
  10. data/lib/tdriver/base/sut/controller.rb +2 -2
  11. data/lib/tdriver/base/sut/factory.rb +190 -182
  12. data/lib/tdriver/base/sut/generic/behaviours/application.rb +69 -25
  13. data/lib/tdriver/base/sut/generic/behaviours/controller.rb +1 -1
  14. data/lib/tdriver/base/sut/generic/behaviours/find.rb +4 -4
  15. data/lib/tdriver/base/sut/generic/behaviours/flash_behaviour.rb +3 -3
  16. data/lib/tdriver/base/sut/generic/behaviours/sut.rb +350 -165
  17. data/lib/tdriver/base/sut/generic/behaviours/switchbox_behaviour.rb +9 -9
  18. data/lib/tdriver/base/sut/generic/behaviours/verification.rb +191 -103
  19. data/lib/tdriver/base/sut/generic/commands/application.rb +1 -1
  20. data/lib/tdriver/base/sut/generic/commands/key_sequence.rb +1 -1
  21. data/lib/tdriver/base/sut/generic/commands/screen_capture.rb +1 -1
  22. data/lib/tdriver/base/sut/generic/plugin.rb +1 -1
  23. data/lib/tdriver/base/sut/sut.rb +5 -1
  24. data/lib/tdriver/base/test_object/abstract.rb +136 -151
  25. data/lib/tdriver/base/test_object/adapter.rb +293 -82
  26. data/lib/tdriver/base/test_object/behaviours/syncronization.rb +20 -17
  27. data/lib/tdriver/base/test_object/behaviours/test_object.rb +159 -532
  28. data/lib/tdriver/base/test_object/cache.rb +1 -1
  29. data/lib/tdriver/base/test_object/factory.rb +254 -605
  30. data/lib/tdriver/base/test_object/identificator.rb +1 -1
  31. data/lib/tdriver/base/test_object/loader.rb +1 -1
  32. data/lib/tdriver/base/test_object/verification.rb +17 -17
  33. data/lib/tdriver/loader.rb +20 -9
  34. data/lib/tdriver/report/report.rb +5 -0
  35. data/lib/tdriver/report/report_creator.rb +2 -2
  36. data/lib/tdriver/report/report_cucumber_listener.rb +4 -4
  37. data/lib/tdriver/report/report_cucumber_reporter.rb +4 -4
  38. data/lib/tdriver/report/report_execution_statistics.rb +22 -22
  39. data/lib/tdriver/report/report_grouping.rb +2 -2
  40. data/lib/tdriver/report/report_javascript.rb +11 -4
  41. data/lib/tdriver/report/report_test_case_run.rb +2 -2
  42. data/lib/tdriver/report/report_test_run.rb +5 -5
  43. data/lib/tdriver/report/report_test_unit.rb +74 -26
  44. data/lib/tdriver/report/report_writer.rb +70 -13
  45. data/lib/tdriver/tdriver.rb +17 -8
  46. data/lib/tdriver/util/common/array.rb +1 -1
  47. data/lib/tdriver/util/common/crc16.rb +1 -1
  48. data/lib/tdriver/util/common/environment.rb +1 -1
  49. data/lib/tdriver/util/common/file.rb +18 -9
  50. data/lib/tdriver/util/common/gem.rb +1 -1
  51. data/lib/tdriver/util/common/hash.rb +21 -0
  52. data/lib/tdriver/util/common/kernel.rb +1 -1
  53. data/lib/tdriver/util/common/loader.rb +5 -2
  54. data/lib/tdriver/util/common/numeric.rb +54 -3
  55. data/lib/tdriver/util/common/retryable.rb +30 -12
  56. data/lib/tdriver/util/common/stackable.rb +185 -0
  57. data/lib/tdriver/util/common/string.rb +21 -5
  58. data/lib/tdriver/util/{dbaccess/dbaccess.rb → database/access.rb} +4 -1
  59. data/lib/tdriver/util/{dbaccess/dbconnection.rb → database/connection.rb} +3 -0
  60. data/lib/tdriver/util/{dbaccess → database}/error.rb +0 -1
  61. data/lib/tdriver/util/{dbaccess → database}/loader.rb +5 -6
  62. data/lib/tdriver/util/{dynamic_attribute_filter.rb → filters/dynamic_attributes.rb} +1 -1
  63. data/lib/tdriver/util/hooking/hooking.rb +477 -0
  64. data/lib/tdriver/util/loader.rb +35 -29
  65. data/lib/tdriver/util/localisation/error.rb +0 -1
  66. data/lib/tdriver/util/localisation/loader.rb +1 -4
  67. data/lib/tdriver/util/localisation/localisation.rb +30 -27
  68. data/lib/tdriver/util/{common.rb → logger/loader.rb} +2 -4
  69. data/lib/tdriver/util/logger/logger.rb +574 -0
  70. data/lib/tdriver/util/operator_data/loader.rb +4 -3
  71. data/lib/tdriver/util/operator_data/operator_data.rb +5 -5
  72. data/lib/tdriver/util/parameter/parameter.rb +7 -1
  73. data/lib/tdriver/util/parameter/parameter_hash.rb +1 -1
  74. data/lib/tdriver/util/parameter/parameter_template.rb +1 -1
  75. data/lib/tdriver/util/parameter/parameter_user_api.rb +28 -20
  76. data/lib/tdriver/util/parameter/parameter_xml.rb +1 -1
  77. data/lib/tdriver/util/plugin/abstract.rb +1 -1
  78. data/lib/tdriver/util/plugin/service.rb +1 -1
  79. data/lib/tdriver/util/{localisation.rb → recorder/loader.rb} +4 -3
  80. data/lib/tdriver/util/recorder/recorder.rb +66 -0
  81. data/lib/tdriver/util/recorder/scripter.rb +258 -0
  82. data/lib/tdriver/util/{stats.rb → statistics/statistics.rb} +7 -8
  83. data/lib/tdriver/util/user_data/error.rb +0 -1
  84. data/lib/tdriver/util/user_data/loader.rb +1 -2
  85. data/lib/tdriver/util/user_data/user_data.rb +6 -6
  86. data/lib/tdriver/util/video/camera.rb +67 -0
  87. data/lib/tdriver/util/video/camera_linux.rb +139 -0
  88. data/lib/tdriver/util/video/camera_windows.rb +174 -0
  89. data/lib/tdriver/util/video/loader.rb +31 -0
  90. data/lib/tdriver/util/video/video_utils.rb +139 -0
  91. data/lib/tdriver/util/xml/abstraction.rb +56 -5
  92. data/lib/tdriver/util/xml/builder.rb +2 -5
  93. data/lib/tdriver/util/{parameter.rb → xml/comment.rb} +10 -2
  94. data/lib/tdriver/util/xml/loader.rb +32 -22
  95. data/lib/tdriver/util/xml/nil_node.rb +2 -2
  96. data/lib/tdriver/util/xml/parsers/loader.rb +0 -1
  97. data/lib/tdriver/util/xml/parsers/nokogiri/abstraction.rb +18 -44
  98. data/lib/tdriver/util/xml/parsers/nokogiri/attribute.rb +9 -13
  99. data/lib/tdriver/util/xml/parsers/nokogiri/builder.rb +9 -3
  100. data/lib/tdriver/util/xml/parsers/nokogiri/comment.rb +39 -0
  101. data/lib/tdriver/util/xml/parsers/nokogiri/document.rb +6 -11
  102. data/lib/tdriver/util/xml/parsers/nokogiri/element.rb +2 -122
  103. data/lib/tdriver/util/xml/parsers/nokogiri/loader.rb +26 -16
  104. data/lib/tdriver/util/xml/parsers/nokogiri/node.rb +203 -0
  105. data/lib/tdriver/util/xml/parsers/nokogiri/nodeset.rb +1 -2
  106. data/lib/tdriver/util/xml/parsers/nokogiri/text.rb +2 -20
  107. data/lib/tdriver/util/xml/xml.rb +52 -20
  108. data/lib/tdriver/verify/verify.rb +238 -81
  109. data/xml/behaviours/generic.xml +12 -10
  110. metadata +156 -180
  111. data/lib/tdriver/base/test_object/factory_new.rb +0 -202
  112. data/lib/tdriver/util/hooking.rb +0 -434
  113. data/lib/tdriver/util/logger.rb +0 -506
  114. data/lib/tdriver/util/recorder.rb +0 -297
  115. data/lib/tdriver/util/video_utils.rb +0 -384
  116. data/lib/tdriver/util/xml/nil_element.rb +0 -89
@@ -27,32 +27,28 @@ module MobyUtil
27
27
 
28
28
  include Abstraction
29
29
 
30
+ # TODO: document me
30
31
  def value
31
32
 
32
33
  @xml.value
33
34
 
34
35
  end
35
36
 
36
- def content
37
+ # TODO: document me
38
+ def value=( content )
37
39
 
38
- @xml.content
40
+ @xml.value = content
39
41
 
40
42
  end
41
43
 
42
- def name
44
+ # alias for value=
45
+ alias_method :content=, :value=
43
46
 
44
- @xml.name
45
-
46
- end
47
-
48
- def to_s
49
-
50
- @xml.value
51
-
52
- end
47
+ # alias for value
48
+ alias_method :content, :value
53
49
 
54
50
  # enable hooking for performance measurement & debug logging
55
- MobyUtil::Hooking.instance.hook_methods( self ) if defined?( MobyUtil::Hooking )
51
+ TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
56
52
 
57
53
  end
58
54
 
@@ -40,14 +40,20 @@ module MobyUtil
40
40
  # support all Nokogiri::XML::Builder class instance methods
41
41
  def method_missing( method, *args )
42
42
 
43
- Kernel::raise NoMethodError.new( "Method '%s' is not supported by %s" % [ method, self.class ] ) unless @xml.respond_to?( method )
43
+ if @xml.respond_to?( method )
44
44
 
45
- @xml.send( method.to_sym, *args )
45
+ @xml.send( method.to_sym, *args )
46
+
47
+ else
48
+
49
+ raise NoMethodError, "Method #{ method.to_s.inspect } is not supported by #{ self.class }"
50
+
51
+ end
46
52
 
47
53
  end
48
54
 
49
55
  # enable hooking for performance measurement & debug logging
50
- MobyUtil::Hooking.instance.hook_methods( self ) if defined?( MobyUtil::Hooking )
56
+ TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
51
57
 
52
58
  end # Document
53
59
 
@@ -0,0 +1,39 @@
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 MobyUtil
21
+
22
+ module XML
23
+
24
+ module Nokogiri
25
+
26
+ module Comment # behaviour
27
+
28
+ include Node
29
+
30
+ # enable hooking for performance measurement & debug logging
31
+ TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
32
+
33
+ end # Comment
34
+
35
+ end # Nokogiri
36
+
37
+ end # XML
38
+
39
+ end # MobyUtil
@@ -17,7 +17,6 @@
17
17
  ##
18
18
  ############################################################################
19
19
 
20
-
21
20
  module MobyUtil
22
21
 
23
22
  module XML
@@ -26,28 +25,24 @@ module MobyUtil
26
25
 
27
26
  module Document # behaviour
28
27
 
29
- include Abstraction
28
+ include Node
30
29
 
30
+ # TODO: document me
31
31
  def parse( xml_string )
32
32
 
33
- ::Nokogiri::XML.parse( xml_string, nil, 'UTF8', ::Nokogiri::XML::ParseOptions::STRICT )
33
+ ::Nokogiri::XML.parse( xml_string, nil, 'UTF-8', ::Nokogiri::XML::ParseOptions::STRICT )
34
34
 
35
35
  end
36
36
 
37
+ # TODO: document me
37
38
  def root
38
39
 
39
- element_object( @xml.root )
40
-
41
- end
42
-
43
- def xpath( xpath_query, *args, &block )
44
-
45
- nodeset_object( @xml.xpath( xpath_query ), *args, &block )
40
+ node_object( @xml.root )
46
41
 
47
42
  end
48
43
 
49
44
  # enable hooking for performance measurement & debug logging
50
- MobyUtil::Hooking.instance.hook_methods( self ) if defined?( MobyUtil::Hooking )
45
+ TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
51
46
 
52
47
  end # Document
53
48
 
@@ -25,130 +25,10 @@ module MobyUtil
25
25
 
26
26
  module Element # behaviour
27
27
 
28
- include Abstraction
29
-
30
- def <=>( object )
31
-
32
- @xml <=> object.xml
33
-
34
- end
35
-
36
- def []( value )
37
-
38
- @xml.attributes[ value ]
39
-
40
- end
41
-
42
- def attributes
43
-
44
- # return hash of attributes
45
- Hash[ @xml.attributes.collect{ | key, value | [ key, value.to_s ] }]
46
-
47
- end
48
-
49
- def attribute( attr_name )
50
-
51
- unless ( value = @xml.attribute( attr_name ) ).nil?
52
-
53
- value.to_s
54
-
55
- end
56
-
57
- end
58
-
59
-
60
- def children
61
-
62
- nodeset_object( @xml.children )
63
-
64
- end
65
-
66
- def content
67
-
68
- unless @xml.nil?
69
-
70
- @xml.content.to_s
71
-
72
- end
73
-
74
- end
75
-
76
- def each( &block )
77
-
78
- @xml.each{ | element |
79
-
80
- yield( element_object( element ) )
81
-
82
- }
83
-
84
- nil
85
-
86
- end
87
-
88
- def eql?( object )
89
-
90
- @xml.content == object.xml.content
91
-
92
- end
93
-
94
- def empty?
95
-
96
- @xml.nil?
97
-
98
- end
99
-
100
- def inner_xml
101
-
102
- @xml.inner_html.to_s
103
-
104
- end
105
-
106
- def xpath( xpath_query, *args, &block )
107
-
108
- nodeset_object(
109
-
110
- @xml.xpath( xpath_query, *args, &block )
111
-
112
- )
113
-
114
- end
115
-
116
- def at_xpath( xpath_query, *args, &block )
117
-
118
- node_object( @xml.at_xpath( xpath_query, *args, &block ) )
119
-
120
- end
121
-
122
- def replace( other )
123
-
124
- @xml.replace( other.xml )
125
-
126
- self
127
-
128
- end
129
-
130
- def add_previous_sibling( other )
131
-
132
- @xml.add_previous_sibling( other.xml )
133
-
134
- end
135
-
136
- def remove
137
-
138
- @xml.remove
139
-
140
- self
141
-
142
- end
143
-
144
- def parent
145
-
146
- element_object( @xml.parent )
147
-
148
- end
28
+ include Node
149
29
 
150
30
  # enable hooking for performance measurement & debug logging
151
- MobyUtil::Hooking.instance.hook_methods( self ) if defined?( MobyUtil::Hooking )
31
+ TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
152
32
 
153
33
  end # Element
154
34
 
@@ -23,26 +23,36 @@ require 'nokogiri'
23
23
  # for utf-8/unicode support
24
24
  require 'kconv'
25
25
 
26
- # abstraction for document, nodeset and element
27
- require File.expand_path( File.join( File.dirname( __FILE__ ), 'abstraction.rb' ) )
26
+ [
28
27
 
29
- # nokogiri parser wrapper
30
- require File.expand_path( File.join( File.dirname( __FILE__ ), 'document.rb' ) )
28
+ # abstraction for document, nodeset and element
29
+ 'abstraction.rb',
31
30
 
32
- # nokogiri parser wrapper
33
- require File.expand_path( File.join( File.dirname( __FILE__ ), 'nodeset.rb' ) )
31
+ 'node.rb',
34
32
 
35
- # nokogiri parser wrapper
36
- require File.expand_path( File.join( File.dirname( __FILE__ ), 'element.rb' ) )
33
+ # nokogiri parser wrapper
34
+ 'comment.rb',
37
35
 
38
- # nokogiri parser wrapper
39
- require File.expand_path( File.join( File.dirname( __FILE__ ), 'text.rb' ) )
36
+ # nokogiri parser wrapper
37
+ 'document.rb',
40
38
 
41
- # nokogiri parser wrapper
42
- require File.expand_path( File.join( File.dirname( __FILE__ ), 'attribute.rb' ) )
39
+ # nokogiri parser wrapper
40
+ 'nodeset.rb',
43
41
 
44
- # nokogiri parser wrapper
45
- require File.expand_path( File.join( File.dirname( __FILE__ ), 'builder.rb' ) )
42
+ # nokogiri parser wrapper
43
+ 'element.rb',
46
44
 
47
- # nokogiri parser wrapper
48
- #require File.expand_path( File.join( File.dirname( __FILE__ ), 'attribute.rb' ) )
45
+ # nokogiri parser wrapper
46
+ 'text.rb',
47
+
48
+ # nokogiri parser wrapper
49
+ 'attribute.rb',
50
+
51
+ # nokogiri parser wrapper
52
+ 'builder.rb',
53
+
54
+ ].each{ | filename |
55
+
56
+ require File.expand_path( File.join( File.dirname( __FILE__ ), filename ) )
57
+
58
+ }
@@ -0,0 +1,203 @@
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 MobyUtil
21
+
22
+ module XML
23
+
24
+ module Nokogiri
25
+
26
+ module Node # behaviour
27
+
28
+ include Abstraction
29
+
30
+ # TODO: document me
31
+ def []( value )
32
+
33
+ @xml[ value ]
34
+
35
+ end
36
+
37
+ # TODO: document me
38
+ def []=( name, value )
39
+
40
+ @xml[ name ] = value
41
+
42
+ end
43
+
44
+ # TODO: document me
45
+ def ==( object )
46
+
47
+ @xml.content == object.xml.content
48
+
49
+ end
50
+
51
+ # aliases for ==
52
+ alias_method :eql?, :==
53
+
54
+ # TODO: document me
55
+ def <=>( object )
56
+
57
+ @xml <=> object.xml
58
+
59
+ end
60
+
61
+ # TODO: document me
62
+ def add_previous_sibling( other )
63
+
64
+ @xml.add_previous_sibling( other.xml )
65
+
66
+ end
67
+
68
+ # TODO: document me
69
+ def attribute( attr_name )
70
+
71
+ unless ( value = @xml.attribute( attr_name ) ).nil?
72
+
73
+ value.to_s
74
+
75
+ end
76
+
77
+ end
78
+
79
+ # TODO: document me
80
+ def attributes
81
+
82
+ # return hash of attributes
83
+ Hash[ @xml.attribute_nodes.collect{ | node |
84
+
85
+ [ node.node_name, node.value.to_s ] }
86
+
87
+ ]
88
+
89
+ end
90
+
91
+ # TODO: document me
92
+ def blank?
93
+
94
+ @xml.blank?
95
+
96
+ end
97
+
98
+ # TODO: document me
99
+ def children
100
+
101
+ node_object( @xml.children )
102
+
103
+ end
104
+
105
+ # TODO: document me
106
+ def content
107
+
108
+ @xml.content
109
+
110
+ end
111
+
112
+ # aliases for text
113
+ alias_method :text, :content
114
+ alias_method :inner_text, :content
115
+
116
+ # TODO: document me
117
+ def each( &block )
118
+
119
+ # iterate each attribute
120
+ @xml.each{ | element |
121
+
122
+ yield( node_object( element ) )
123
+
124
+ }
125
+
126
+ nil
127
+
128
+ end
129
+
130
+ # TODO: document me
131
+ def inner_html
132
+
133
+ @xml.inner_html
134
+
135
+ end
136
+
137
+ # aliases for inner_html
138
+ alias_method :inner_xml, :inner_html
139
+
140
+ # TODO: document me
141
+ def to_s
142
+
143
+ @xml.to_s
144
+
145
+ end
146
+
147
+ # TODO: document me
148
+ def parent
149
+
150
+ node_object( @xml.parent )
151
+
152
+ end
153
+
154
+ # TODO: document me
155
+ def remove
156
+
157
+ @xml.remove
158
+
159
+ self
160
+
161
+ end
162
+
163
+ # TODO: document me
164
+ def replace( other )
165
+
166
+ @xml.replace( other.xml )
167
+
168
+ self
169
+
170
+ end
171
+
172
+ # TODO: document me
173
+ def xpath( xpath_query, *args, &block )
174
+
175
+ node_object(
176
+
177
+ @xml.xpath( xpath_query, *args, &block )
178
+
179
+ )
180
+
181
+ end
182
+
183
+ # TODO: document me
184
+ def at_xpath( xpath_query, *args, &block )
185
+
186
+ node_object(
187
+
188
+ @xml.at_xpath( xpath_query, *args, &block )
189
+
190
+ )
191
+
192
+ end
193
+
194
+ # enable hooking for performance measurement & debug logging
195
+ TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
196
+
197
+ end # Element
198
+
199
+ end # Nokogiri
200
+
201
+ end # XML
202
+
203
+ end # MobyUtil