cutedriver-driver 2.0.0.20210120164037

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.
Files changed (226) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +16 -0
  3. data/bin/start_app_perf +200 -0
  4. data/bin/tdriver-devtools +3 -0
  5. data/config/sut_parameters.rb +52 -0
  6. data/config/sut_setup.rb +32 -0
  7. data/config/sut_teardown.rb +32 -0
  8. data/config/tdriver_custom_error_recovery.rb +83 -0
  9. data/ext/extconf.rb +70 -0
  10. data/ext/native_extensions.c +315 -0
  11. data/lib/matti.rb +25 -0
  12. data/lib/tdriver-devtools/behaviour/old/xml/example/flick-example.rb +120 -0
  13. data/lib/tdriver-devtools/behaviour/old/xml/example/impl.rb_invalid +194 -0
  14. data/lib/tdriver-devtools/behaviour/old/xml/generate_behaviour_xml.rb +95 -0
  15. data/lib/tdriver-devtools/behaviour/old/xml/lib/tdriver_generator.rb +722 -0
  16. data/lib/tdriver-devtools/behaviour/old/xml/qdoc_generator.rb +321 -0
  17. data/lib/tdriver-devtools/behaviour/old/xml/templates/behaviour.method.template +43 -0
  18. data/lib/tdriver-devtools/behaviour/old/xml/templates/behaviour.module.template +54 -0
  19. data/lib/tdriver-devtools/behaviour/old/xml/templates/behaviour.xml.argument.template +7 -0
  20. data/lib/tdriver-devtools/behaviour/old/xml/templates/behaviour.xml.argument_type.template +7 -0
  21. data/lib/tdriver-devtools/behaviour/old/xml/templates/behaviour.xml.exception.template +5 -0
  22. data/lib/tdriver-devtools/behaviour/old/xml/templates/behaviour.xml.howto.line.template +2 -0
  23. data/lib/tdriver-devtools/behaviour/old/xml/templates/behaviour.xml.howto.template +5 -0
  24. data/lib/tdriver-devtools/behaviour/old/xml/templates/behaviour.xml.method.template +23 -0
  25. data/lib/tdriver-devtools/behaviour/old/xml/templates/behaviour.xml.template +14 -0
  26. data/lib/tdriver-devtools/behaviour/old/xml/update +3 -0
  27. data/lib/tdriver-devtools/behaviour/xml/generate.rb +88 -0
  28. data/lib/tdriver-devtools/behaviour/xml/rdoc_behaviour_xml_generator.rb +1945 -0
  29. data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.argument.default.template +1 -0
  30. data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.argument.template +3 -0
  31. data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.argument_type.template +4 -0
  32. data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.exception.template +4 -0
  33. data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.method.arguments.template +4 -0
  34. data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.method.deprecated.template +3 -0
  35. data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.method.exceptions.template +3 -0
  36. data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.method.info.template +1 -0
  37. data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.method.returns.template +3 -0
  38. data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.method.tables.template +3 -0
  39. data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.method.template +12 -0
  40. data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.returns.template +5 -0
  41. data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.table.item.template +1 -0
  42. data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.table.row.template +2 -0
  43. data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.table.template +8 -0
  44. data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.template +14 -0
  45. data/lib/tdriver-devtools/doc/behaviour_xml/QtExampleGestureBehaviour.xml +138 -0
  46. data/lib/tdriver-devtools/doc/behaviour_xml/created.rid +1 -0
  47. data/lib/tdriver-devtools/doc/behaviour_xml/tdriver.hash +1 -0
  48. data/lib/tdriver-devtools/doc/feature_xml/qt_widget_hold.feature.xml +9 -0
  49. data/lib/tdriver-devtools/doc/feature_xml/qt_widget_tap.feature.xml +9 -0
  50. data/lib/tdriver-devtools/doc/generate.rb +917 -0
  51. data/lib/tdriver-devtools/doc/update +1 -0
  52. data/lib/tdriver-devtools/doc/xslt/html.rb +7 -0
  53. data/lib/tdriver-devtools/doc/xslt/template.xsl +2170 -0
  54. data/lib/tdriver-devtools/doc/xslt/update +3 -0
  55. data/lib/tdriver-devtools/plugin/placeholder.txt +1 -0
  56. data/lib/tdriver-devtools/tdriver-devtools.rb +404 -0
  57. data/lib/tdriver-devtools/tests/feature_tests/example/behaviour_example.rb +100 -0
  58. data/lib/tdriver-devtools/tests/feature_tests/generate.rb +82 -0
  59. data/lib/tdriver-devtools/tests/feature_tests/lib/custom_rdoc_generator.rb +468 -0
  60. data/lib/tdriver-devtools/tests/feature_tests/templates/feature_attribute.template +5 -0
  61. data/lib/tdriver-devtools/tests/feature_tests/templates/feature_method.template +5 -0
  62. data/lib/tdriver-devtools/tests/feature_tests/templates/scenario_attribute.template +5 -0
  63. data/lib/tdriver-devtools/tests/feature_tests/templates/scenario_method.template +5 -0
  64. data/lib/tdriver-devtools/tests/feature_tests/update +3 -0
  65. data/lib/tdriver.rb +23 -0
  66. data/lib/tdriver/base/behaviour/abstract.rb +29 -0
  67. data/lib/tdriver/base/behaviour/behaviours/object_abstract.rb +107 -0
  68. data/lib/tdriver/base/behaviour/behaviours/object_behaviour_composition.rb +99 -0
  69. data/lib/tdriver/base/behaviour/behaviours/object_behaviour_description.rb +278 -0
  70. data/lib/tdriver/base/behaviour/behaviours/object_composition.rb +119 -0
  71. data/lib/tdriver/base/behaviour/factory.rb +495 -0
  72. data/lib/tdriver/base/behaviour/loader.rb +46 -0
  73. data/lib/tdriver/base/command_data/command_data.rb +51 -0
  74. data/lib/tdriver/base/command_data/loader.rb +29 -0
  75. data/lib/tdriver/base/controller/abstraction.rb +56 -0
  76. data/lib/tdriver/base/controller/loader.rb +21 -0
  77. data/lib/tdriver/base/errors.rb +134 -0
  78. data/lib/tdriver/base/loader.rb +47 -0
  79. data/lib/tdriver/base/state_object.rb +373 -0
  80. data/lib/tdriver/base/sut/adapter.rb +54 -0
  81. data/lib/tdriver/base/sut/controller.rb +151 -0
  82. data/lib/tdriver/base/sut/factory.rb +339 -0
  83. data/lib/tdriver/base/sut/generic/behaviours/agent.rb +77 -0
  84. data/lib/tdriver/base/sut/generic/behaviours/application.rb +427 -0
  85. data/lib/tdriver/base/sut/generic/behaviours/controller.rb +67 -0
  86. data/lib/tdriver/base/sut/generic/behaviours/find.rb +107 -0
  87. data/lib/tdriver/base/sut/generic/behaviours/flash_behaviour.rb +337 -0
  88. data/lib/tdriver/base/sut/generic/behaviours/sut.rb +1888 -0
  89. data/lib/tdriver/base/sut/generic/behaviours/switchbox_behaviour.rb +210 -0
  90. data/lib/tdriver/base/sut/generic/behaviours/verification.rb +222 -0
  91. data/lib/tdriver/base/sut/generic/commands/agent.rb +43 -0
  92. data/lib/tdriver/base/sut/generic/commands/application.rb +274 -0
  93. data/lib/tdriver/base/sut/generic/commands/fixture.rb +47 -0
  94. data/lib/tdriver/base/sut/generic/commands/key_sequence.rb +94 -0
  95. data/lib/tdriver/base/sut/generic/commands/screen_capture.rb +64 -0
  96. data/lib/tdriver/base/sut/generic/plugin.rb +97 -0
  97. data/lib/tdriver/base/sut/loader.rb +35 -0
  98. data/lib/tdriver/base/sut/sut.rb +98 -0
  99. data/lib/tdriver/base/test_object/abstract.rb +208 -0
  100. data/lib/tdriver/base/test_object/adapter.rb +740 -0
  101. data/lib/tdriver/base/test_object/behaviours/syncronization.rb +144 -0
  102. data/lib/tdriver/base/test_object/behaviours/test_object.rb +1047 -0
  103. data/lib/tdriver/base/test_object/cache.rb +134 -0
  104. data/lib/tdriver/base/test_object/factory.rb +684 -0
  105. data/lib/tdriver/base/test_object/loader.rb +51 -0
  106. data/lib/tdriver/base/test_object/verification.rb +178 -0
  107. data/lib/tdriver/base/test_object/xml/abstraction.rb +63 -0
  108. data/lib/tdriver/base/test_object/xml/adapter.rb +773 -0
  109. data/lib/tdriver/env.rb +21 -0
  110. data/lib/tdriver/loader.rb +57 -0
  111. data/lib/tdriver/matti.rb +35 -0
  112. data/lib/tdriver/report/error_recovery/tdriver_custom_error_recovery.rb +83 -0
  113. data/lib/tdriver/report/error_recovery/tdriver_error_recovery.rb +168 -0
  114. data/lib/tdriver/report/error_recovery/tdriver_error_recovery_settings.rb +106 -0
  115. data/lib/tdriver/report/report.rb +61 -0
  116. data/lib/tdriver/report/report_api.rb +348 -0
  117. data/lib/tdriver/report/report_combine.rb +86 -0
  118. data/lib/tdriver/report/report_crash_file_capture.rb +178 -0
  119. data/lib/tdriver/report/report_creator.rb +665 -0
  120. data/lib/tdriver/report/report_cucumber.rb +158 -0
  121. data/lib/tdriver/report/report_cucumber_listener.rb +184 -0
  122. data/lib/tdriver/report/report_cucumber_reporter.rb +181 -0
  123. data/lib/tdriver/report/report_data_presentation.rb +156 -0
  124. data/lib/tdriver/report/report_data_table.rb +64 -0
  125. data/lib/tdriver/report/report_execution_statistics.rb +400 -0
  126. data/lib/tdriver/report/report_file_capture.rb +159 -0
  127. data/lib/tdriver/report/report_graph_generator.rb +59 -0
  128. data/lib/tdriver/report/report_grouping.rb +541 -0
  129. data/lib/tdriver/report/report_javascript.rb +199 -0
  130. data/lib/tdriver/report/report_junit_xml.rb +147 -0
  131. data/lib/tdriver/report/report_rspec.rb +108 -0
  132. data/lib/tdriver/report/report_test_case_run.rb +725 -0
  133. data/lib/tdriver/report/report_test_run.rb +1476 -0
  134. data/lib/tdriver/report/report_test_unit.rb +223 -0
  135. data/lib/tdriver/report/report_writer.rb +1621 -0
  136. data/lib/tdriver/tdriver.rb +209 -0
  137. data/lib/tdriver/util/agent/loader.rb +22 -0
  138. data/lib/tdriver/util/agent/service.rb +107 -0
  139. data/lib/tdriver/util/common/array.rb +39 -0
  140. data/lib/tdriver/util/common/boolean.rb +48 -0
  141. data/lib/tdriver/util/common/crc16.rb +149 -0
  142. data/lib/tdriver/util/common/environment.rb +154 -0
  143. data/lib/tdriver/util/common/error.rb +40 -0
  144. data/lib/tdriver/util/common/exception.rb +53 -0
  145. data/lib/tdriver/util/common/exceptions.rb +12 -0
  146. data/lib/tdriver/util/common/file.rb +328 -0
  147. data/lib/tdriver/util/common/gem.rb +109 -0
  148. data/lib/tdriver/util/common/hash.rb +288 -0
  149. data/lib/tdriver/util/common/kernel.rb +253 -0
  150. data/lib/tdriver/util/common/loader.rb +47 -0
  151. data/lib/tdriver/util/common/numeric.rb +159 -0
  152. data/lib/tdriver/util/common/object.rb +159 -0
  153. data/lib/tdriver/util/common/retryable.rb +179 -0
  154. data/lib/tdriver/util/common/stackable.rb +185 -0
  155. data/lib/tdriver/util/common/string.rb +174 -0
  156. data/lib/tdriver/util/database/access.rb +240 -0
  157. data/lib/tdriver/util/database/connection.rb +44 -0
  158. data/lib/tdriver/util/database/error.rb +34 -0
  159. data/lib/tdriver/util/database/loader.rb +28 -0
  160. data/lib/tdriver/util/filters/attribute_filter.rb +121 -0
  161. data/lib/tdriver/util/filters/loader.rb +29 -0
  162. data/lib/tdriver/util/fixture/loader.rb +22 -0
  163. data/lib/tdriver/util/fixture/service.rb +211 -0
  164. data/lib/tdriver/util/hooking/hooking.rb +477 -0
  165. data/lib/tdriver/util/keymap/keymap.rb +81 -0
  166. data/lib/tdriver/util/loader.rb +80 -0
  167. data/lib/tdriver/util/localisation/error.rb +31 -0
  168. data/lib/tdriver/util/localisation/loader.rb +25 -0
  169. data/lib/tdriver/util/localisation/localisation.rb +762 -0
  170. data/lib/tdriver/util/logger/loader.rb +22 -0
  171. data/lib/tdriver/util/logger/logger.rb +591 -0
  172. data/lib/tdriver/util/operator_data/error.rb +29 -0
  173. data/lib/tdriver/util/operator_data/loader.rb +27 -0
  174. data/lib/tdriver/util/operator_data/operator_data.rb +93 -0
  175. data/lib/tdriver/util/other/config.rb +221 -0
  176. data/lib/tdriver/util/parameter/error.rb +48 -0
  177. data/lib/tdriver/util/parameter/loader.rb +25 -0
  178. data/lib/tdriver/util/parameter/parameter.rb +1161 -0
  179. data/lib/tdriver/util/plugin/abstract.rb +61 -0
  180. data/lib/tdriver/util/plugin/error.rb +0 -0
  181. data/lib/tdriver/util/plugin/loader.rb +28 -0
  182. data/lib/tdriver/util/plugin/service.rb +319 -0
  183. data/lib/tdriver/util/recorder/loader.rb +25 -0
  184. data/lib/tdriver/util/recorder/recorder.rb +72 -0
  185. data/lib/tdriver/util/recorder/scripter.rb +294 -0
  186. data/lib/tdriver/util/statistics/statistics.rb +89 -0
  187. data/lib/tdriver/util/user_data/error.rb +28 -0
  188. data/lib/tdriver/util/user_data/loader.rb +25 -0
  189. data/lib/tdriver/util/user_data/user_data.rb +104 -0
  190. data/lib/tdriver/util/video/camera.rb +67 -0
  191. data/lib/tdriver/util/video/camera_linux.rb +153 -0
  192. data/lib/tdriver/util/video/camera_windows.rb +174 -0
  193. data/lib/tdriver/util/video/loader.rb +31 -0
  194. data/lib/tdriver/util/video/video_utils.rb +139 -0
  195. data/lib/tdriver/util/xml/abstraction.rb +117 -0
  196. data/lib/tdriver/util/xml/attribute.rb +32 -0
  197. data/lib/tdriver/util/xml/builder.rb +53 -0
  198. data/lib/tdriver/util/xml/comment.rb +32 -0
  199. data/lib/tdriver/util/xml/document.rb +32 -0
  200. data/lib/tdriver/util/xml/element.rb +32 -0
  201. data/lib/tdriver/util/xml/error.rb +46 -0
  202. data/lib/tdriver/util/xml/loader.rb +62 -0
  203. data/lib/tdriver/util/xml/nil_node.rb +95 -0
  204. data/lib/tdriver/util/xml/nodeset.rb +32 -0
  205. data/lib/tdriver/util/xml/parsers/libxml/libxml.rb +140 -0
  206. data/lib/tdriver/util/xml/parsers/loader.rb +21 -0
  207. data/lib/tdriver/util/xml/parsers/nokogiri/abstraction.rb +167 -0
  208. data/lib/tdriver/util/xml/parsers/nokogiri/attribute.rb +66 -0
  209. data/lib/tdriver/util/xml/parsers/nokogiri/builder.rb +64 -0
  210. data/lib/tdriver/util/xml/parsers/nokogiri/comment.rb +39 -0
  211. data/lib/tdriver/util/xml/parsers/nokogiri/document.rb +66 -0
  212. data/lib/tdriver/util/xml/parsers/nokogiri/element.rb +39 -0
  213. data/lib/tdriver/util/xml/parsers/nokogiri/loader.rb +58 -0
  214. data/lib/tdriver/util/xml/parsers/nokogiri/node.rb +212 -0
  215. data/lib/tdriver/util/xml/parsers/nokogiri/nodeset.rb +237 -0
  216. data/lib/tdriver/util/xml/parsers/nokogiri/text.rb +39 -0
  217. data/lib/tdriver/util/xml/text.rb +32 -0
  218. data/lib/tdriver/util/xml/xml.rb +332 -0
  219. data/lib/tdriver/verify/verify.rb +2398 -0
  220. data/lib/tdriver/version.rb +21 -0
  221. data/xml/behaviours/generic.xml +530 -0
  222. data/xml/defaults/generic.xml +11 -0
  223. data/xml/defaults/sut_generic.xml +8 -0
  224. data/xml/parameters/tdriver_parameters.xml +23 -0
  225. data/xml/templates/generic.xml +292 -0
  226. metadata +324 -0
@@ -0,0 +1,156 @@
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
+
21
+
22
+ module TDriverReportDataPresentation
23
+ include TDriverReportWriter
24
+
25
+ ## This method will create a .png image with a graph
26
+ ## Arguments
27
+ # data:: Hash: Data to be ploted in the form of {"signal_name" => [ value 1, value 2, .., value n] , ...}
28
+ # filename:: String: filname for the image that will be generated. Should have .png extension
29
+ # title:: String: Title for the graph
30
+ ## Returns
31
+ # String: String with the <img> tag to be inserted into an html file
32
+ ## Exceptions
33
+ # ArgumentError: Thown when data or filname provided are either nil or the wrong types
34
+ def create_graph_image( data, filename, title = nil)
35
+ begin
36
+ require 'gruff'
37
+ rescue Exception => e
38
+ puts "Can't load the Gruff gem. If its missing from your system please run 'gem install gruff' to install it."
39
+ puts e.inspect
40
+ end
41
+ begin
42
+
43
+ raise TypeError, "ERROR create_graph_image: Data argument is either nil or not a Hash" if ( data.nil? or !data.kind_of? Hash )
44
+
45
+ raise ArgumentError, "ERROR create_graph_image: Values of the data Hash need to be arrays of minimum length 2" if ( !data.values[0].kind_of? Array or data.values[0].length < 2 )
46
+
47
+ raise TypeError, "ERROR create_graph_image: Filename argument is either missing or not a String" if ( filename.nil? or !filename.kind_of? String )
48
+
49
+ g = Gruff::Line.new
50
+ g.title = title unless title.nil?
51
+ data.each_key do |signal|
52
+ g.data( signal, data[signal])
53
+ end
54
+ # boring labels for now
55
+ #data[data.keys[0]].length.times do |i|
56
+ # g.labels[i] = (i + 1).to_s
57
+ #end
58
+ g.write(filename)
59
+ rescue ArgumentError => e
60
+ puts e.message
61
+ end
62
+ end
63
+
64
+ ## This method returns an html img tag to an image with a graph of the data provided
65
+ ## Arguments
66
+ # data:: Hash: Data to be ploted in the form of {"signal_name" => [ value 1, value 2, .., value n] , ...}
67
+ # filename:: String: filname for the image that will be generated. Should have .png extension
68
+ # title:: String: Title for the graph
69
+ # width:: String/Integer: desired width in number of pixels for the image. Defaults to "auto"
70
+ ## Returns
71
+ # String: String with the <img> tag to be inserted into an html file
72
+ ## Exceptions
73
+ # ArgumentError: Thown when data is either nil or the wrong types
74
+ def insert_html_graph( data, filename = nil , title = nil, width = nil )
75
+ filename = "graph.png" if filename.nil?
76
+ title = "Application Start Performance" if title.nil?
77
+ create_graph_image(data, filename, title)
78
+ html = "\n<img class='graph' src='#{File.basename(filename)}' style='width:#{ width.nil? ? 'auto' : width.to_s + 'px' }'/>\n"
79
+ end
80
+
81
+ ## This method will create an html table tag with the data provided
82
+ ## Arguments
83
+ # data:: Hash: Data to be ploted in the form of {"signal_name" => [ value 1, value 2, .., value n] , ...}
84
+ # width:: String/Integer: desired width in number of pixels for the table. Defaults to "auto"
85
+ ## Returns
86
+ # String: String with the <table> tag to be inserted into an html file
87
+ ## Exceptions
88
+ #
89
+ def insert_html_table( data, width = nil )
90
+ raise ArgumentError, "Data argument is either nul or not a Hash" if ( data.nil? or data.class.to_s != "Hash" )
91
+ html = "\n<table class='graph' style='width:#{ width.nil? ? 'auto' : width.to_s + 'px' }'>"
92
+ # table headers
93
+ ( data[data.keys[0]].length + 1).times do |i|
94
+ html << ( i.zero? ? "\n<td class='tbl_header'>Signal/Event</td>" : "\n<td class='tbl_header'>#{i.to_s}</td>")
95
+ end
96
+ # table data
97
+ data.each_key do |signal|
98
+ html << "\n<tr>\n<td>#{signal}</td>"
99
+ data[signal].each do |value|
100
+ html << "\n<td class='tbl_body'>#{value.to_s}</td>"
101
+ end
102
+ html << "\n</tr>"
103
+ end
104
+ html << "\n</table>\n"
105
+ end
106
+
107
+ ## This method inserts the graph specific styles
108
+ ## Returns
109
+ # String: String with the <stile> tag to be added to an html page including either the graph or the table provided by this module
110
+ def insert_graph_css()
111
+ css = '
112
+ <style>
113
+ table.graph
114
+ { text-align: center;
115
+ font-family: Verdana;
116
+ font-weight: normal;
117
+ font-size: 11px;
118
+ color: #404040;
119
+ width: auto;
120
+ background-color: #fafafa;
121
+ border: 1px #6699CC solid;
122
+ border-collapse: collapse;
123
+ border-spacing: 0px; }
124
+
125
+ td.tbl_header
126
+ { border-bottom: 2px solid #6699CC;
127
+ border-left: 1px solid #6699CC;
128
+ background-color: #BEC8D1;
129
+ text-align: left;
130
+ text-indent: 5px;
131
+ font-family: Verdana;
132
+ font-weight: bold;
133
+ font-size: 11px;
134
+ color: #404040; }
135
+
136
+ td.tbl_body
137
+ { border-bottom: 1px solid #9CF;
138
+ border-top: 0px;
139
+ border-left: 1px solid #9CF;
140
+ border-right: 0px;
141
+ text-align: left;
142
+ text-indent: 10px;
143
+ font-family: Verdana, sans-serif, Arial;
144
+ font-weight: normal;
145
+ font-size: 11px;
146
+ color: #404040;
147
+ background-color: #fafafa; }
148
+
149
+ img.graph
150
+ {border: 1px solid #9CF;
151
+ width:auto;
152
+ height:auto}
153
+ </style>
154
+ '
155
+ end
156
+ end
@@ -0,0 +1,64 @@
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
+
21
+
22
+ module ReportDataTable
23
+
24
+ def add_data_from_hash(data_hash_to_add,table_data,table_columns)
25
+ raise TypeError.new( 'Input parameter not of Type: Hash.\nIt is: ' + data_hash_to_add.class.to_s ) unless data_hash_to_add.kind_of?( Hash )
26
+
27
+ data_hash_to_add.each_key {|key| table_columns<<key if !table_columns.include?(key)}
28
+ table_data<<data_hash_to_add
29
+ end
30
+
31
+ def add_data_from_array(data_array_to_add,table_data,table_columns)
32
+ raise TypeError.new( 'Input parameter not of Type: Array.\nIt is: ' + data_array_to_add.class.to_s ) unless data_array_to_add.kind_of?( Array )
33
+
34
+ column=nil
35
+ data=nil
36
+ column_found=false
37
+ value_found=false
38
+ data_hash=Hash.new
39
+
40
+ data_array_to_add.each do |value|
41
+ if (column_found)
42
+ data=value
43
+ data_found=true
44
+ end
45
+
46
+ if (!column_found)
47
+ column=value
48
+ column_found=true
49
+ end
50
+
51
+ if (column_found && data_found)
52
+ if column!=nil && data!=nil
53
+ data_hash[column]=data
54
+ table_columns<<column unless table_columns.include?(column)
55
+ column_found=false
56
+ data_found=false
57
+ end
58
+ end
59
+ end
60
+
61
+ table_data<<data_hash
62
+ end
63
+ end #ReportDataTable
64
+
@@ -0,0 +1,400 @@
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
+
21
+ class ReportingStatistics
22
+ def initialize(test_cases_array, summary=nil)
23
+ @all_statuses=Array.new
24
+ @group_test_case_arr=Array.new(test_cases_array)
25
+ @pass_statuses= $parameters[ :report_passed_statuses, "passed" ].split('|')
26
+ @fail_statuses= $parameters[ :report_failed_statuses, "failed" ].split('|')
27
+ @not_run_statuses= $parameters[ :report_not_run_statuses, "not run" ].split('|')
28
+ @test_results_per_page= $parameters[ :report_results_per_page, 50]
29
+ @statistics_arr=Array.new
30
+ @total_statistics_arr=Array.new
31
+ @summary=summary
32
+ end
33
+
34
+ def reset_total_statistics()
35
+ @all_statuses << "total"
36
+ @total_statistics_arr << ["total",0]
37
+ @pass_statuses.each do |status|
38
+ @total_statistics_arr << [status,0]
39
+ @all_statuses << status
40
+ end
41
+ @fail_statuses.each do |status|
42
+ @total_statistics_arr << [status,0]
43
+ @all_statuses << status
44
+ end
45
+ @not_run_statuses.each do |status|
46
+ @total_statistics_arr << [status,0]
47
+ @all_statuses << status
48
+ end
49
+ @total_statistics_arr << ["reboots",0]
50
+ @total_statistics_arr << ["crashes",0]
51
+ @total_statistics_arr << ["connection_errors",0]
52
+ @total_statistics_arr << ["duration",0]
53
+ @total_statistics_arr << ["dump count",0]
54
+ @total_statistics_arr << ["sent bytes",0]
55
+ @total_statistics_arr << ["received bytes",0]
56
+ @total_statistics_arr << ["used mem",0]
57
+ @total_statistics_arr << ["pass rate",0]
58
+ @all_statuses << "reboots" << "crashes" << "connection_errors" << "duration" << "dump count" << "sent bytes" << "received bytes" << "used mem" << "pass rate"
59
+ end
60
+
61
+ def generate_statistics_headers()
62
+ status_heads=Array.new
63
+ @pass_statuses.each do |status|
64
+ status_heads << "<th abbr=\"link_column\"><b>#{status}</b></th>"
65
+ end
66
+ @fail_statuses.each do |status|
67
+ status_heads << "<th abbr=\"link_column\"><b>#{status}</b></th>"
68
+ end
69
+ @not_run_statuses.each do |status|
70
+ status_heads << "<th abbr=\"link_column\"><b>#{status}</b></th>"
71
+ end
72
+ status_heads << "<th abbr=\"link_column\"><b>Reboots</b></th>"
73
+ status_heads << "<th abbr=\"link_column\"><b>Crashes</b></th>"
74
+ status_heads << "<th abbr=\"link_column\"><b>Connection Errors</b></th>"
75
+ status_heads << "<th abbr=\"link_column\"><b>Duration</b></th>"
76
+ status_heads << "<th abbr=\"link_column\"><b>Dump count</b></th>"
77
+ status_heads << "<th abbr=\"link_column\"><b>Sent bytes</b></th>"
78
+ status_heads << "<th abbr=\"link_column\"><b>Received bytes</b></th>"
79
+ status_heads << "<th abbr=\"link_column\"><b>Used mem</b></th>"
80
+ status_heads << "<th abbr=\"link_column\"><b>Pass %</b></th>"
81
+ status_heads
82
+ end
83
+
84
+ def update_total_execution_statistics(tc_status,reboots,crashes,connection_errors,dump_count,sent_bytes,received_bytes,memory_usage)
85
+ current_index=0
86
+ @total_statistics_arr.each do |total_status|
87
+ if tc_status==total_status[0]
88
+ @total_statistics_arr[current_index]=[tc_status,total_status[1].to_i+1]
89
+ end
90
+ if total_status[0]=="reboots"
91
+ @total_statistics_arr[current_index]=["reboots",total_status[1].to_i+reboots.to_i]
92
+ end
93
+ if total_status[0]=="crashes"
94
+ @total_statistics_arr[current_index]=["crashes",total_status[1].to_i+crashes.to_i]
95
+ end
96
+ if total_status[0]=="connection_errors"
97
+ @total_statistics_arr[current_index]=["connection_errors",total_status[1].to_i+connection_errors.to_i]
98
+ end
99
+ if total_status[0]=="total"
100
+ @total_statistics_arr[current_index]=["total",total_status[1].to_i+1]
101
+ end
102
+ if total_status[0]=="duration"
103
+ @total_statistics_arr[current_index]=["duration",""]
104
+ end
105
+ if total_status[0]=="dump count"
106
+ @total_statistics_arr[current_index]=["dump count",total_status[1].to_i+dump_count.to_i]
107
+ end
108
+ if total_status[0]=="sent bytes"
109
+ @total_statistics_arr[current_index]=["sent bytes",total_status[1].to_i+sent_bytes.to_i]
110
+ end
111
+ if total_status[0]=="received bytes"
112
+ @total_statistics_arr[current_index]=["received bytes",total_status[1].to_i+received_bytes.to_i]
113
+ end
114
+ if total_status[0]=="used mem"
115
+ @total_statistics_arr[current_index]=["used mem",""]
116
+ end
117
+ if total_status[0]=="pass rate"
118
+ @total_statistics_arr[current_index]=["pass rate",""]
119
+ end
120
+ current_index+=1
121
+ end
122
+ end
123
+
124
+ def update_test_case_execution_statistics(tc_name,tc_status,tc_execution,duration,tc_link,reboots,crashes,connection_errors,dump_count,sent_bytes,received_bytes,memory_usage)
125
+ b_test_in_statistics=false
126
+ current_index=0
127
+ total_run=0
128
+ total_not_run=0
129
+ total_passed=0
130
+ total_not_run_index=0
131
+ total_passed_index=0
132
+ pass_rate_index=0
133
+ @statistics_arr.each do |total_status|
134
+ if total_status[1]==tc_status && total_status[0]==tc_name
135
+ b_test_in_statistics=true
136
+ @statistics_arr[current_index]=[tc_name,tc_status,total_status[2].to_i+1,tc_execution,tc_link]
137
+ end
138
+ if total_status[1]=="reboots" && total_status[0]==tc_name
139
+ b_test_in_statistics=true
140
+ @statistics_arr[current_index]=[tc_name,"reboots",total_status[2].to_i+reboots.to_i,tc_execution,tc_link]
141
+ end
142
+ if total_status[1]=="crashes" && total_status[0]==tc_name
143
+ b_test_in_statistics=true
144
+ @statistics_arr[current_index]=[tc_name,"crashes",total_status[2].to_i+crashes.to_i,tc_execution,tc_link]
145
+ end
146
+ if total_status[1]=="connection_errors" && total_status[0]==tc_name
147
+ b_test_in_statistics=true
148
+ @statistics_arr[current_index]=[tc_name,"connection_errors",total_status[2].to_i+connection_errors.to_i,tc_execution,tc_link]
149
+ end
150
+ if total_status[1]=="total" && total_status[0]==tc_name
151
+ b_test_in_statistics=true
152
+ @statistics_arr[current_index]=[tc_name,"total",total_status[2].to_i+1,tc_execution,tc_link]
153
+ total_run=total_status[2].to_i+1
154
+ end
155
+ if total_status[1]=="duration" && total_status[0]==tc_name
156
+ b_test_in_statistics=true
157
+ @statistics_arr[current_index]=[tc_name,"duration",duration,tc_execution,tc_link]
158
+ end
159
+ if total_status[1]=="dump count" && total_status[0]==tc_name
160
+ b_test_in_statistics=true
161
+ @statistics_arr[current_index]=[tc_name,"dump count",total_status[2].to_i+dump_count.to_i,tc_execution,tc_link]
162
+ end
163
+ if total_status[1]=="sent bytes" && total_status[0]==tc_name
164
+ b_test_in_statistics=true
165
+ @statistics_arr[current_index]=[tc_name,"sent bytes",total_status[2].to_i+sent_bytes.to_i,tc_execution,tc_link]
166
+ end
167
+ if total_status[1]=="received bytes" && total_status[0]==tc_name
168
+ b_test_in_statistics=true
169
+ @statistics_arr[current_index]=[tc_name,"received bytes",total_status[2].to_i+received_bytes.to_i,tc_execution,tc_link]
170
+ end
171
+ if total_status[1]=="used mem" && total_status[0]==tc_name
172
+ b_test_in_statistics=true
173
+ @statistics_arr[current_index]=[tc_name,"used mem",total_status[2].to_i,tc_execution,tc_link]
174
+ end
175
+ if total_status[1]=="pass rate" && total_status[0]==tc_name
176
+ b_test_in_statistics=true
177
+ pass_rate_index=current_index
178
+ end
179
+ if @pass_statuses.include?(total_status[1]) && total_status[0]==tc_name
180
+ total_passed_index=current_index
181
+ end
182
+ if @not_run_statuses.include?(total_status[1]) && total_status[0]==tc_name
183
+ total_not_run_index=current_index
184
+ end
185
+ current_index+=1
186
+ end
187
+
188
+ if b_test_in_statistics==true
189
+ total_passed_result=@statistics_arr[total_passed_index]
190
+ total_not_run_result=@statistics_arr[total_not_run_index]
191
+ total_passed=total_passed_result[2].to_i
192
+ total_not_run=total_not_run_result[2].to_i
193
+ pass_rate=(total_passed.to_f/(total_run.to_f-total_not_run.to_f))*100
194
+ pass_rate="%0.2f" % pass_rate
195
+ @statistics_arr[pass_rate_index]=[tc_name,"pass rate",pass_rate,tc_execution,tc_link]
196
+ end
197
+
198
+ b_test_in_statistics
199
+ end
200
+
201
+ def collect_test_case_statistics()
202
+ total_duration = 0.0
203
+ @group_test_case_arr.each do |test_case|
204
+ tc_status=test_case[7]
205
+ tc_name=test_case[0].to_s.gsub('_',' ')
206
+ tc_execution=test_case[8].to_i
207
+ reboots=test_case[2]
208
+ crashes=test_case[3]
209
+ tc_link=test_case[11]
210
+ dump_count=test_case[13].to_i
211
+ sent_bytes=test_case[14].to_i
212
+ received_bytes=test_case[15].to_i
213
+ memory_usage=test_case[6].to_i
214
+ connection_errors=test_case[16].to_i
215
+
216
+ duration=test_case[5].to_f
217
+ total_duration = total_duration + duration
218
+ b_test_in_statistics=false
219
+
220
+ #Update total statistics
221
+ update_total_execution_statistics(tc_status,reboots,crashes,connection_errors,dump_count,sent_bytes,received_bytes,memory_usage)
222
+
223
+ #Update current test case total statistics
224
+ b_test_in_statistics=update_test_case_execution_statistics(tc_name,tc_status,tc_execution,duration,tc_link,reboots,crashes,connection_errors,dump_count,sent_bytes,received_bytes,memory_usage)
225
+
226
+ if b_test_in_statistics==false
227
+ total_run=0
228
+ total_not_run=0
229
+ total_passed=0
230
+ @all_statuses.each do |status|
231
+ if status==tc_status
232
+ @statistics_arr << [tc_name,tc_status,1,tc_execution,tc_link]
233
+ total_passed=1 if @pass_statuses.include?(tc_status)
234
+ total_not_run=1 if @not_run_statuses.include?(tc_status)
235
+ elsif status=="reboots"
236
+ @statistics_arr << [tc_name,"reboots",reboots.to_i,tc_execution,tc_link]
237
+ elsif status=="crashes"
238
+ @statistics_arr << [tc_name,"crashes",crashes.to_i,tc_execution,tc_link]
239
+ elsif status=="connection_errors"
240
+ @statistics_arr << [tc_name,"connection_errors",connection_errors.to_i,tc_execution,tc_link]
241
+ elsif status=="total"
242
+ total_run=1
243
+ @statistics_arr << [tc_name,"total",1,tc_execution,tc_link]
244
+ elsif status=="duration"
245
+ @statistics_arr << [tc_name,"duration",duration,tc_execution,tc_link]
246
+ elsif status=="dump count"
247
+ @statistics_arr << [tc_name,"dump count",dump_count,tc_execution,tc_link]
248
+ elsif status=="sent bytes"
249
+ @statistics_arr << [tc_name,"sent bytes",sent_bytes,tc_execution,tc_link]
250
+ elsif status=="received bytes"
251
+ @statistics_arr << [tc_name,"received bytes",received_bytes,tc_execution,tc_link]
252
+ elsif status=="used mem"
253
+ @statistics_arr << [tc_name,"used mem",memory_usage,tc_execution,tc_link]
254
+ elsif status=="pass rate"
255
+ pass_rate=(total_passed.to_f/(total_run.to_f-total_not_run.to_f))*100
256
+ pass_rate="%0.2f" % pass_rate
257
+ @statistics_arr << [tc_name,"pass rate",pass_rate,tc_execution,tc_link]
258
+ else
259
+ @statistics_arr << [tc_name,status,0,tc_execution,tc_link]
260
+ end
261
+ end
262
+ end
263
+
264
+ end
265
+
266
+ end
267
+
268
+ def add_result_style_tag(status,total)
269
+ tc_style_tag=' id=""'
270
+ tc_style_tag=' id="passed_case"' if @pass_statuses.include?(status) && total>0
271
+ tc_style_tag=' id="failed_case"' if @fail_statuses.include?(status) && total>0
272
+ tc_style_tag=' id="not_run_case"' if @not_run_statuses.include?(status) && total>0
273
+ tc_style_tag
274
+ end
275
+ def add_result_link(test_case,status,total,test_index)
276
+
277
+ result_page=test_index/@test_results_per_page.to_i
278
+ result_page_mod=test_index % @test_results_per_page.to_i
279
+
280
+ if result_page_mod>0
281
+ result_page=result_page.to_i+1
282
+ end
283
+ result_page=1 if result_page==0
284
+
285
+ if @summary
286
+ tc_link='<a href="cases/'+result_page.to_i.to_s+'_chronological_total_run_index.html">'
287
+ tc_link='<a href="cases/1_reboot_index.html">' if status=="reboots" && total>0
288
+ tc_link='<a href="cases/1_crash_index.html">' if status=="crashes" && total>0
289
+ tc_link='<a href="cases/1_connection_errors_index.html">' if status=="connection_errors" && total>0
290
+ tc_link='<a href="cases/1_'+@pass_statuses.first.gsub(' ','_')+'_'+test_case.gsub(' ','_')+'_index.html">' if @pass_statuses.include?(status) && total>0
291
+ tc_link='<a href="cases/1_'+@fail_statuses.first.gsub(' ','_')+'_'+test_case.gsub(' ','_')+'_index.html">' if @fail_statuses.include?(status) && total>0
292
+ tc_link='<a href="cases/1_'+@not_run_statuses.first.gsub(' ','_')+'_'+test_case.gsub(' ','_')+'_index.html">' if @not_run_statuses.include?(status) && total>0
293
+ else
294
+ tc_link='<a href="'+result_page.to_i.to_s+'_chronological_total_run_index.html">'
295
+ tc_link='<a href="1_reboot_index.html">' if status=="reboots" && total>0
296
+ tc_link='<a href="1_crash_index.html">' if status=="crashes" && total>0
297
+ tc_link='<a href="1_connection_errors_index.html">' if status=="connection_errors" && total>0
298
+ tc_link='<a href="1_'+@pass_statuses.first.gsub(' ','_')+'_'+test_case.gsub(' ','_')+'_index.html">' if @pass_statuses.include?(status) && total>0
299
+ tc_link='<a href="1_'+@fail_statuses.first.gsub(' ','_')+'_'+test_case.gsub(' ','_')+'_index.html">' if @fail_statuses.include?(status) && total>0
300
+ tc_link='<a href="1_'+@not_run_statuses.first.gsub(' ','_')+'_'+test_case.gsub(' ','_')+'_index.html">' if @not_run_statuses.include?(status) && total>0
301
+ end
302
+ tc_link
303
+
304
+ end
305
+
306
+ def generate_duration_graph(file_name)
307
+
308
+ begin
309
+ require 'gruff'
310
+ rescue LoadError
311
+ $stderr.puts "Can't load the Gruff gem. If its missing from your system please run 'gem install gruff' to install it."
312
+ end
313
+ reset_total_statistics()
314
+ collect_test_case_statistics()
315
+ begin
316
+ labels = Hash.new
317
+ durations = Array.new
318
+ test_case_added=Array.new
319
+ current_index = 0
320
+ @statistics_arr.each do |test_case|
321
+ tc_name=test_case[0].to_s.gsub('_',' ')
322
+ if test_case_added.include?(tc_name)==false && test_case[1].to_s=="duration"
323
+ durations << test_case[2]
324
+ labels[current_index] = "#{current_index + 1}" #tc_name
325
+ current_index += 1
326
+ test_case_added << tc_name
327
+ end
328
+ end
329
+
330
+ if current_index > 50
331
+ g = Gruff::SideStackedBar.new("400x#{15*current_index.to_i}")
332
+ else
333
+ g = Gruff::SideStackedBar.new()
334
+ end
335
+
336
+ g.title = "Duration Distribution"
337
+ g.data("Duration", durations)
338
+ g.labels = labels
339
+ g.write(file_name)
340
+ rescue Exception => e
341
+ $stderr.puts "Can't load the Gruff gem. If its missing from your system please run 'gem install gruff' to install it."
342
+ end
343
+ end
344
+
345
+ def generate_statistics_table()
346
+ table_body=Array.new
347
+ reset_total_statistics()
348
+ collect_test_case_statistics()
349
+ table_body='<table id="statistics_table" class="sortable" align="center" border="0" cellspacing="0" style="width:100%;">'<<
350
+ '<thead><tr>'<<
351
+ '<th>'<<
352
+ '<b>Row</b></th>'<<
353
+ '<th abbr="link_column">'<<
354
+ '<b>Name</b></th>'<<
355
+ '<th abbr="link_column">'<<
356
+ '<b>Total</b></th>'<<
357
+ generate_statistics_headers.to_s <<
358
+ '</tr></thead><tbody>'
359
+
360
+ test_case_added=Array.new
361
+ row=1
362
+ @statistics_arr.each do |test_case|
363
+ tc_name=test_case[0].to_s.gsub('_',' ')
364
+ if @summary
365
+ test_link="cases/#{test_case[4]}"
366
+ else
367
+ test_link=test_case[4]
368
+ end
369
+
370
+ if test_case_added.include?(tc_name)==false
371
+ table_body << "<tr>"
372
+ table_body << "<td>#{row}</td>"
373
+ table_body << "<td><a href=\"#{test_link}\">#{tc_name}</a></td>"
374
+ @statistics_arr.each do |test_case_statistics|
375
+ if test_case_statistics[0]==tc_name
376
+ table_body << "<td#{add_result_style_tag(test_case_statistics[1],test_case_statistics[2])}>#{add_result_link(test_case_statistics[0],test_case_statistics[1],test_case_statistics[2],test_case_statistics[3])}#{test_case_statistics[2]}</a></td>"
377
+ end
378
+ end
379
+ table_body << "</tr>"
380
+ test_case_added << tc_name
381
+ row+=1
382
+ end
383
+ end
384
+
385
+
386
+ table_body << '</tbody>'
387
+ table_body << '<tfoot><tr>' <<
388
+ '<td></td><td>'<<
389
+ '<b>Total</b></td>'
390
+ @total_statistics_arr.each do |statistic|
391
+ table_body << "<td><b>#{statistic[1]}</b></td>"
392
+ end
393
+ table_body << '</tr></tfoot>' <<
394
+ '</table>'
395
+
396
+
397
+ table_body
398
+ end
399
+
400
+ end