testability-driver 0.9.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (214) hide show
  1. data/README +1 -0
  2. data/bin/start_app_perf +199 -0
  3. data/bin/tdriver-devtools +3 -0
  4. data/config/sut_parameters.rb +39 -0
  5. data/ext/extconf.rb +67 -0
  6. data/ext/native_extensions.c +70 -0
  7. data/lib/matti.rb +30 -0
  8. data/lib/tdriver-devtools/behaviour/old/xml/example/flick-example.rb +223 -0
  9. data/lib/tdriver-devtools/behaviour/old/xml/example/impl.rb_invalid +194 -0
  10. data/lib/tdriver-devtools/behaviour/old/xml/generate_behaviour_xml.rb +95 -0
  11. data/lib/tdriver-devtools/behaviour/old/xml/lib/tdriver_generator.rb +722 -0
  12. data/lib/tdriver-devtools/behaviour/old/xml/qdoc_generator.rb +321 -0
  13. data/lib/tdriver-devtools/behaviour/old/xml/templates/behaviour.method.template +43 -0
  14. data/lib/tdriver-devtools/behaviour/old/xml/templates/behaviour.module.template +54 -0
  15. data/lib/tdriver-devtools/behaviour/old/xml/templates/behaviour.xml.argument.template +7 -0
  16. data/lib/tdriver-devtools/behaviour/old/xml/templates/behaviour.xml.argument_type.template +7 -0
  17. data/lib/tdriver-devtools/behaviour/old/xml/templates/behaviour.xml.exception.template +5 -0
  18. data/lib/tdriver-devtools/behaviour/old/xml/templates/behaviour.xml.howto.line.template +2 -0
  19. data/lib/tdriver-devtools/behaviour/old/xml/templates/behaviour.xml.howto.template +5 -0
  20. data/lib/tdriver-devtools/behaviour/old/xml/templates/behaviour.xml.method.template +23 -0
  21. data/lib/tdriver-devtools/behaviour/old/xml/templates/behaviour.xml.template +14 -0
  22. data/lib/tdriver-devtools/behaviour/old/xml/update +3 -0
  23. data/lib/tdriver-devtools/behaviour/xml/generate.rb +88 -0
  24. data/lib/tdriver-devtools/behaviour/xml/rdoc_behaviour_xml_generator.rb +1924 -0
  25. data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.argument.default.template +1 -0
  26. data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.argument.template +3 -0
  27. data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.argument_type.template +4 -0
  28. data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.exception.template +4 -0
  29. data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.method.arguments.template +4 -0
  30. data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.method.deprecated.template +3 -0
  31. data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.method.exceptions.template +3 -0
  32. data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.method.info.template +1 -0
  33. data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.method.returns.template +3 -0
  34. data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.method.tables.template +3 -0
  35. data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.method.template +12 -0
  36. data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.returns.template +5 -0
  37. data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.table.item.template +1 -0
  38. data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.table.row.template +2 -0
  39. data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.table.template +8 -0
  40. data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.template +14 -0
  41. data/lib/tdriver-devtools/behaviour/xml_generator/example/flick-example.rb +245 -0
  42. data/lib/tdriver-devtools/behaviour/xml_generator/example/sut.rb +964 -0
  43. data/lib/tdriver-devtools/behaviour/xml_generator/generate.rb +68 -0
  44. data/lib/tdriver-devtools/behaviour/xml_generator/lib/custom_rdoc_generator.rb +1865 -0
  45. data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.argument.default.template +1 -0
  46. data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.argument.template +3 -0
  47. data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.argument_type.template +4 -0
  48. data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.exception.template +4 -0
  49. data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.method.arguments.template +4 -0
  50. data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.method.deprecated.template +3 -0
  51. data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.method.exceptions.template +3 -0
  52. data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.method.info.template +1 -0
  53. data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.method.returns.template +3 -0
  54. data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.method.tables.template +3 -0
  55. data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.method.template +12 -0
  56. data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.returns.template +5 -0
  57. data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.table.item.template +1 -0
  58. data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.table.row.template +2 -0
  59. data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.table.template +7 -0
  60. data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.template +14 -0
  61. data/lib/tdriver-devtools/behaviour/xml_generator/update +3 -0
  62. data/lib/tdriver-devtools/doc/behaviour_xml/QtExampleGestureBehaviour.xml +138 -0
  63. data/lib/tdriver-devtools/doc/behaviour_xml/created.rid +1 -0
  64. data/lib/tdriver-devtools/doc/behaviour_xml/tdriver.hash +1 -0
  65. data/lib/tdriver-devtools/doc/feature_xml/qt_widget_hold.feature.xml +9 -0
  66. data/lib/tdriver-devtools/doc/feature_xml/qt_widget_tap.feature.xml +9 -0
  67. data/lib/tdriver-devtools/doc/generate.rb +892 -0
  68. data/lib/tdriver-devtools/doc/update +1 -0
  69. data/lib/tdriver-devtools/doc/xslt/html.rb +7 -0
  70. data/lib/tdriver-devtools/doc/xslt/template.xsl +1861 -0
  71. data/lib/tdriver-devtools/doc/xslt/update +3 -0
  72. data/lib/tdriver-devtools/plugin/placeholder.txt +1 -0
  73. data/lib/tdriver-devtools/tdriver-devtools.rb +404 -0
  74. data/lib/tdriver-devtools/tests/feature_tests/example/flick-example.rb +233 -0
  75. data/lib/tdriver-devtools/tests/feature_tests/example/impl.rb +194 -0
  76. data/lib/tdriver-devtools/tests/feature_tests/generate.rb +82 -0
  77. data/lib/tdriver-devtools/tests/feature_tests/lib/custom_rdoc_generator.rb +468 -0
  78. data/lib/tdriver-devtools/tests/feature_tests/templates/feature_attribute.template +5 -0
  79. data/lib/tdriver-devtools/tests/feature_tests/templates/feature_method.template +5 -0
  80. data/lib/tdriver-devtools/tests/feature_tests/templates/scenario_attribute.template +5 -0
  81. data/lib/tdriver-devtools/tests/feature_tests/templates/scenario_method.template +5 -0
  82. data/lib/tdriver-devtools/tests/feature_tests/update +3 -0
  83. data/lib/tdriver.rb +26 -0
  84. data/lib/tdriver/base/behaviour/behaviour.rb +32 -0
  85. data/lib/tdriver/base/behaviour/behaviours/object_behaviour_composition.rb +94 -0
  86. data/lib/tdriver/base/behaviour/behaviours/object_behaviour_description.rb +262 -0
  87. data/lib/tdriver/base/behaviour/behaviours/object_composition.rb +111 -0
  88. data/lib/tdriver/base/behaviour/factory.rb +380 -0
  89. data/lib/tdriver/base/behaviour/loader.rb +28 -0
  90. data/lib/tdriver/base/command_data/command_data.rb +51 -0
  91. data/lib/tdriver/base/command_data/loader.rb +25 -0
  92. data/lib/tdriver/base/errors.rb +131 -0
  93. data/lib/tdriver/base/loader.rb +38 -0
  94. data/lib/tdriver/base/state_object.rb +270 -0
  95. data/lib/tdriver/base/sut/adapter.rb +28 -0
  96. data/lib/tdriver/base/sut/controller.rb +119 -0
  97. data/lib/tdriver/base/sut/factory.rb +287 -0
  98. data/lib/tdriver/base/sut/generic/behaviours/application.rb +243 -0
  99. data/lib/tdriver/base/sut/generic/behaviours/controller.rb +67 -0
  100. data/lib/tdriver/base/sut/generic/behaviours/find.rb +96 -0
  101. data/lib/tdriver/base/sut/generic/behaviours/flash_behaviour.rb +346 -0
  102. data/lib/tdriver/base/sut/generic/behaviours/sut.rb +1268 -0
  103. data/lib/tdriver/base/sut/generic/behaviours/switchbox_behaviour.rb +182 -0
  104. data/lib/tdriver/base/sut/generic/behaviours/verification.rb +119 -0
  105. data/lib/tdriver/base/sut/generic/commands/application.rb +219 -0
  106. data/lib/tdriver/base/sut/generic/commands/key_sequence.rb +82 -0
  107. data/lib/tdriver/base/sut/generic/commands/screen_capture.rb +58 -0
  108. data/lib/tdriver/base/sut/generic/plugin.rb +96 -0
  109. data/lib/tdriver/base/sut/loader.rb +35 -0
  110. data/lib/tdriver/base/sut/sut.rb +67 -0
  111. data/lib/tdriver/base/test_object/abstract.rb +179 -0
  112. data/lib/tdriver/base/test_object/behaviours/syncronization.rb +94 -0
  113. data/lib/tdriver/base/test_object/behaviours/test_object.rb +787 -0
  114. data/lib/tdriver/base/test_object/factory.rb +618 -0
  115. data/lib/tdriver/base/test_object/identificator.rb +511 -0
  116. data/lib/tdriver/base/test_object/loader.rb +37 -0
  117. data/lib/tdriver/env.rb +21 -0
  118. data/lib/tdriver/loader.rb +36 -0
  119. data/lib/tdriver/matti.rb +35 -0
  120. data/lib/tdriver/report/error_recovery/tdriver_custom_error_recovery.rb +83 -0
  121. data/lib/tdriver/report/error_recovery/tdriver_error_recovery.rb +158 -0
  122. data/lib/tdriver/report/error_recovery/tdriver_error_recovery_settings.rb +98 -0
  123. data/lib/tdriver/report/report.rb +47 -0
  124. data/lib/tdriver/report/report_api.rb +207 -0
  125. data/lib/tdriver/report/report_combine.rb +86 -0
  126. data/lib/tdriver/report/report_crash_file_capture.rb +167 -0
  127. data/lib/tdriver/report/report_creator.rb +571 -0
  128. data/lib/tdriver/report/report_cucumber.rb +158 -0
  129. data/lib/tdriver/report/report_cucumber_listener.rb +337 -0
  130. data/lib/tdriver/report/report_cucumber_reporter.rb +335 -0
  131. data/lib/tdriver/report/report_data_presentation.rb +152 -0
  132. data/lib/tdriver/report/report_data_table.rb +64 -0
  133. data/lib/tdriver/report/report_execution_statistics.rb +284 -0
  134. data/lib/tdriver/report/report_file_capture.rb +159 -0
  135. data/lib/tdriver/report/report_grouping.rb +539 -0
  136. data/lib/tdriver/report/report_junit_xml.rb +147 -0
  137. data/lib/tdriver/report/report_rspec.rb +108 -0
  138. data/lib/tdriver/report/report_test_case_run.rb +621 -0
  139. data/lib/tdriver/report/report_test_run.rb +1286 -0
  140. data/lib/tdriver/report/report_test_unit.rb +175 -0
  141. data/lib/tdriver/report/report_writer.rb +1405 -0
  142. data/lib/tdriver/tdriver.rb +158 -0
  143. data/lib/tdriver/util/common.rb +24 -0
  144. data/lib/tdriver/util/common/array.rb +39 -0
  145. data/lib/tdriver/util/common/crc16.rb +100 -0
  146. data/lib/tdriver/util/common/environment.rb +153 -0
  147. data/lib/tdriver/util/common/error.rb +39 -0
  148. data/lib/tdriver/util/common/file.rb +315 -0
  149. data/lib/tdriver/util/common/gem.rb +108 -0
  150. data/lib/tdriver/util/common/kernel.rb +189 -0
  151. data/lib/tdriver/util/common/loader.rb +39 -0
  152. data/lib/tdriver/util/common/retryable.rb +98 -0
  153. data/lib/tdriver/util/common/string.rb +77 -0
  154. data/lib/tdriver/util/dbaccess/dbaccess.rb +188 -0
  155. data/lib/tdriver/util/dbaccess/dbconnection.rb +41 -0
  156. data/lib/tdriver/util/dbaccess/error.rb +35 -0
  157. data/lib/tdriver/util/dbaccess/loader.rb +29 -0
  158. data/lib/tdriver/util/dynamic_attribute_filter.rb +182 -0
  159. data/lib/tdriver/util/hooking.rb +434 -0
  160. data/lib/tdriver/util/loader.rb +65 -0
  161. data/lib/tdriver/util/localisation.rb +24 -0
  162. data/lib/tdriver/util/localisation/error.rb +32 -0
  163. data/lib/tdriver/util/localisation/loader.rb +28 -0
  164. data/lib/tdriver/util/localisation/localisation.rb +479 -0
  165. data/lib/tdriver/util/logger.rb +377 -0
  166. data/lib/tdriver/util/operator_data/error.rb +29 -0
  167. data/lib/tdriver/util/operator_data/loader.rb +26 -0
  168. data/lib/tdriver/util/operator_data/operator_data.rb +93 -0
  169. data/lib/tdriver/util/other/config.rb +221 -0
  170. data/lib/tdriver/util/parameter.rb +24 -0
  171. data/lib/tdriver/util/parameter/error.rb +45 -0
  172. data/lib/tdriver/util/parameter/loader.rb +37 -0
  173. data/lib/tdriver/util/parameter/parameter.rb +285 -0
  174. data/lib/tdriver/util/parameter/parameter_hash.rb +101 -0
  175. data/lib/tdriver/util/parameter/parameter_template.rb +120 -0
  176. data/lib/tdriver/util/parameter/parameter_user_api.rb +84 -0
  177. data/lib/tdriver/util/parameter/parameter_xml.rb +247 -0
  178. data/lib/tdriver/util/plugin/abstract.rb +60 -0
  179. data/lib/tdriver/util/plugin/error.rb +25 -0
  180. data/lib/tdriver/util/plugin/loader.rb +28 -0
  181. data/lib/tdriver/util/plugin/service.rb +200 -0
  182. data/lib/tdriver/util/recorder.rb +292 -0
  183. data/lib/tdriver/util/stats.rb +90 -0
  184. data/lib/tdriver/util/user_data/error.rb +29 -0
  185. data/lib/tdriver/util/user_data/loader.rb +26 -0
  186. data/lib/tdriver/util/user_data/user_data.rb +103 -0
  187. data/lib/tdriver/util/video_rec.rb +264 -0
  188. data/lib/tdriver/util/xml/abstraction.rb +47 -0
  189. data/lib/tdriver/util/xml/builder.rb +54 -0
  190. data/lib/tdriver/util/xml/document.rb +32 -0
  191. data/lib/tdriver/util/xml/element.rb +32 -0
  192. data/lib/tdriver/util/xml/error.rb +46 -0
  193. data/lib/tdriver/util/xml/loader.rb +46 -0
  194. data/lib/tdriver/util/xml/nil_element.rb +89 -0
  195. data/lib/tdriver/util/xml/nodeset.rb +32 -0
  196. data/lib/tdriver/util/xml/parsers/libxml/libxml.rb +140 -0
  197. data/lib/tdriver/util/xml/parsers/loader.rb +22 -0
  198. data/lib/tdriver/util/xml/parsers/nokogiri/abstraction.rb +111 -0
  199. data/lib/tdriver/util/xml/parsers/nokogiri/attribute.rb +54 -0
  200. data/lib/tdriver/util/xml/parsers/nokogiri/builder.rb +58 -0
  201. data/lib/tdriver/util/xml/parsers/nokogiri/document.rb +58 -0
  202. data/lib/tdriver/util/xml/parsers/nokogiri/element.rb +147 -0
  203. data/lib/tdriver/util/xml/parsers/nokogiri/loader.rb +42 -0
  204. data/lib/tdriver/util/xml/parsers/nokogiri/nodeset.rb +187 -0
  205. data/lib/tdriver/util/xml/xml.rb +170 -0
  206. data/lib/tdriver/verify/verify.rb +687 -0
  207. data/lib/tdriver/verify/verify.rb_org +630 -0
  208. data/lib/tdriver/version.rb +21 -0
  209. data/xml/behaviours/generic.xml +495 -0
  210. data/xml/defaults/generic.xml +97 -0
  211. data/xml/defaults/sut_generic.xml +36 -0
  212. data/xml/parameters/tdriver_parameters.xml +23 -0
  213. data/xml/templates/generic.xml +227 -0
  214. metadata +327 -0
@@ -0,0 +1,571 @@
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
+
23
+ module TDriverReportCreator
24
+ include TDriverErrorRecovery
25
+ include TDriverCustomErrorRecovery
26
+
27
+ #This method initializes new test run
28
+ #
29
+ # === params
30
+ # nil
31
+ # === returns
32
+ # nil
33
+ # === raises
34
+ def start_run()
35
+
36
+ @_video_file_name = "failed_test.avi"
37
+ @_previous_video_file_name = "previous_test.avi"
38
+ clean_video_files
39
+
40
+ if $tdriver_reporter == nil
41
+ initialize_error_recovery
42
+ $run_status_thread_active=false
43
+ $test_case_run_index=0
44
+ $tdriver_reporter=TestRun.new
45
+ $tdriver_reporter.initialize_tdriver_report_folder()
46
+ $tdriver_report_created=false
47
+ $current_tdriver_report_folder=$tdriver_reporter.report_folder
48
+
49
+ $new_junit_xml_results=ReportJUnitXml.new($current_tdriver_report_folder)
50
+ $tdriver_reporter.set_end_time(Time.now)
51
+ $tdriver_reporter.set_total_failed(0)
52
+ $tdriver_reporter.set_total_passed(0)
53
+ $tdriver_reporter.set_total_not_run(0)
54
+ $tdriver_reporter.set_total_run(0)
55
+ $tdriver_reporter.update_summary_page('inprogress')
56
+ $tdriver_reporter.update_environment_page()
57
+ at_exit {
58
+ while $run_status_thread_active == true
59
+ sleep 1
60
+ end
61
+ puts 'Generating report summary...'
62
+ $tdriver_reporter.update_summary_page('finished')
63
+ $tdriver_reporter.update_test_case_summary_pages('all')
64
+ $tdriver_reporter.update_test_case_summary_pages('passed')
65
+ $tdriver_reporter.update_test_case_summary_pages('failed')
66
+ $tdriver_reporter.update_test_case_summary_pages('not run')
67
+ $tdriver_reporter.update_test_case_summary_pages('statistics')
68
+ $tdriver_reporter.create_csv if MobyUtil::Parameter[ :create_run_table_csv, false ]=='true'
69
+ $new_junit_xml_results.create_junit_xml()
70
+ #$tdriver_reporter.delete_result_storage()
71
+ $tdriver_reporter.disconnect_connected_devices()
72
+ #tdriver_log_page $tdriver_reporter.update_tdriver_log_page()
73
+ puts 'Report generated to:'
74
+ puts $tdriver_reporter.report_folder()
75
+ clean_video_files
76
+ ending_test_set_run if MobyUtil::Parameter[ :custom_error_recovery_module, nil ]!=nil
77
+ if $tdriver_reporter.total_failed.to_i > 0
78
+ Kernel.exit(1)
79
+ elsif $tdriver_reporter.total_run.to_i == 0
80
+ Kernel.exit(1)
81
+ elsif $tdriver_reporter.total_not_run.to_i > 0
82
+ Kernel.exit(1)
83
+ end
84
+ }
85
+ else
86
+ initialize_error_recovery
87
+ end
88
+ starting_test_set_run if MobyUtil::Parameter[ :custom_error_recovery_module, nil ]!=nil
89
+ end
90
+ #This method registers a connection error
91
+ #
92
+ # === params
93
+ # status: last test case result
94
+ # === returns
95
+ # nil
96
+ # === raises
97
+ def error_in_connection_detected
98
+ $tdriver_reporter.set_total_device_resets(1)
99
+ $new_test_case.set_test_case_reboots(1) if $new_test_case!=nil
100
+ error_in_connection
101
+ end
102
+ #This method returns the group where the test case belongs
103
+ #
104
+ # === params
105
+ # status: last test case result
106
+ # === returns
107
+ # nil
108
+ # === raises
109
+ def extract_group_from_test_case_name(test_case_name)
110
+ found_in_group='not_in_any_user_defined_group'
111
+ groups=MobyUtil::Parameter[ :report_groups, nil ]
112
+ unless groups == nil
113
+ groups_ar=groups.split('|')
114
+ groups_ar.each do |group|
115
+ group_ar=group.split(':')
116
+ group_ar.each do |group_name|
117
+ found_in_group=group_name if test_case_name.include? group_name
118
+ end
119
+ end
120
+ else
121
+ found_in_group=$new_test_case.test_case_group
122
+ end
123
+ found_in_group
124
+ end
125
+ #This method updates the current test run status
126
+ #
127
+ # === params
128
+ # status: last test case result
129
+ # === returns
130
+ # nil
131
+ # === raises
132
+ def update_run(test_case_name,status,reboots,crashes,execution_log)
133
+ group=extract_group_from_test_case_name($new_test_case.test_case_name_full)
134
+ current_status=''
135
+ if(status=='failed')
136
+ current_status=$tdriver_reporter.fail_statuses.first
137
+ $tdriver_reporter.set_total_failed(1)
138
+ end
139
+ if(status=='passed')
140
+ current_status=$tdriver_reporter.pass_statuses.first
141
+ $tdriver_reporter.set_total_passed(1)
142
+ end
143
+ if(status!='passed' && status!='failed')
144
+
145
+ current_status=$tdriver_reporter.not_run_statuses.first
146
+ $tdriver_reporter.set_total_not_run(1)
147
+ end
148
+
149
+ $tdriver_reporter.write_to_result_storage(current_status,test_case_name,group,reboots,crashes,
150
+ $new_test_case.test_case_start_time,
151
+ $new_test_case.test_case_chronological_view_data,
152
+ $new_test_case.test_case_run_time,
153
+ $new_test_case.tc_memory_amount_end,
154
+ $new_test_case.test_case_index,
155
+ execution_log,
156
+ '',
157
+ '',
158
+ $new_test_case.test_case_total_dump_count,
159
+ $new_test_case.test_case_total_data_sent,
160
+ $new_test_case.test_case_total_data_received
161
+ )
162
+
163
+ $tdriver_reporter.set_end_time(Time.now)
164
+ $tdriver_reporter.set_total_run(1)
165
+ $tdriver_reporter.update_summary_page('inprogress')
166
+ $tdriver_reporter.update_environment_page()
167
+ if MobyUtil::Parameter[ :realtime_status_page_update, false ]=='true'
168
+ if $run_status_thread_active == false
169
+ $run_status_thread_active=true
170
+ Thread.new do
171
+ begin
172
+ $tdriver_reporter.update_test_case_summary_pages('all')
173
+ $tdriver_reporter.update_test_case_summary_pages('passed')
174
+ $tdriver_reporter.update_test_case_summary_pages('failed')
175
+ $tdriver_reporter.update_test_case_summary_pages('not run')
176
+ $tdriver_reporter.update_test_case_summary_pages('statistics')
177
+ $new_junit_xml_results.create_junit_xml()
178
+ #tdriver_log_page $tdriver_reporter.update_tdriver_log_page()
179
+ #ML: Update summary every 10 seconds improves performance during execution
180
+ sleep 10
181
+ $run_status_thread_active=false
182
+ GC.start
183
+ rescue Exception => e
184
+ $run_status_thread_active=false
185
+ end
186
+ end
187
+ end
188
+ end
189
+ end
190
+
191
+
192
+ #This method updates the current test case user data
193
+ #
194
+ # === params
195
+ #
196
+ # === returns
197
+ # nil
198
+ # === raises
199
+ def update_test_case_user_data()
200
+ if $new_test_case != nil
201
+ user_data_rows, user_data_cols=$tdriver_reporter.get_user_data
202
+ $new_test_case.set_test_case_user_data(user_data_rows, user_data_cols)
203
+ chronological_data_rows=$tdriver_reporter.test_case_user_chronological_table_data
204
+ $new_test_case.set_test_case_chronological_view_data(chronological_data_rows)
205
+ $tdriver_reporter.set_user_data(nil)
206
+ $tdriver_reporter.set_user_chronological_table_data(nil)
207
+ end
208
+ end
209
+
210
+ #This method starts a new test case run
211
+ #
212
+ # === params
213
+ # test_case: the new test case name
214
+ # === returns
215
+ # nil
216
+ # === raises
217
+ def start_test_case(test_case)
218
+ if $new_test_case!=nil
219
+ if $new_test_case.test_case_ended==false
220
+ end_test_case($new_test_case.test_case_name,@tc_status)
221
+ end
222
+ end
223
+ $test_case_run_index=$test_case_run_index.to_i+1
224
+ $new_test_case=TestCaseRun.new
225
+ $new_test_case.set_test_cases_folder($current_tdriver_report_folder.to_s+'/cases')
226
+ $new_test_case.set_test_case_name(test_case.to_s)
227
+ $new_test_case.set_test_case_start_time(Time.now)
228
+ $new_test_case.set_test_case_index($test_case_run_index.to_i)
229
+ $new_test_case.test_case_dump_count_at_start=$tdriver_reporter.total_dump_count.clone
230
+ $new_test_case.test_case_data_sent_at_start=$tdriver_reporter.total_sent_data.clone
231
+ $new_test_case.test_case_data_received_at_start=$tdriver_reporter.total_received_data.clone
232
+
233
+ create_test_case_folder('result')
234
+ begin
235
+ if start_error_recovery()==true
236
+ $tdriver_reporter.set_total_device_resets(1)
237
+ $new_test_case.set_test_case_reboots(1)
238
+ end
239
+ rescue Exception => e
240
+ update_test_case("Error recovery failed Exception: #{e.message} Backtrace: #{e.backtrace}")
241
+ end_test_case($new_test_case.test_case_name,'failed')
242
+ exit(1)
243
+ end
244
+ $new_test_case.read_crash_monitor_settings()
245
+ $new_test_case.read_file_monitor_settings()
246
+
247
+ amount_of_crash_files=$new_test_case.check_if_crash_files_exist()
248
+ if amount_of_crash_files.to_i > 0
249
+ $new_test_case.capture_crash_files()
250
+ $new_test_case.clean_crash_files_from_sut()
251
+ $tdriver_reporter.set_total_crash_files(amount_of_crash_files.to_i)
252
+ $new_test_case.set_test_case_crash_files(amount_of_crash_files.to_i)
253
+ end
254
+
255
+ amount_of_files=$new_test_case.check_if_files_exist()
256
+ if amount_of_files.to_i > 0
257
+ $new_test_case.capture_files()
258
+ $new_test_case.clean_files_from_sut()
259
+ $tdriver_reporter.set_total_crash_files(amount_of_files.to_i)
260
+ $new_test_case.set_test_case_crash_files(amount_of_files.to_i)
261
+ end
262
+
263
+ if MobyUtil::Parameter[ :report_monitor_memory, 'false']=='true'
264
+ begin
265
+ MobyBase::SUTFactory.instance.connected_suts.each do |sut_id, sut_attributes|
266
+ $new_test_case.set_tc_memory_amount_total($tdriver_reporter.get_sut_total_memory(sut_id,sut_attributes))
267
+ $new_test_case.set_tc_memory_amount_start($tdriver_reporter.get_sut_used_memory(sut_id,sut_attributes))
268
+ end
269
+ rescue
270
+ $new_test_case.set_tc_memory_amount_total(0)
271
+ $new_test_case.set_tc_memory_amount_start(0)
272
+ end
273
+ end
274
+ logging_enabled = MobyUtil::Logger.instance.enabled
275
+ begin
276
+
277
+ if MobyUtil::Parameter[:report_video, "false"] != "false"
278
+ # copy previous recording
279
+ MobyUtil::Logger.instance.enabled=false
280
+
281
+ each_video_device do | video_device, device_index |
282
+ begin
283
+ File.copy( "cam_" + device_index + "_" + @_video_file_name, "cam_" + device_index + "_" + @_previous_video_file_name )
284
+ rescue
285
+ # do nothing..
286
+ end
287
+
288
+ end
289
+ $new_test_case.start_video_recording( @_video_file_name, @_previous_video_file_name )
290
+
291
+ MobyUtil::Logger.instance.enabled=logging_enabled
292
+
293
+ end
294
+ rescue Exception => e
295
+
296
+ ensure
297
+ MobyUtil::Logger.instance.enabled=logging_enabled
298
+ end
299
+ update_test_case_user_data()
300
+ starting_test_case(test_case, MobyBase::SUTFactory.instance.connected_suts) if MobyUtil::Parameter[ :custom_error_recovery_module, nil ]!=nil
301
+ end
302
+ #This method updates the current test case execution log
303
+ #
304
+ # === params
305
+ # details: details to be added in to the execution log
306
+ # === returns
307
+ # nil
308
+ # === raises
309
+ def update_test_case(details)
310
+ $new_test_case.set_test_case_execution_log(details)
311
+ updating_test_case_details(details) if MobyUtil::Parameter[ :custom_error_recovery_module, nil ]!=nil
312
+ if MobyUtil::Parameter[ :report_monitor_memory, 'false']=='true'
313
+ begin
314
+ start_memory=$new_test_case.tc_memory_amount_start()
315
+ if start_memory=='-'
316
+ MobyBase::SUTFactory.instance.connected_suts.each do |sut_id, sut_attributes|
317
+ memory=$tdriver_reporter.get_sut_used_memory(sut_id,sut_attributes)
318
+ $new_test_case.set_tc_memory_amount_start(memory)
319
+ end
320
+ end
321
+ rescue
322
+ $new_test_case.set_tc_memory_amount_start(0)
323
+ end
324
+ end
325
+ end
326
+
327
+
328
+ #This method creates or renames the test case folder
329
+ #
330
+ # === params
331
+ # test_case: the test case name
332
+ # status: status of the test case
333
+ # === returns
334
+ # nil
335
+ # === raises
336
+ def create_test_case_folder(status)
337
+ if $new_test_case!=nil
338
+ if $new_test_case.test_case_folder==nil
339
+ $new_test_case.create_test_case_folder(status)
340
+ else
341
+ $new_test_case.rename_test_case_folder(status)
342
+ end
343
+ end
344
+ end
345
+
346
+ #This method takes a screenshot of current test case execution
347
+ #
348
+ # === params
349
+ # === returns
350
+ # nil
351
+ # === raises
352
+ def capture_screen_test_case()
353
+ create_test_case_folder($tdriver_reporter.fail_statuses.first)
354
+ $new_test_case.capture_dump()
355
+ if $new_test_case.video_recording?
356
+ $new_test_case.copy_video_capture()
357
+ end
358
+ error_in_test_case(MobyBase::SUTFactory.instance.connected_suts) if MobyUtil::Parameter[ :custom_error_recovery_module, nil ]!=nil
359
+ begin
360
+ if start_error_recovery()==true
361
+ error_in_connection_detected
362
+ end
363
+ rescue Exception => e
364
+ update_test_case("Error recovery failed Exception: #{e.message} Backtrace: #{e.backtrace}")
365
+ end_test_case($new_test_case.test_case_name,'failed')
366
+ exit(1)
367
+ end
368
+ end
369
+ #This updates the test case behaviour log
370
+ #
371
+ # === params
372
+ # === returns
373
+ # nil
374
+ # === raises
375
+ def update_test_case_memory_usage()
376
+ begin
377
+ MobyBase::SUTFactory.instance.connected_suts.each do |sut_id, sut_attributes|
378
+ if sut_attributes[:is_connected]
379
+ memory=$tdriver_reporter.get_sut_used_memory(sut_id,sut_attributes)
380
+ $tdriver_reporter.get_sut_total_dump_count(sut_id,sut_attributes)
381
+ $tdriver_reporter.get_sut_total_sent_data(sut_id,sut_attributes)
382
+ $tdriver_reporter.get_sut_total_received_data(sut_id,sut_attributes)
383
+ $new_test_case.set_tc_memory_amount_end(memory)
384
+ $tdriver_reporter.set_memory_amount_end(memory)
385
+ end
386
+ end
387
+ rescue
388
+ $new_test_case.set_tc_memory_amount_end(0)
389
+ end
390
+ end
391
+ #This updates the test case behaviour log
392
+ #
393
+ # === params
394
+ # === returns
395
+ # nil
396
+ # === raises
397
+ def update_test_case_behaviour_log()
398
+ begin
399
+ if MobyUtil::Parameter[:behaviour_logging] == 'true'
400
+ if $new_test_case.test_case_logging_level.to_i > 0
401
+ $tdriver_report_log_output.string.each do |line|
402
+ $new_test_case.set_test_case_behaviour_log(line,nil)
403
+ #tdriver_log_page $tdriver_reporter.set_test_run_behaviour_log(line,full_tc_name)
404
+ end
405
+ end
406
+ end
407
+ rescue
408
+ end
409
+ end
410
+
411
+ def calculate_execution_footprint_data_for_test_case
412
+ MobyBase::SUTFactory.instance.connected_suts.each do |sut_id, sut_attributes|
413
+ if sut_attributes[:is_connected]
414
+ $tdriver_reporter.get_sut_total_dump_count(sut_id,sut_attributes)
415
+ $tdriver_reporter.get_sut_total_sent_data(sut_id,sut_attributes)
416
+ $tdriver_reporter.get_sut_total_received_data(sut_id,sut_attributes)
417
+ end
418
+ end
419
+
420
+ $new_test_case.test_case_dump_count_at_end=$tdriver_reporter.total_dump_count
421
+ $new_test_case.test_case_dump_count_at_end.each do |item|
422
+ at_start=$new_test_case.test_case_dump_count_at_start[item[0]].to_i
423
+ at_start=0 if at_start==nil
424
+ at_end=item[1].to_i
425
+ total=at_end-at_start
426
+ $new_test_case.test_case_total_dump_count[item[0]]=total
427
+ end
428
+
429
+ $new_test_case.test_case_data_sent_at_end=$tdriver_reporter.total_sent_data
430
+ $new_test_case.test_case_data_sent_at_end.each do |item|
431
+ at_start=$new_test_case.test_case_data_sent_at_start[item[0]].to_i
432
+ at_start=0 if at_start==nil
433
+ at_end=item[1].to_i
434
+ total=at_end-at_start
435
+ $new_test_case.test_case_total_data_sent[item[0]]=total
436
+ end
437
+
438
+ $new_test_case.test_case_data_received_at_end=$tdriver_reporter.total_received_data
439
+ $new_test_case.test_case_data_received_at_end.each do |item|
440
+ at_start=$new_test_case.test_case_data_received_at_start[item[0]].to_i
441
+ at_start=0 if at_start==nil
442
+ at_end=item[1].to_i
443
+ total=at_end-at_start
444
+ $new_test_case.test_case_total_data_received[item[0]]=total
445
+ end
446
+
447
+ end
448
+
449
+ #This method ends the current test case execution
450
+ #
451
+ # === params
452
+ # test_case: the test case name
453
+ # status: status of the test case
454
+ # === returns
455
+ # nil
456
+ # === raises
457
+ def end_test_case(test_case,status)
458
+ $new_test_case.set_test_case_ended(true) if $new_test_case
459
+ update_test_case_user_data()
460
+ if $new_test_case != nil
461
+ calculate_execution_footprint_data_for_test_case
462
+ if MobyUtil::Parameter[:report_crash_file_monitor] == 'true'
463
+ found_crash_files = $new_test_case.check_if_crash_files_exist()
464
+ if found_crash_files.to_i > 0
465
+ $tdriver_reporter.set_total_crash_files(found_crash_files.to_i)
466
+ $new_test_case.set_test_case_crash_files(found_crash_files.to_i)
467
+ status='failed'
468
+ end
469
+ end
470
+ if MobyUtil::Parameter[:report_file_monitor] == 'true'
471
+ found_files = $new_test_case.check_if_files_exist()
472
+ if found_files.to_i > 0
473
+ $tdriver_reporter.set_total_crash_files(found_files.to_i)
474
+ $new_test_case.set_test_case_crash_files(found_files.to_i)
475
+ status='failed' if MobyUtil::Parameter[:report_fail_test_if_files_found]=='true'
476
+ end
477
+ end
478
+ if $new_test_case.video_recording?
479
+ $new_test_case.stop_video_recording
480
+ end
481
+ if $tdriver_reporter.test_case_user_defined_status!=nil
482
+ status=$tdriver_reporter.test_case_user_defined_status
483
+ $tdriver_reporter.set_test_case_user_defined_status(nil)
484
+ end
485
+ if(status=='failed')
486
+ $new_test_case.set_test_case_status($tdriver_reporter.fail_statuses.first)
487
+ create_test_case_folder($tdriver_reporter.fail_statuses.first)
488
+ if found_crash_files.to_i > 0
489
+ $new_test_case.capture_crash_files()
490
+ end
491
+ end
492
+ if(status=='passed')
493
+ $new_test_case.set_test_case_status($tdriver_reporter.pass_statuses.first)
494
+ create_test_case_folder($tdriver_reporter.pass_statuses.first)
495
+ end
496
+ if(status!='passed' && status!='failed')
497
+ $new_test_case.set_test_case_status($tdriver_reporter.not_run_statuses.first)
498
+ create_test_case_folder($tdriver_reporter.not_run_statuses.first)
499
+ end
500
+ $new_test_case.set_test_case_end_time(Time.now)
501
+ update_test_case_behaviour_log()
502
+ update_test_case_memory_usage() if MobyUtil::Parameter[ :report_monitor_memory, 'false']=='true'
503
+ execution_log=$new_test_case.test_case_execution_log
504
+ if MobyUtil::Parameter[:report_trace_capture_only_in_failed_case, 'true']!='true'
505
+ $new_test_case.capture_trace_files()
506
+ else
507
+ if status=='failed'
508
+ $new_test_case.capture_trace_files()
509
+ end
510
+ end
511
+ if found_files.to_i > 0
512
+ $new_test_case.capture_files()
513
+ end
514
+ $new_test_case.update_test_case_page()
515
+ $new_test_case.clean_crash_files_from_sut()
516
+ $new_test_case.clean_files_from_sut()
517
+
518
+ update_run($new_test_case.test_case_name.to_s,status,$new_test_case.test_case_reboots,$new_test_case.test_case_crash_files,execution_log)
519
+ $new_junit_xml_results.add_test_result(status, $new_test_case.test_case_start_time, $new_test_case.test_case_end_time)
520
+
521
+ $new_test_case=nil
522
+ execution_log=nil
523
+
524
+ end
525
+ ending_test_case(status, MobyBase::SUTFactory.instance.connected_suts) if MobyUtil::Parameter[ :custom_error_recovery_module, nil ]!=nil
526
+ end
527
+ def add_report_group(value)
528
+ $tdriver_reporter.set_generic_reporting_groups(value)
529
+ end
530
+ def add_test_case_group(value)
531
+ $new_test_case.set_test_case_group(value)
532
+ end
533
+
534
+ # Cleans any temporary files created by recording video
535
+ def clean_video_files
536
+ [ @_video_file_name, @_previous_video_file_name ].each do | file_name |
537
+
538
+ each_video_device do | video_device, device_index |
539
+ begin
540
+ delete_file = "cam_" + device_index + "_" + file_name
541
+ if File.exists?( delete_file )
542
+ File.delete( delete_file )
543
+ end
544
+ rescue
545
+ # delete failed, do nothing
546
+ end
547
+ end
548
+ end
549
+ end
550
+
551
+ def each_video_device
552
+
553
+ if MobyUtil::Parameter[:report_video, nil] != nil
554
+
555
+ device_index = 0
556
+ MobyUtil::Parameter[:report_video].split("|").each do | video_device |
557
+ if !video_device.strip.empty?
558
+ yield video_device.strip, device_index.to_s
559
+ device_index += 1
560
+ end
561
+ end
562
+
563
+ end
564
+
565
+ end
566
+
567
+ end #TDriverReportCreator
568
+
569
+
570
+
571
+