testability-driver 0.9.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README +1 -0
- data/bin/start_app_perf +199 -0
- data/bin/tdriver-devtools +3 -0
- data/config/sut_parameters.rb +39 -0
- data/ext/extconf.rb +67 -0
- data/ext/native_extensions.c +70 -0
- data/lib/matti.rb +30 -0
- data/lib/tdriver-devtools/behaviour/old/xml/example/flick-example.rb +223 -0
- data/lib/tdriver-devtools/behaviour/old/xml/example/impl.rb_invalid +194 -0
- data/lib/tdriver-devtools/behaviour/old/xml/generate_behaviour_xml.rb +95 -0
- data/lib/tdriver-devtools/behaviour/old/xml/lib/tdriver_generator.rb +722 -0
- data/lib/tdriver-devtools/behaviour/old/xml/qdoc_generator.rb +321 -0
- data/lib/tdriver-devtools/behaviour/old/xml/templates/behaviour.method.template +43 -0
- data/lib/tdriver-devtools/behaviour/old/xml/templates/behaviour.module.template +54 -0
- data/lib/tdriver-devtools/behaviour/old/xml/templates/behaviour.xml.argument.template +7 -0
- data/lib/tdriver-devtools/behaviour/old/xml/templates/behaviour.xml.argument_type.template +7 -0
- data/lib/tdriver-devtools/behaviour/old/xml/templates/behaviour.xml.exception.template +5 -0
- data/lib/tdriver-devtools/behaviour/old/xml/templates/behaviour.xml.howto.line.template +2 -0
- data/lib/tdriver-devtools/behaviour/old/xml/templates/behaviour.xml.howto.template +5 -0
- data/lib/tdriver-devtools/behaviour/old/xml/templates/behaviour.xml.method.template +23 -0
- data/lib/tdriver-devtools/behaviour/old/xml/templates/behaviour.xml.template +14 -0
- data/lib/tdriver-devtools/behaviour/old/xml/update +3 -0
- data/lib/tdriver-devtools/behaviour/xml/generate.rb +88 -0
- data/lib/tdriver-devtools/behaviour/xml/rdoc_behaviour_xml_generator.rb +1924 -0
- data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.argument.default.template +1 -0
- data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.argument.template +3 -0
- data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.argument_type.template +4 -0
- data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.exception.template +4 -0
- data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.method.arguments.template +4 -0
- data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.method.deprecated.template +3 -0
- data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.method.exceptions.template +3 -0
- data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.method.info.template +1 -0
- data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.method.returns.template +3 -0
- data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.method.tables.template +3 -0
- data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.method.template +12 -0
- data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.returns.template +5 -0
- data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.table.item.template +1 -0
- data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.table.row.template +2 -0
- data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.table.template +8 -0
- data/lib/tdriver-devtools/behaviour/xml/templates/behaviour.xml.template +14 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/example/flick-example.rb +245 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/example/sut.rb +964 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/generate.rb +68 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/lib/custom_rdoc_generator.rb +1865 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.argument.default.template +1 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.argument.template +3 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.argument_type.template +4 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.exception.template +4 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.method.arguments.template +4 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.method.deprecated.template +3 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.method.exceptions.template +3 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.method.info.template +1 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.method.returns.template +3 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.method.tables.template +3 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.method.template +12 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.returns.template +5 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.table.item.template +1 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.table.row.template +2 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.table.template +7 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.template +14 -0
- data/lib/tdriver-devtools/behaviour/xml_generator/update +3 -0
- data/lib/tdriver-devtools/doc/behaviour_xml/QtExampleGestureBehaviour.xml +138 -0
- data/lib/tdriver-devtools/doc/behaviour_xml/created.rid +1 -0
- data/lib/tdriver-devtools/doc/behaviour_xml/tdriver.hash +1 -0
- data/lib/tdriver-devtools/doc/feature_xml/qt_widget_hold.feature.xml +9 -0
- data/lib/tdriver-devtools/doc/feature_xml/qt_widget_tap.feature.xml +9 -0
- data/lib/tdriver-devtools/doc/generate.rb +892 -0
- data/lib/tdriver-devtools/doc/update +1 -0
- data/lib/tdriver-devtools/doc/xslt/html.rb +7 -0
- data/lib/tdriver-devtools/doc/xslt/template.xsl +1861 -0
- data/lib/tdriver-devtools/doc/xslt/update +3 -0
- data/lib/tdriver-devtools/plugin/placeholder.txt +1 -0
- data/lib/tdriver-devtools/tdriver-devtools.rb +404 -0
- data/lib/tdriver-devtools/tests/feature_tests/example/flick-example.rb +233 -0
- data/lib/tdriver-devtools/tests/feature_tests/example/impl.rb +194 -0
- data/lib/tdriver-devtools/tests/feature_tests/generate.rb +82 -0
- data/lib/tdriver-devtools/tests/feature_tests/lib/custom_rdoc_generator.rb +468 -0
- data/lib/tdriver-devtools/tests/feature_tests/templates/feature_attribute.template +5 -0
- data/lib/tdriver-devtools/tests/feature_tests/templates/feature_method.template +5 -0
- data/lib/tdriver-devtools/tests/feature_tests/templates/scenario_attribute.template +5 -0
- data/lib/tdriver-devtools/tests/feature_tests/templates/scenario_method.template +5 -0
- data/lib/tdriver-devtools/tests/feature_tests/update +3 -0
- data/lib/tdriver.rb +26 -0
- data/lib/tdriver/base/behaviour/behaviour.rb +32 -0
- data/lib/tdriver/base/behaviour/behaviours/object_behaviour_composition.rb +94 -0
- data/lib/tdriver/base/behaviour/behaviours/object_behaviour_description.rb +262 -0
- data/lib/tdriver/base/behaviour/behaviours/object_composition.rb +111 -0
- data/lib/tdriver/base/behaviour/factory.rb +380 -0
- data/lib/tdriver/base/behaviour/loader.rb +28 -0
- data/lib/tdriver/base/command_data/command_data.rb +51 -0
- data/lib/tdriver/base/command_data/loader.rb +25 -0
- data/lib/tdriver/base/errors.rb +131 -0
- data/lib/tdriver/base/loader.rb +38 -0
- data/lib/tdriver/base/state_object.rb +270 -0
- data/lib/tdriver/base/sut/adapter.rb +28 -0
- data/lib/tdriver/base/sut/controller.rb +119 -0
- data/lib/tdriver/base/sut/factory.rb +287 -0
- data/lib/tdriver/base/sut/generic/behaviours/application.rb +243 -0
- data/lib/tdriver/base/sut/generic/behaviours/controller.rb +67 -0
- data/lib/tdriver/base/sut/generic/behaviours/find.rb +96 -0
- data/lib/tdriver/base/sut/generic/behaviours/flash_behaviour.rb +346 -0
- data/lib/tdriver/base/sut/generic/behaviours/sut.rb +1268 -0
- data/lib/tdriver/base/sut/generic/behaviours/switchbox_behaviour.rb +182 -0
- data/lib/tdriver/base/sut/generic/behaviours/verification.rb +119 -0
- data/lib/tdriver/base/sut/generic/commands/application.rb +219 -0
- data/lib/tdriver/base/sut/generic/commands/key_sequence.rb +82 -0
- data/lib/tdriver/base/sut/generic/commands/screen_capture.rb +58 -0
- data/lib/tdriver/base/sut/generic/plugin.rb +96 -0
- data/lib/tdriver/base/sut/loader.rb +35 -0
- data/lib/tdriver/base/sut/sut.rb +67 -0
- data/lib/tdriver/base/test_object/abstract.rb +179 -0
- data/lib/tdriver/base/test_object/behaviours/syncronization.rb +94 -0
- data/lib/tdriver/base/test_object/behaviours/test_object.rb +787 -0
- data/lib/tdriver/base/test_object/factory.rb +618 -0
- data/lib/tdriver/base/test_object/identificator.rb +511 -0
- data/lib/tdriver/base/test_object/loader.rb +37 -0
- data/lib/tdriver/env.rb +21 -0
- data/lib/tdriver/loader.rb +36 -0
- data/lib/tdriver/matti.rb +35 -0
- data/lib/tdriver/report/error_recovery/tdriver_custom_error_recovery.rb +83 -0
- data/lib/tdriver/report/error_recovery/tdriver_error_recovery.rb +158 -0
- data/lib/tdriver/report/error_recovery/tdriver_error_recovery_settings.rb +98 -0
- data/lib/tdriver/report/report.rb +47 -0
- data/lib/tdriver/report/report_api.rb +207 -0
- data/lib/tdriver/report/report_combine.rb +86 -0
- data/lib/tdriver/report/report_crash_file_capture.rb +167 -0
- data/lib/tdriver/report/report_creator.rb +571 -0
- data/lib/tdriver/report/report_cucumber.rb +158 -0
- data/lib/tdriver/report/report_cucumber_listener.rb +337 -0
- data/lib/tdriver/report/report_cucumber_reporter.rb +335 -0
- data/lib/tdriver/report/report_data_presentation.rb +152 -0
- data/lib/tdriver/report/report_data_table.rb +64 -0
- data/lib/tdriver/report/report_execution_statistics.rb +284 -0
- data/lib/tdriver/report/report_file_capture.rb +159 -0
- data/lib/tdriver/report/report_grouping.rb +539 -0
- data/lib/tdriver/report/report_junit_xml.rb +147 -0
- data/lib/tdriver/report/report_rspec.rb +108 -0
- data/lib/tdriver/report/report_test_case_run.rb +621 -0
- data/lib/tdriver/report/report_test_run.rb +1286 -0
- data/lib/tdriver/report/report_test_unit.rb +175 -0
- data/lib/tdriver/report/report_writer.rb +1405 -0
- data/lib/tdriver/tdriver.rb +158 -0
- data/lib/tdriver/util/common.rb +24 -0
- data/lib/tdriver/util/common/array.rb +39 -0
- data/lib/tdriver/util/common/crc16.rb +100 -0
- data/lib/tdriver/util/common/environment.rb +153 -0
- data/lib/tdriver/util/common/error.rb +39 -0
- data/lib/tdriver/util/common/file.rb +315 -0
- data/lib/tdriver/util/common/gem.rb +108 -0
- data/lib/tdriver/util/common/kernel.rb +189 -0
- data/lib/tdriver/util/common/loader.rb +39 -0
- data/lib/tdriver/util/common/retryable.rb +98 -0
- data/lib/tdriver/util/common/string.rb +77 -0
- data/lib/tdriver/util/dbaccess/dbaccess.rb +188 -0
- data/lib/tdriver/util/dbaccess/dbconnection.rb +41 -0
- data/lib/tdriver/util/dbaccess/error.rb +35 -0
- data/lib/tdriver/util/dbaccess/loader.rb +29 -0
- data/lib/tdriver/util/dynamic_attribute_filter.rb +182 -0
- data/lib/tdriver/util/hooking.rb +434 -0
- data/lib/tdriver/util/loader.rb +65 -0
- data/lib/tdriver/util/localisation.rb +24 -0
- data/lib/tdriver/util/localisation/error.rb +32 -0
- data/lib/tdriver/util/localisation/loader.rb +28 -0
- data/lib/tdriver/util/localisation/localisation.rb +479 -0
- data/lib/tdriver/util/logger.rb +377 -0
- data/lib/tdriver/util/operator_data/error.rb +29 -0
- data/lib/tdriver/util/operator_data/loader.rb +26 -0
- data/lib/tdriver/util/operator_data/operator_data.rb +93 -0
- data/lib/tdriver/util/other/config.rb +221 -0
- data/lib/tdriver/util/parameter.rb +24 -0
- data/lib/tdriver/util/parameter/error.rb +45 -0
- data/lib/tdriver/util/parameter/loader.rb +37 -0
- data/lib/tdriver/util/parameter/parameter.rb +285 -0
- data/lib/tdriver/util/parameter/parameter_hash.rb +101 -0
- data/lib/tdriver/util/parameter/parameter_template.rb +120 -0
- data/lib/tdriver/util/parameter/parameter_user_api.rb +84 -0
- data/lib/tdriver/util/parameter/parameter_xml.rb +247 -0
- data/lib/tdriver/util/plugin/abstract.rb +60 -0
- data/lib/tdriver/util/plugin/error.rb +25 -0
- data/lib/tdriver/util/plugin/loader.rb +28 -0
- data/lib/tdriver/util/plugin/service.rb +200 -0
- data/lib/tdriver/util/recorder.rb +292 -0
- data/lib/tdriver/util/stats.rb +90 -0
- data/lib/tdriver/util/user_data/error.rb +29 -0
- data/lib/tdriver/util/user_data/loader.rb +26 -0
- data/lib/tdriver/util/user_data/user_data.rb +103 -0
- data/lib/tdriver/util/video_rec.rb +264 -0
- data/lib/tdriver/util/xml/abstraction.rb +47 -0
- data/lib/tdriver/util/xml/builder.rb +54 -0
- data/lib/tdriver/util/xml/document.rb +32 -0
- data/lib/tdriver/util/xml/element.rb +32 -0
- data/lib/tdriver/util/xml/error.rb +46 -0
- data/lib/tdriver/util/xml/loader.rb +46 -0
- data/lib/tdriver/util/xml/nil_element.rb +89 -0
- data/lib/tdriver/util/xml/nodeset.rb +32 -0
- data/lib/tdriver/util/xml/parsers/libxml/libxml.rb +140 -0
- data/lib/tdriver/util/xml/parsers/loader.rb +22 -0
- data/lib/tdriver/util/xml/parsers/nokogiri/abstraction.rb +111 -0
- data/lib/tdriver/util/xml/parsers/nokogiri/attribute.rb +54 -0
- data/lib/tdriver/util/xml/parsers/nokogiri/builder.rb +58 -0
- data/lib/tdriver/util/xml/parsers/nokogiri/document.rb +58 -0
- data/lib/tdriver/util/xml/parsers/nokogiri/element.rb +147 -0
- data/lib/tdriver/util/xml/parsers/nokogiri/loader.rb +42 -0
- data/lib/tdriver/util/xml/parsers/nokogiri/nodeset.rb +187 -0
- data/lib/tdriver/util/xml/xml.rb +170 -0
- data/lib/tdriver/verify/verify.rb +687 -0
- data/lib/tdriver/verify/verify.rb_org +630 -0
- data/lib/tdriver/version.rb +21 -0
- data/xml/behaviours/generic.xml +495 -0
- data/xml/defaults/generic.xml +97 -0
- data/xml/defaults/sut_generic.xml +36 -0
- data/xml/parameters/tdriver_parameters.xml +23 -0
- data/xml/templates/generic.xml +227 -0
- metadata +327 -0
@@ -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,284 @@
|
|
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=MobyUtil::Parameter[ :report_passed_statuses, "passed" ].split('|')
|
26
|
+
@fail_statuses=MobyUtil::Parameter[ :report_failed_statuses, "failed" ].split('|')
|
27
|
+
@not_run_statuses=MobyUtil::Parameter[ :report_not_run_statuses, "not run" ].split('|')
|
28
|
+
@test_results_per_page=MobyUtil::Parameter[ :report_results_per_page, 10]
|
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 << ["duration",0]
|
52
|
+
@all_statuses << "reboots" << "crashes" << "duration"
|
53
|
+
end
|
54
|
+
|
55
|
+
def generate_statistics_headers()
|
56
|
+
status_heads=Array.new
|
57
|
+
@pass_statuses.each do |status|
|
58
|
+
status_heads << "<td><b>#{status}</b></td>"
|
59
|
+
end
|
60
|
+
@fail_statuses.each do |status|
|
61
|
+
status_heads << "<td><b>#{status}</b></td>"
|
62
|
+
end
|
63
|
+
@not_run_statuses.each do |status|
|
64
|
+
status_heads << "<td><b>#{status}</b></td>"
|
65
|
+
end
|
66
|
+
status_heads << "<td><b>Reboots</b></td>"
|
67
|
+
status_heads << "<td><b>Crashes</b></td>"
|
68
|
+
status_heads << "<td><b>Duration</b></td>"
|
69
|
+
status_heads
|
70
|
+
end
|
71
|
+
|
72
|
+
def collect_test_case_statistics()
|
73
|
+
total_duration = 0.0
|
74
|
+
@group_test_case_arr.each do |test_case|
|
75
|
+
tc_status=test_case[7]
|
76
|
+
tc_name=test_case[0].to_s.gsub('_',' ')
|
77
|
+
tc_execution=test_case[8].to_i
|
78
|
+
reboots=test_case[2]
|
79
|
+
crashes=test_case[3]
|
80
|
+
tc_link=test_case[11]
|
81
|
+
current_index=0
|
82
|
+
|
83
|
+
duration=test_case[5].to_f
|
84
|
+
total_duration = total_duration + duration
|
85
|
+
|
86
|
+
b_test_in_statistics=false
|
87
|
+
|
88
|
+
current_index=0
|
89
|
+
@total_statistics_arr.each do |total_status|
|
90
|
+
if tc_status==total_status[0]
|
91
|
+
@total_statistics_arr[current_index]=[tc_status,total_status[1].to_i+1]
|
92
|
+
end
|
93
|
+
if total_status[0]=="reboots"
|
94
|
+
@total_statistics_arr[current_index]=["reboots",total_status[1].to_i+reboots.to_i]
|
95
|
+
end
|
96
|
+
if total_status[0]=="crashes"
|
97
|
+
@total_statistics_arr[current_index]=["crashes",total_status[1].to_i+crashes.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
|
+
current_index+=1
|
106
|
+
end
|
107
|
+
current_index=0
|
108
|
+
@statistics_arr.each do |total_status|
|
109
|
+
if total_status[1]==tc_status && total_status[0]==tc_name
|
110
|
+
b_test_in_statistics=true
|
111
|
+
@statistics_arr[current_index]=[tc_name,tc_status,total_status[2].to_i+1,tc_execution,tc_link]
|
112
|
+
end
|
113
|
+
if total_status[1]=="reboots" && total_status[0]==tc_name
|
114
|
+
b_test_in_statistics=true
|
115
|
+
@statistics_arr[current_index]=[tc_name,"reboots",total_status[2].to_i+reboots.to_i,tc_execution,tc_link]
|
116
|
+
end
|
117
|
+
if total_status[1]=="crashes" && total_status[0]==tc_name
|
118
|
+
b_test_in_statistics=true
|
119
|
+
@statistics_arr[current_index]=[tc_name,"crashes",total_status[2].to_i+crashes.to_i,tc_execution,tc_link]
|
120
|
+
end
|
121
|
+
if total_status[1]=="total" && total_status[0]==tc_name
|
122
|
+
b_test_in_statistics=true
|
123
|
+
@statistics_arr[current_index]=[tc_name,"total",total_status[2].to_i+1,tc_execution,tc_link]
|
124
|
+
end
|
125
|
+
if total_status[1]=="duration" && total_status[0]==tc_name
|
126
|
+
b_test_in_statistics=true
|
127
|
+
@statistics_arr[current_index]=[tc_name,"duration",duration,tc_execution,tc_link]
|
128
|
+
end
|
129
|
+
current_index+=1
|
130
|
+
end
|
131
|
+
|
132
|
+
if b_test_in_statistics==false
|
133
|
+
@all_statuses.each do |status|
|
134
|
+
if status==tc_status
|
135
|
+
@statistics_arr << [tc_name,tc_status,1,tc_execution,tc_link]
|
136
|
+
elsif status=="reboots"
|
137
|
+
@statistics_arr << [tc_name,"reboots",reboots.to_i,tc_execution,tc_link]
|
138
|
+
elsif status=="crashes"
|
139
|
+
@statistics_arr << [tc_name,"crashes",crashes.to_i,tc_execution,tc_link]
|
140
|
+
elsif status=="total"
|
141
|
+
@statistics_arr << [tc_name,"total",1,tc_execution,tc_link]
|
142
|
+
elsif status=="duration"
|
143
|
+
@statistics_arr << [tc_name,"duration",duration,tc_execution,tc_link]
|
144
|
+
else
|
145
|
+
@statistics_arr << [tc_name,status,0,tc_execution,tc_link]
|
146
|
+
end
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
end
|
151
|
+
|
152
|
+
end
|
153
|
+
|
154
|
+
def add_result_style_tag(status,total)
|
155
|
+
tc_style_tag=' id=""'
|
156
|
+
tc_style_tag=' id="passed_case"' if @pass_statuses.include?(status) && total>0
|
157
|
+
tc_style_tag=' id="failed_case"' if @fail_statuses.include?(status) && total>0
|
158
|
+
tc_style_tag=' id="not_run_case"' if @not_run_statuses.include?(status) && total>0
|
159
|
+
tc_style_tag
|
160
|
+
end
|
161
|
+
def add_result_link(test_case,status,total,test_index)
|
162
|
+
|
163
|
+
result_page=test_index/@test_results_per_page.to_i
|
164
|
+
result_page_mod=test_index % @test_results_per_page.to_i
|
165
|
+
|
166
|
+
if result_page_mod>0
|
167
|
+
result_page=result_page.to_i+1
|
168
|
+
end
|
169
|
+
result_page=1 if result_page==0
|
170
|
+
|
171
|
+
if @summary
|
172
|
+
tc_link='<a href="cases/'+result_page.to_i.to_s+'_chronological_total_run_index.html">'
|
173
|
+
tc_link='<a href="cases/1_reboot_index.html">' if status=="reboots" && total>0
|
174
|
+
tc_link='<a href="cases/1_crash_index.html">' if status=="crashes" && total>0
|
175
|
+
tc_link='<a href="cases/'+result_page.to_i.to_s+'_chronological_total_run_index.html#'+test_case.gsub(' ','_')+'_' + @pass_statuses.first + '">' if @pass_statuses.include?(status) && total>0
|
176
|
+
tc_link='<a href="cases/'+result_page.to_i.to_s+'_chronological_total_run_index.html#'+test_case.gsub(' ','_')+'_' + @fail_statuses.first + '">' if @fail_statuses.include?(status) && total>0
|
177
|
+
tc_link='<a href="cases/'+result_page.to_i.to_s+'_chronological_total_run_index.html#'+test_case.gsub(' ','_')+'_' + @not_run_statuses.first + '">' if @not_run_statuses.include?(status) && total>0
|
178
|
+
else
|
179
|
+
tc_link='<a href="'+result_page.to_i.to_s+'_chronological_total_run_index.html">'
|
180
|
+
tc_link='<a href="1_reboot_index.html">' if status=="reboots" && total>0
|
181
|
+
tc_link='<a href="1_crash_index.html">' if status=="crashes" && total>0
|
182
|
+
tc_link='<a href="'+result_page.to_i.to_s+'_chronological_total_run_index.html#'+test_case.gsub(' ','_')+'_' + @pass_statuses.first + '">' if @pass_statuses.include?(status) && total>0
|
183
|
+
tc_link='<a href="'+result_page.to_i.to_s+'_chronological_total_run_index.html#'+test_case.gsub(' ','_')+'_' + @fail_statuses.first + '">' if @fail_statuses.include?(status) && total>0
|
184
|
+
tc_link='<a href="'+result_page.to_i.to_s+'_chronological_total_run_index.html#'+test_case.gsub(' ','_')+'_' + @not_run_statuses.first + '">' if @not_run_statuses.include?(status) && total>0
|
185
|
+
end
|
186
|
+
tc_link
|
187
|
+
|
188
|
+
end
|
189
|
+
|
190
|
+
def generate_duration_graph(file_name)
|
191
|
+
|
192
|
+
begin
|
193
|
+
require 'gruff'
|
194
|
+
rescue LoadError
|
195
|
+
$stderr.puts "Can't load the Gruff gem. If its missing from your system please run 'gem install gruff' to install it."
|
196
|
+
end
|
197
|
+
reset_total_statistics()
|
198
|
+
collect_test_case_statistics()
|
199
|
+
begin
|
200
|
+
labels = Hash.new
|
201
|
+
durations = Array.new
|
202
|
+
test_case_added=Array.new
|
203
|
+
current_index = 0
|
204
|
+
@statistics_arr.each do |test_case|
|
205
|
+
tc_name=test_case[0].to_s.gsub('_',' ')
|
206
|
+
if test_case_added.include?(tc_name)==false && test_case[1].to_s=="duration"
|
207
|
+
durations << test_case[2]
|
208
|
+
labels[current_index] = "#{current_index + 1}" #tc_name
|
209
|
+
current_index += 1
|
210
|
+
test_case_added << tc_name
|
211
|
+
end
|
212
|
+
end
|
213
|
+
|
214
|
+
if current_index > 50
|
215
|
+
g = Gruff::SideStackedBar.new("400x#{15*current_index.to_i}")
|
216
|
+
else
|
217
|
+
g = Gruff::SideStackedBar.new()
|
218
|
+
end
|
219
|
+
|
220
|
+
g.title = "Duration Distribution"
|
221
|
+
g.data("Duration", durations)
|
222
|
+
g.labels = labels
|
223
|
+
g.write(file_name)
|
224
|
+
rescue Exception => e
|
225
|
+
$stderr.puts "Can't load the Gruff gem. If its missing from your system please run 'gem install gruff' to install it."
|
226
|
+
end
|
227
|
+
end
|
228
|
+
|
229
|
+
def generate_statistics_table()
|
230
|
+
table_body=Array.new
|
231
|
+
reset_total_statistics()
|
232
|
+
collect_test_case_statistics()
|
233
|
+
table_body='<table id="statistics_table" align="center" border="0" cellspacing="0" style="width:100%;">'<<
|
234
|
+
'<tr>'<<
|
235
|
+
'<td>'<<
|
236
|
+
'<b>Row</b></td>'<<
|
237
|
+
'<td>'<<
|
238
|
+
'<b>Name</b></td>'<<
|
239
|
+
'<td>'<<
|
240
|
+
'<b>Total</b></td>'<<
|
241
|
+
generate_statistics_headers.to_s <<
|
242
|
+
'</tr>'
|
243
|
+
|
244
|
+
test_case_added=Array.new
|
245
|
+
row=1
|
246
|
+
@statistics_arr.each do |test_case|
|
247
|
+
tc_name=test_case[0].to_s.gsub('_',' ')
|
248
|
+
if @summary
|
249
|
+
test_link="cases/#{test_case[4]}"
|
250
|
+
else
|
251
|
+
test_link=test_case[4]
|
252
|
+
end
|
253
|
+
|
254
|
+
if test_case_added.include?(tc_name)==false
|
255
|
+
table_body << "<tr>"
|
256
|
+
table_body << "<td>#{row}</td>"
|
257
|
+
table_body << "<td><a href=\"#{test_link}\">#{tc_name}</a></td>"
|
258
|
+
@statistics_arr.each do |test_case_statistics|
|
259
|
+
if test_case_statistics[0]==tc_name
|
260
|
+
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>"
|
261
|
+
end
|
262
|
+
end
|
263
|
+
table_body << "</tr>"
|
264
|
+
test_case_added << tc_name
|
265
|
+
row+=1
|
266
|
+
end
|
267
|
+
end
|
268
|
+
|
269
|
+
|
270
|
+
table_body << '<tr></tr>'
|
271
|
+
table_body << '<tr>' <<
|
272
|
+
'<td></td><td>'<<
|
273
|
+
'<b>Total</b></td>'
|
274
|
+
@total_statistics_arr.each do |statistic|
|
275
|
+
table_body << "<td><b>#{statistic[1]}</b></td>"
|
276
|
+
end
|
277
|
+
table_body << '</tr>' <<
|
278
|
+
'</table>'
|
279
|
+
|
280
|
+
|
281
|
+
table_body
|
282
|
+
end
|
283
|
+
|
284
|
+
end
|
@@ -0,0 +1,159 @@
|
|
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 TDriverReportFileCapture
|
23
|
+
def initialize
|
24
|
+
@file_locations=Array.new
|
25
|
+
@file_suts=Array.new
|
26
|
+
@file_names=Array.new
|
27
|
+
@file_count=0
|
28
|
+
@monitor_files='false'
|
29
|
+
read_file_monitor_settings()
|
30
|
+
end
|
31
|
+
|
32
|
+
def return_settings_value_array(setting)
|
33
|
+
setting_value=setting
|
34
|
+
setting_arr=Array.new
|
35
|
+
setting_arr=setting_value.split(',')
|
36
|
+
setting_arr
|
37
|
+
end
|
38
|
+
|
39
|
+
def read_file_monitor_settings()
|
40
|
+
@file_locations=return_settings_value_array(MobyUtil::Parameter[ :report_file_locations, nil ])
|
41
|
+
@file_suts=return_settings_value_array(MobyUtil::Parameter[ :report_file_monitored_sut_ids, nil ])
|
42
|
+
@file_names=return_settings_value_array(MobyUtil::Parameter[ :report_file_names, nil ])
|
43
|
+
@clean_files=MobyUtil::Parameter[ :report_clean_files_from_sut_after_capture, 'true' ]
|
44
|
+
@monitor_files = MobyUtil::Parameter[ :report_file_monitor, 'false' ]
|
45
|
+
end
|
46
|
+
|
47
|
+
def clean_files_from_sut()
|
48
|
+
|
49
|
+
if @monitor_files == 'true' && @clean_files == 'true'
|
50
|
+
MobyBase::SUTFactory.instance.connected_suts.each do |sut_id, sut_attributes|
|
51
|
+
if sut_attributes[:is_connected]
|
52
|
+
@file_suts.each do |monitored_sut|
|
53
|
+
if monitored_sut == sut_id.to_s
|
54
|
+
sut_files=Array.new
|
55
|
+
sut_files=list_sut_files(sut_attributes[:sut])
|
56
|
+
sut_files.each do |file|
|
57
|
+
delete_file(sut_attributes[:sut],file)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
def list_sut_files(current_sut)
|
67
|
+
file_arr=Array.new
|
68
|
+
@file_count=0
|
69
|
+
#for every location:
|
70
|
+
@file_locations.each do |location|
|
71
|
+
begin
|
72
|
+
#get file names
|
73
|
+
current_location_files=Array.new
|
74
|
+
@file_names.each do |file_name|
|
75
|
+
current_location_files = current_sut.list_files_from_sut( :from => location, :file=> file_name.to_s )
|
76
|
+
#collect crash names and add paths
|
77
|
+
current_location_files.each do |sut_file|
|
78
|
+
#if file_is_file(sut_file)
|
79
|
+
file_arr << sut_file.to_s
|
80
|
+
@file_count+=1
|
81
|
+
#end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
rescue => ex
|
85
|
+
#puts ex.message
|
86
|
+
end
|
87
|
+
end
|
88
|
+
file_arr
|
89
|
+
end
|
90
|
+
|
91
|
+
def download_file(current_sut,file_name,download_folder)
|
92
|
+
begin
|
93
|
+
current_sut.copy_from_sut(:file => file_name, :to => download_folder )
|
94
|
+
rescue => ex
|
95
|
+
#puts ex.message
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
def delete_file(current_sut,file_name)
|
100
|
+
begin
|
101
|
+
current_sut.delete_from_sut(:file => file_name )
|
102
|
+
rescue => ex
|
103
|
+
#puts ex.message
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
def check_if_files_exist()
|
108
|
+
sut_files=Array.new
|
109
|
+
if @monitor_files == 'true'
|
110
|
+
MobyBase::SUTFactory.instance.connected_suts.each do |sut_id, sut_attributes|
|
111
|
+
if sut_attributes[:is_connected]
|
112
|
+
@file_suts.each do |monitored_sut|
|
113
|
+
if monitored_sut == sut_id.to_s
|
114
|
+
sut_files << list_sut_files(sut_attributes[:sut])
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
119
|
+
@file_count
|
120
|
+
else
|
121
|
+
@file_count
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
def download_files(download_folder)
|
126
|
+
if @monitor_files == 'true'
|
127
|
+
MobyBase::SUTFactory.instance.connected_suts.each do |sut_id, sut_attributes|
|
128
|
+
if sut_attributes[:is_connected]
|
129
|
+
@file_suts.each do |monitored_sut|
|
130
|
+
if monitored_sut == sut_id.to_s
|
131
|
+
sut_files=Array.new
|
132
|
+
sut_files=list_sut_files(sut_attributes[:sut])
|
133
|
+
sut_files.each do |file|
|
134
|
+
download_file(sut_attributes[:sut],file,download_folder.gsub("\\",'/')+'/')
|
135
|
+
end
|
136
|
+
end
|
137
|
+
end
|
138
|
+
end
|
139
|
+
end
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
def capture_files()
|
144
|
+
if @monitor_files == 'true'
|
145
|
+
begin
|
146
|
+
dump_folder=@test_case_folder+'/files'
|
147
|
+
if File::directory?(dump_folder)==false
|
148
|
+
FileUtils.mkdir_p dump_folder
|
149
|
+
end
|
150
|
+
download_files(dump_folder)
|
151
|
+
rescue Exception => e
|
152
|
+
@test_case_execution_log=@test_case_execution_log.to_s + '<br />' + "Unable to capture files: " + e.message + e.backtrace.to_s
|
153
|
+
end
|
154
|
+
end
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
158
|
+
|
159
|
+
|