testability-driver 0.9.2 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/tdriver/base/behaviour/behaviours/object_behaviour_composition.rb +1 -1
- data/lib/tdriver/base/behaviour/behaviours/object_behaviour_description.rb +11 -7
- data/lib/tdriver/base/behaviour/behaviours/object_composition.rb +8 -0
- data/lib/tdriver/base/behaviour/factory.rb +229 -209
- data/lib/tdriver/base/errors.rb +3 -0
- data/lib/tdriver/base/state_object.rb +11 -20
- data/lib/tdriver/base/sut/controller.rb +4 -4
- data/lib/tdriver/base/sut/factory.rb +205 -170
- data/lib/tdriver/base/sut/generic/behaviours/application.rb +256 -174
- data/lib/tdriver/base/sut/generic/behaviours/find.rb +17 -11
- data/lib/tdriver/base/sut/generic/behaviours/flash_behaviour.rb +57 -66
- data/lib/tdriver/base/sut/generic/behaviours/sut.rb +578 -497
- data/lib/tdriver/base/sut/generic/behaviours/switchbox_behaviour.rb +41 -15
- data/lib/tdriver/base/sut/generic/behaviours/verification.rb +48 -19
- data/lib/tdriver/base/sut/generic/commands/fixture.rb +47 -0
- data/lib/tdriver/base/sut/generic/commands/key_sequence.rb +25 -13
- data/lib/tdriver/base/sut/generic/commands/screen_capture.rb +16 -10
- data/lib/tdriver/base/sut/generic/plugin.rb +9 -3
- data/lib/tdriver/base/sut/sut.rb +41 -33
- data/lib/tdriver/base/test_object/abstract.rb +26 -3
- data/lib/tdriver/base/test_object/adapter.rb +399 -0
- data/lib/tdriver/base/test_object/behaviours/syncronization.rb +56 -14
- data/lib/tdriver/base/test_object/behaviours/test_object.rb +663 -197
- data/lib/tdriver/base/test_object/cache.rb +132 -0
- data/lib/tdriver/base/test_object/factory.rb +677 -426
- data/lib/tdriver/base/test_object/factory_new.rb +202 -0
- data/lib/tdriver/base/test_object/identificator.rb +24 -17
- data/lib/tdriver/base/test_object/loader.rb +9 -3
- data/lib/tdriver/base/test_object/verification.rb +181 -0
- data/lib/tdriver/loader.rb +1 -1
- data/lib/tdriver/report/report.rb +2 -0
- data/lib/tdriver/report/report_api.rb +4 -4
- data/lib/tdriver/report/report_creator.rb +29 -3
- data/lib/tdriver/report/report_data_presentation.rb +7 -3
- data/lib/tdriver/report/report_execution_statistics.rb +80 -21
- data/lib/tdriver/report/report_javascript.rb +192 -0
- data/lib/tdriver/report/report_test_case_run.rb +22 -0
- data/lib/tdriver/report/report_test_run.rb +62 -55
- data/lib/tdriver/report/report_writer.rb +57 -56
- data/lib/tdriver/tdriver.rb +14 -41
- data/lib/tdriver/util/common/error.rb +1 -0
- data/lib/tdriver/util/common/exceptions.rb +12 -0
- data/lib/tdriver/util/common/file.rb +12 -6
- data/lib/tdriver/util/common/gem.rb +2 -1
- data/lib/tdriver/util/common/hash.rb +152 -0
- data/lib/tdriver/util/common/kernel.rb +49 -34
- data/lib/tdriver/util/common/loader.rb +21 -17
- data/lib/tdriver/util/common/numeric.rb +39 -0
- data/lib/tdriver/util/common/object.rb +115 -0
- data/lib/tdriver/util/common/string.rb +55 -2
- data/lib/tdriver/util/dbaccess/dbaccess.rb +194 -161
- data/lib/tdriver/util/dynamic_attribute_filter.rb +6 -0
- data/lib/tdriver/util/hooking.rb +2 -2
- data/lib/tdriver/util/loader.rb +2 -2
- data/lib/tdriver/util/localisation/localisation.rb +277 -18
- data/lib/tdriver/util/logger.rb +142 -13
- data/lib/tdriver/util/parameter/parameter_hash.rb +8 -5
- data/lib/tdriver/util/parameter/parameter_xml.rb +18 -2
- data/lib/tdriver/util/recorder.rb +17 -12
- data/lib/tdriver/util/user_data/user_data.rb +3 -2
- data/lib/tdriver/util/{video_rec.rb → video_utils.rb} +136 -16
- data/lib/tdriver/util/xml/abstraction.rb +7 -0
- data/lib/tdriver/util/xml/attribute.rb +32 -0
- data/lib/tdriver/util/xml/loader.rb +8 -2
- data/lib/tdriver/util/xml/nil_node.rb +95 -0
- data/lib/tdriver/util/xml/parsers/nokogiri/abstraction.rb +46 -7
- data/lib/tdriver/util/xml/parsers/nokogiri/attribute.rb +19 -9
- data/lib/tdriver/util/xml/parsers/nokogiri/document.rb +1 -1
- data/lib/tdriver/util/xml/parsers/nokogiri/element.rb +13 -1
- data/lib/tdriver/util/xml/parsers/nokogiri/loader.rb +6 -0
- data/lib/tdriver/util/xml/parsers/nokogiri/nodeset.rb +27 -15
- data/lib/tdriver/util/xml/parsers/nokogiri/text.rb +57 -0
- data/lib/tdriver/util/xml/text.rb +32 -0
- data/lib/tdriver/util/xml/xml.rb +35 -22
- data/lib/tdriver/version.rb +1 -1
- data/lib/tdriver-devtools/behaviour/xml/rdoc_behaviour_xml_generator.rb +41 -34
- data/lib/tdriver-devtools/doc/generate.rb +31 -6
- data/lib/tdriver-devtools/doc/xslt/template.xsl +46 -25
- data/lib/tdriver-devtools/tests/feature_tests/example/behaviour_example.rb +100 -0
- data/lib/tdriver-devtools/tests/feature_tests/update +1 -1
- data/lib/tdriver.rb +0 -3
- data/xml/behaviours/generic.xml +1 -1
- data/xml/defaults/generic.xml +4 -90
- data/xml/templates/generic.xml +33 -25
- metadata +21 -29
- data/lib/tdriver-devtools/behaviour/xml_generator/example/flick-example.rb +0 -245
- data/lib/tdriver-devtools/behaviour/xml_generator/example/sut.rb +0 -964
- data/lib/tdriver-devtools/behaviour/xml_generator/generate.rb +0 -68
- data/lib/tdriver-devtools/behaviour/xml_generator/lib/custom_rdoc_generator.rb +0 -1865
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.argument.default.template +0 -1
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.argument.template +0 -3
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.argument_type.template +0 -4
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.exception.template +0 -4
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.method.arguments.template +0 -4
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.method.deprecated.template +0 -3
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.method.exceptions.template +0 -3
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.method.info.template +0 -1
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.method.returns.template +0 -3
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.method.tables.template +0 -3
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.method.template +0 -12
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.returns.template +0 -5
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.table.item.template +0 -1
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.table.row.template +0 -2
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.table.template +0 -7
- data/lib/tdriver-devtools/behaviour/xml_generator/templates/behaviour.xml.template +0 -14
- data/lib/tdriver-devtools/behaviour/xml_generator/update +0 -3
- data/lib/tdriver-devtools/tests/feature_tests/example/flick-example.rb +0 -233
- data/lib/tdriver-devtools/tests/feature_tests/example/impl.rb +0 -194
@@ -370,6 +370,28 @@ module TDriverReportCreator
|
|
370
370
|
|
371
371
|
end
|
372
372
|
|
373
|
+
def target_video_alive
|
374
|
+
|
375
|
+
ret = ""
|
376
|
+
each_video_device do | video_device, device_index |
|
377
|
+
|
378
|
+
check_fps = MobyUtil::Parameter[:report_activity_fps, '3']
|
379
|
+
check_frame_min = MobyUtil::Parameter[:report_activity_frame_treshold, '8']
|
380
|
+
check_video_min = MobyUtil::Parameter[:report_activity_video_treshold, '29']
|
381
|
+
|
382
|
+
ret_n = MobyUtil.video_alive? "cam_" + device_index + "_" + @tc_video_filename, check_fps.to_f, check_frame_min.to_f, check_video_min.to_f, false
|
383
|
+
|
384
|
+
if !ret_n
|
385
|
+
ret += ", " if !ret.empty?
|
386
|
+
ret += "cam_" + device_index + "_" + @tc_video_filename
|
387
|
+
end
|
388
|
+
|
389
|
+
end
|
390
|
+
|
391
|
+
return ret
|
392
|
+
|
393
|
+
end
|
394
|
+
|
373
395
|
def stop_video_recording()
|
374
396
|
|
375
397
|
|
@@ -1,20 +1,20 @@
|
|
1
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
|
-
##
|
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
7
|
## This file is part of TDriver.
|
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
|
-
##
|
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
18
|
############################################################################
|
19
19
|
|
20
20
|
|
@@ -86,7 +86,7 @@ module TDriverReportCreator
|
|
86
86
|
@memory_amount_total='-'
|
87
87
|
@total_dump_count=Hash.new
|
88
88
|
@total_received_data=Hash.new
|
89
|
-
@total_sent_data=Hash.new
|
89
|
+
@total_sent_data=Hash.new
|
90
90
|
$result_storage_in_use=false
|
91
91
|
@pages=MobyUtil::Parameter[ :report_results_per_page, 10]
|
92
92
|
@duration_graph=MobyUtil::Parameter[ :report_generate_duration_graph, false]
|
@@ -129,7 +129,7 @@ module TDriverReportCreator
|
|
129
129
|
# === raises
|
130
130
|
# TypeError exception
|
131
131
|
def set_user_data(value)
|
132
|
-
if value==nil
|
132
|
+
if value==nil
|
133
133
|
@test_case_user_data = Array.new
|
134
134
|
@test_case_user_data_columns = Array.new
|
135
135
|
else
|
@@ -146,13 +146,13 @@ module TDriverReportCreator
|
|
146
146
|
#
|
147
147
|
# === params
|
148
148
|
# column_name: the column name in chronological table
|
149
|
-
# value: the data
|
149
|
+
# value: the data
|
150
150
|
# === returns
|
151
151
|
# nil
|
152
152
|
# === raises
|
153
153
|
def set_user_table_data(column_name,value)
|
154
154
|
if (!column_name.empty? && column_name!=nil)
|
155
|
-
@test_case_user_chronological_table_data[column_name.to_s]=value.to_s
|
155
|
+
@test_case_user_chronological_table_data[column_name.to_s]=value.to_s
|
156
156
|
end
|
157
157
|
end
|
158
158
|
#This method sets the test run behaviour log
|
@@ -325,7 +325,7 @@ module TDriverReportCreator
|
|
325
325
|
def set_memory_amount_total(value)
|
326
326
|
@memory_amount_total=value
|
327
327
|
end
|
328
|
-
|
328
|
+
|
329
329
|
#This method gets the not run cases name array
|
330
330
|
#
|
331
331
|
# === params
|
@@ -370,7 +370,7 @@ module TDriverReportCreator
|
|
370
370
|
#@all_cases_arr
|
371
371
|
read_result_storage('all')
|
372
372
|
end
|
373
|
-
|
373
|
+
|
374
374
|
#This method gets reporting groups
|
375
375
|
#
|
376
376
|
# === params
|
@@ -385,7 +385,7 @@ module TDriverReportCreator
|
|
385
385
|
end
|
386
386
|
@reporting_groups
|
387
387
|
end
|
388
|
-
|
388
|
+
|
389
389
|
#This method gets user created data
|
390
390
|
#
|
391
391
|
# === params
|
@@ -396,7 +396,7 @@ module TDriverReportCreator
|
|
396
396
|
def get_user_data()
|
397
397
|
return @test_case_user_data,@test_case_user_data_columns
|
398
398
|
end
|
399
|
-
|
399
|
+
|
400
400
|
#This method sets user data to display in chronological table
|
401
401
|
#
|
402
402
|
# === params
|
@@ -450,13 +450,13 @@ module TDriverReportCreator
|
|
450
450
|
FileUtils.mkdir_p @report_folder+'/environment'
|
451
451
|
FileUtils.mkdir_p @report_folder+'/cases'
|
452
452
|
FileUtils.mkdir_p @report_folder+'/junit_xml'
|
453
|
-
|
453
|
+
|
454
454
|
else
|
455
455
|
if b_fixed_report_folder==true
|
456
456
|
FileUtils::remove_entry_secure(@report_folder, :force => true)
|
457
457
|
FileUtils.mkdir_p @report_folder+'/environment'
|
458
458
|
FileUtils.mkdir_p @report_folder+'/cases'
|
459
|
-
FileUtils.mkdir_p @report_folder+'/junit_xml'
|
459
|
+
FileUtils.mkdir_p @report_folder+'/junit_xml'
|
460
460
|
end
|
461
461
|
end
|
462
462
|
write_style_sheet(@report_folder+'/tdriver_report_style.css')
|
@@ -500,7 +500,7 @@ module TDriverReportCreator
|
|
500
500
|
write_page_end(@report_folder+'/index.html')
|
501
501
|
end
|
502
502
|
rescue Exception => e
|
503
|
-
Kernel::raise e, "Unable to update summary page",
|
503
|
+
Kernel::raise e, "Unable to update summary page", e.backtrace
|
504
504
|
end
|
505
505
|
return nil
|
506
506
|
end
|
@@ -729,7 +729,7 @@ module TDriverReportCreator
|
|
729
729
|
# === raises
|
730
730
|
def get_sut_total_dump_count(sut_id, sut_attributes)
|
731
731
|
|
732
|
-
dump_count=sut_attributes[:sut].dump_count
|
732
|
+
dump_count=sut_attributes[:sut].dump_count
|
733
733
|
@total_dump_count[sut_id.to_sym]=dump_count
|
734
734
|
@total_dump_count
|
735
735
|
|
@@ -760,7 +760,15 @@ module TDriverReportCreator
|
|
760
760
|
@total_sent_data[sut_id.to_sym]=data
|
761
761
|
@total_sent_data
|
762
762
|
end
|
763
|
-
|
763
|
+
|
764
|
+
def calculate_total_values_from_hash(values)
|
765
|
+
total=0
|
766
|
+
values.each_value do |val|
|
767
|
+
total+=val
|
768
|
+
end
|
769
|
+
total
|
770
|
+
end
|
771
|
+
|
764
772
|
def write_to_result_storage(status,
|
765
773
|
testcase,
|
766
774
|
group,
|
@@ -774,15 +782,15 @@ module TDriverReportCreator
|
|
774
782
|
log='',
|
775
783
|
comment='',
|
776
784
|
link='',
|
777
|
-
total_dump=
|
778
|
-
total_sent=
|
779
|
-
total_received=
|
785
|
+
total_dump=0,
|
786
|
+
total_sent=0,
|
787
|
+
total_received=0 )
|
780
788
|
while $result_storage_in_use==true
|
781
789
|
sleep 1
|
782
790
|
end
|
783
791
|
$result_storage_in_use=true
|
784
792
|
begin
|
785
|
-
storage_file=nil
|
793
|
+
storage_file=nil
|
786
794
|
html_link=status+'_'+index.to_s+'_'+testcase+'/index.html' if link==''
|
787
795
|
storage_file='all_cases.xml'
|
788
796
|
|
@@ -818,12 +826,12 @@ module TDriverReportCreator
|
|
818
826
|
test_link = Nokogiri::XML::Node.new("link",test)
|
819
827
|
test_link.content = html_link
|
820
828
|
test_dump_count = Nokogiri::XML::Node.new("dump_count",test)
|
821
|
-
test_dump_count.content = total_dump
|
829
|
+
test_dump_count.content = calculate_total_values_from_hash(total_dump)
|
822
830
|
test_sent_bytes = Nokogiri::XML::Node.new("sent_bytes",test)
|
823
|
-
test_sent_bytes.content = total_sent
|
831
|
+
test_sent_bytes.content = calculate_total_values_from_hash(total_sent)
|
824
832
|
test_received_bytes = Nokogiri::XML::Node.new("received_bytes",test)
|
825
|
-
test_received_bytes.content = total_received
|
826
|
-
|
833
|
+
test_received_bytes.content = calculate_total_values_from_hash(total_received)
|
834
|
+
|
827
835
|
test << test_name
|
828
836
|
test << test_group
|
829
837
|
test << test_reboots
|
@@ -839,10 +847,10 @@ module TDriverReportCreator
|
|
839
847
|
test << test_dump_count
|
840
848
|
test << test_sent_bytes
|
841
849
|
test << test_received_bytes
|
842
|
-
|
850
|
+
|
843
851
|
if user_data!=nil && !user_data.empty?
|
844
852
|
test_data = Nokogiri::XML::Node.new("user_display_data",test)
|
845
|
-
user_data.each { |key,value|
|
853
|
+
user_data.each { |key,value|
|
846
854
|
data_value=Nokogiri::XML::Node.new("data",test_data)
|
847
855
|
data_value.content = value.to_s
|
848
856
|
data_value.set_attribute("id",key.to_s)
|
@@ -878,13 +886,13 @@ module TDriverReportCreator
|
|
878
886
|
xml.log log
|
879
887
|
xml.comment comment
|
880
888
|
xml.link html_link
|
881
|
-
xml.dump_count total_dump
|
882
|
-
xml.sent_bytes total_sent
|
883
|
-
xml.received_bytes total_received
|
889
|
+
xml.dump_count calculate_total_values_from_hash(total_dump)
|
890
|
+
xml.sent_bytes calculate_total_values_from_hash(total_sent)
|
891
|
+
xml.received_bytes calculate_total_values_from_hash(total_received)
|
884
892
|
if user_data!=nil && !user_data.empty?
|
885
893
|
xml.user_display_data {
|
886
894
|
(0..counter).each { |i|
|
887
|
-
xml.data("id"=>user_data_keys.at(i).to_s){
|
895
|
+
xml.data("id"=>user_data_keys.at(i).to_s){
|
888
896
|
xml.text user_data_values.at(i).to_s{
|
889
897
|
}
|
890
898
|
}
|
@@ -903,7 +911,7 @@ module TDriverReportCreator
|
|
903
911
|
$stderr.puts "caught exception when writing results: #{e}"
|
904
912
|
end
|
905
913
|
end
|
906
|
-
|
914
|
+
|
907
915
|
def read_result_storage(results)
|
908
916
|
while $result_storage_in_use==true
|
909
917
|
sleep 1
|
@@ -925,7 +933,7 @@ module TDriverReportCreator
|
|
925
933
|
reboots=node.search("reboots").text #2
|
926
934
|
crashes=node.search("crashes").text #3
|
927
935
|
start_time=node.search("start_time").text #4
|
928
|
-
duration=node.search("duration").text #5
|
936
|
+
duration="%0.2f" % node.search("duration").text #5
|
929
937
|
memory_usage=node.search("memory_usage").text #6
|
930
938
|
status=node.search("status").text #7
|
931
939
|
index=node.search("index").text #8
|
@@ -935,14 +943,13 @@ module TDriverReportCreator
|
|
935
943
|
dump_count=node.search("dump_count").text #12
|
936
944
|
sent_bytes=node.search("sent_bytes").text #13
|
937
945
|
received_bytes=node.search("received_bytes").text #14
|
938
|
-
|
939
946
|
user_data = Hash.new
|
940
947
|
node.xpath("user_display_data/data").each do |data_node|
|
941
|
-
value_name = data_node.get_attribute("id")
|
948
|
+
value_name = data_node.get_attribute("id")
|
942
949
|
val = data_node.text
|
943
950
|
user_data[value_name] = val
|
944
951
|
end
|
945
|
-
|
952
|
+
|
946
953
|
case results
|
947
954
|
when 'passed'
|
948
955
|
if @pass_statuses.include?(status)
|
@@ -1167,11 +1174,11 @@ module TDriverReportCreator
|
|
1167
1174
|
def update_test_case_summary_pages(status,rewrite=false)
|
1168
1175
|
|
1169
1176
|
@all_cases_arr=Array.new
|
1170
|
-
begin
|
1177
|
+
begin
|
1171
1178
|
case status
|
1172
1179
|
when 'passed'
|
1173
1180
|
update_test_case_summary_page(status,rewrite,'Passed')
|
1174
|
-
|
1181
|
+
|
1175
1182
|
when 'failed'
|
1176
1183
|
update_test_case_summary_page(status,rewrite,'Failed')
|
1177
1184
|
|
@@ -1216,7 +1223,7 @@ module TDriverReportCreator
|
|
1216
1223
|
end
|
1217
1224
|
|
1218
1225
|
def update_test_case_summary_pages_for_crashes_and_reboots(rewrite=false)
|
1219
|
-
|
1226
|
+
|
1220
1227
|
begin
|
1221
1228
|
update_test_case_summary_page('crash',rewrite,'Crash')
|
1222
1229
|
update_test_case_summary_page('reboot',rewrite,'Reboot')
|
@@ -1225,13 +1232,13 @@ module TDriverReportCreator
|
|
1225
1232
|
end
|
1226
1233
|
return nil
|
1227
1234
|
end
|
1228
|
-
|
1235
|
+
|
1229
1236
|
def create_csv
|
1230
1237
|
storage_file='all_cases.xml'
|
1231
1238
|
csv_file = 'all_cases.csv'
|
1232
1239
|
csv_array = Array.new
|
1233
1240
|
not_added=false
|
1234
|
-
|
1241
|
+
|
1235
1242
|
file=@report_folder+'/'+storage_file
|
1236
1243
|
csv = nil
|
1237
1244
|
begin
|
@@ -1241,10 +1248,10 @@ module TDriverReportCreator
|
|
1241
1248
|
xml_data = Nokogiri::XML(io){ |config| config.options = Nokogiri::XML::ParseOptions::STRICT }
|
1242
1249
|
io.close
|
1243
1250
|
xml_data.root.xpath("//tests/test").each do |node|
|
1244
|
-
|
1251
|
+
|
1245
1252
|
line=Array.new
|
1246
1253
|
first_line=Array.new
|
1247
|
-
|
1254
|
+
|
1248
1255
|
value=node.search("name").text
|
1249
1256
|
first_line<<"name" if !not_added
|
1250
1257
|
line<<value
|
@@ -1281,6 +1288,6 @@ module TDriverReportCreator
|
|
1281
1288
|
puts e.to_s
|
1282
1289
|
end
|
1283
1290
|
end
|
1284
|
-
|
1291
|
+
|
1285
1292
|
end
|
1286
1293
|
end
|
@@ -17,8 +17,10 @@
|
|
17
17
|
##
|
18
18
|
############################################################################
|
19
19
|
|
20
|
+
include TDriverReportJavascript
|
20
21
|
|
21
22
|
module TDriverReportWriter
|
23
|
+
|
22
24
|
def write_style_sheet(page)
|
23
25
|
css='body
|
24
26
|
{
|
@@ -29,7 +31,7 @@ module TDriverReportWriter
|
|
29
31
|
.navigation_section
|
30
32
|
{
|
31
33
|
background-color:#0191C8;
|
32
|
-
width:
|
34
|
+
width:1024px;
|
33
35
|
height:40px;
|
34
36
|
margin-left : auto;
|
35
37
|
margin-right: auto;
|
@@ -46,7 +48,7 @@ module TDriverReportWriter
|
|
46
48
|
.page_navigation_section
|
47
49
|
{
|
48
50
|
background-color:#0191C8;
|
49
|
-
width:
|
51
|
+
width:1024px;
|
50
52
|
height:40px;
|
51
53
|
margin-left : auto;
|
52
54
|
margin-right: auto;
|
@@ -65,7 +67,7 @@ module TDriverReportWriter
|
|
65
67
|
.summary
|
66
68
|
{
|
67
69
|
background-color:White;
|
68
|
-
width:
|
70
|
+
width:1024px;
|
69
71
|
height:100%;
|
70
72
|
margin-left : auto;
|
71
73
|
margin-right: auto;
|
@@ -80,7 +82,7 @@ module TDriverReportWriter
|
|
80
82
|
.summary_total_run
|
81
83
|
{
|
82
84
|
background-color:White;
|
83
|
-
width:
|
85
|
+
width:1024px;
|
84
86
|
height:100%;
|
85
87
|
margin-left : auto;
|
86
88
|
margin-right: auto;
|
@@ -95,7 +97,7 @@ module TDriverReportWriter
|
|
95
97
|
.summary_passed
|
96
98
|
{
|
97
99
|
background-color:White;
|
98
|
-
width:
|
100
|
+
width:1024px;
|
99
101
|
height:100%;
|
100
102
|
margin-left : auto;
|
101
103
|
margin-right: auto;
|
@@ -110,7 +112,7 @@ module TDriverReportWriter
|
|
110
112
|
.summary_crash
|
111
113
|
{
|
112
114
|
background-color:White;
|
113
|
-
width:
|
115
|
+
width:1024px;
|
114
116
|
height:100%;
|
115
117
|
margin-left : auto;
|
116
118
|
margin-right: auto;
|
@@ -125,7 +127,7 @@ module TDriverReportWriter
|
|
125
127
|
.summary_reboot
|
126
128
|
{
|
127
129
|
background-color:White;
|
128
|
-
width:
|
130
|
+
width:1024px;
|
129
131
|
height:100%;
|
130
132
|
margin-left : auto;
|
131
133
|
margin-right: auto;
|
@@ -140,7 +142,7 @@ module TDriverReportWriter
|
|
140
142
|
.statistics
|
141
143
|
{
|
142
144
|
background-color:White;
|
143
|
-
width:
|
145
|
+
width:1024px;
|
144
146
|
height:100%;
|
145
147
|
margin-left : auto;
|
146
148
|
margin-right: auto;
|
@@ -155,7 +157,7 @@ module TDriverReportWriter
|
|
155
157
|
.summary_failed
|
156
158
|
{
|
157
159
|
background-color:White;
|
158
|
-
width:
|
160
|
+
width:1024px;
|
159
161
|
height:100%;
|
160
162
|
margin-left : auto;
|
161
163
|
margin-right: auto;
|
@@ -170,7 +172,7 @@ module TDriverReportWriter
|
|
170
172
|
.summary_not_run
|
171
173
|
{
|
172
174
|
background-color:White;
|
173
|
-
width:
|
175
|
+
width:1024px;
|
174
176
|
height:100%;
|
175
177
|
margin-left : auto;
|
176
178
|
margin-right: auto;
|
@@ -185,7 +187,7 @@ module TDriverReportWriter
|
|
185
187
|
.test_passed
|
186
188
|
{
|
187
189
|
background-color:White;
|
188
|
-
width:
|
190
|
+
width:1024px;
|
189
191
|
height:100%;
|
190
192
|
margin-left : auto;
|
191
193
|
margin-right: auto;
|
@@ -200,7 +202,7 @@ module TDriverReportWriter
|
|
200
202
|
.test_failed
|
201
203
|
{
|
202
204
|
background-color:White;
|
203
|
-
width:
|
205
|
+
width:1024px;
|
204
206
|
height:100%;
|
205
207
|
margin-left : auto;
|
206
208
|
margin-right: auto;
|
@@ -215,7 +217,7 @@ module TDriverReportWriter
|
|
215
217
|
.test_not_run
|
216
218
|
{
|
217
219
|
background-color:White;
|
218
|
-
width:
|
220
|
+
width:1024px;
|
219
221
|
height:100%;
|
220
222
|
margin-left : auto;
|
221
223
|
margin-right: auto;
|
@@ -230,7 +232,7 @@ module TDriverReportWriter
|
|
230
232
|
.environment
|
231
233
|
{
|
232
234
|
background-color:White;
|
233
|
-
width:
|
235
|
+
width:1024px;
|
234
236
|
height:100%;
|
235
237
|
margin-left : auto;
|
236
238
|
margin-right: auto;
|
@@ -245,7 +247,7 @@ module TDriverReportWriter
|
|
245
247
|
.page_title
|
246
248
|
{
|
247
249
|
background-color:#0191C8;
|
248
|
-
width:
|
250
|
+
width:1024px;
|
249
251
|
min-height:100%;
|
250
252
|
margin-left : auto;
|
251
253
|
margin-right: auto;
|
@@ -318,7 +320,7 @@ a:hover { color:White; background-color:#005B9A;}
|
|
318
320
|
}
|
319
321
|
|
320
322
|
#statistics_table
|
321
|
-
{
|
323
|
+
{
|
322
324
|
font-size: 12px;
|
323
325
|
text-align: left;
|
324
326
|
border-collapse: collapse;
|
@@ -328,12 +330,12 @@ a:hover { color:White; background-color:#005B9A;}
|
|
328
330
|
font-size: 13px;
|
329
331
|
font-weight: normal;
|
330
332
|
padding: 8px;
|
331
|
-
background: #b9c9fe;
|
333
|
+
background: #b9c9fe;
|
332
334
|
color: #039;
|
333
335
|
}
|
334
336
|
#statistics_table td
|
335
337
|
{
|
336
|
-
padding: 8px;
|
338
|
+
padding: 8px;
|
337
339
|
border-bottom: 1px solid Black;
|
338
340
|
color: #669;
|
339
341
|
border-top: 1px solid transparent;
|
@@ -437,8 +439,14 @@ display: none;
|
|
437
439
|
css=nil
|
438
440
|
end
|
439
441
|
def format_duration(seconds)
|
440
|
-
|
441
|
-
|
442
|
+
if Gem.available?('chronic_duration')
|
443
|
+
require 'chronic_duration'
|
444
|
+
duration_str=ChronicDuration.output(seconds)
|
445
|
+
else
|
446
|
+
m, s = seconds.divmod(60)
|
447
|
+
duration_str="#{m}m#{'%.3f' % s}s"
|
448
|
+
end
|
449
|
+
duration_str
|
442
450
|
end
|
443
451
|
def behaviour_log_summary(log,log_format='string')
|
444
452
|
begin
|
@@ -578,7 +586,7 @@ display: none;
|
|
578
586
|
when "TDriver test results"
|
579
587
|
stylesheet='<link rel="stylesheet" title="TDriverReportStyle" href="tdriver_report_style.css"/>'
|
580
588
|
when "TDriver test environment","Total run","Statistics","Passed","Failed","Not run","Crash","Reboot","TDriver log"
|
581
|
-
stylesheet='<link rel="stylesheet" title="TDriverReportStyle" href="../tdriver_report_style.css"/>'
|
589
|
+
stylesheet='<link rel="stylesheet" title="TDriverReportStyle" href="../tdriver_report_style.css"/>'
|
582
590
|
else
|
583
591
|
stylesheet='<link rel="stylesheet" title="TDriverReportStyle" href="../../tdriver_report_style.css"/>'
|
584
592
|
end
|
@@ -586,7 +594,7 @@ display: none;
|
|
586
594
|
'<html xmlns="http://www.w3.org/1999/xhtml">'<<
|
587
595
|
'<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE"><META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">'<<
|
588
596
|
stylesheet<<
|
589
|
-
|
597
|
+
get_expand_collapse_java_script()<<
|
590
598
|
'<title>'+title+'</title>'<<
|
591
599
|
'</head><body>'
|
592
600
|
File.open(page, 'w') do |f2|
|
@@ -816,15 +824,15 @@ display: none;
|
|
816
824
|
html_body='</dd>'<<
|
817
825
|
'</dl>'
|
818
826
|
html_body
|
819
|
-
end
|
827
|
+
end
|
820
828
|
def write_duration_graph(page, folder, graph_file_name, tc_arr)
|
821
|
-
|
829
|
+
|
822
830
|
tdriver_group=ReportingStatistics.new(tc_arr)
|
823
831
|
tdriver_group.generate_duration_graph(folder + '/cases/' + graph_file_name)
|
824
|
-
|
832
|
+
|
825
833
|
html_body=Array.new
|
826
834
|
html_body << '<div>'
|
827
|
-
html_body << '<H1 ALIGN=center><img border="0" src="./'+graph_file_name+'"/></H1>'
|
835
|
+
html_body << '<H1 ALIGN=center><img border="0" src="./'+graph_file_name+'"/></H1>'
|
828
836
|
html_body << '</div>'
|
829
837
|
File.open(page, 'a') do |f2|
|
830
838
|
f2.puts html_body
|
@@ -965,8 +973,15 @@ display: none;
|
|
965
973
|
fail_rate=0
|
966
974
|
pass_rate=0
|
967
975
|
if total_run.to_i > 0
|
968
|
-
|
969
|
-
|
976
|
+
begin
|
977
|
+
fail_rate=(total_failed.to_f/(total_run.to_f-total_not_run.to_f))*100
|
978
|
+
pass_rate=(total_passed.to_f/(total_run.to_f-total_not_run.to_f))*100
|
979
|
+
fail_rate="%0.2f" % fail_rate
|
980
|
+
pass_rate="%0.2f" % pass_rate
|
981
|
+
rescue
|
982
|
+
fail_rate="0"
|
983
|
+
pass_rate="0"
|
984
|
+
end
|
970
985
|
end
|
971
986
|
|
972
987
|
html_body='<div class="page_title"><center><h1>TDriver test results</h1></center></div>'<<
|
@@ -1031,18 +1046,18 @@ display: none;
|
|
1031
1046
|
end
|
1032
1047
|
html_body << '<tr>'<<
|
1033
1048
|
'<td><b>Pass %</b></td>'<<
|
1034
|
-
'<td>'+pass_rate.
|
1049
|
+
'<td>'+pass_rate.to_s+'%</td>'<<
|
1035
1050
|
'</tr>'<<
|
1036
1051
|
'<tr>'<<
|
1037
1052
|
'<td><b>Fail %</b></td>'<<
|
1038
|
-
'<td>'+fail_rate.
|
1053
|
+
'<td>'+fail_rate.to_s+'%</td>'<<
|
1039
1054
|
'</tr>'<<
|
1040
1055
|
'</table></div><p />'
|
1041
1056
|
if summary_arr
|
1042
1057
|
html_body << '<div class="statistics">'
|
1043
|
-
|
1044
|
-
|
1045
|
-
|
1058
|
+
tdriver_group=ReportingStatistics.new(summary_arr,true)
|
1059
|
+
html_result=tdriver_group.generate_statistics_table()
|
1060
|
+
html_body << html_result << '</div>'
|
1046
1061
|
end
|
1047
1062
|
|
1048
1063
|
File.open(page, 'a') do |f2|
|
@@ -1280,10 +1295,10 @@ display: none;
|
|
1280
1295
|
|
1281
1296
|
def write_page_navigation_div(page,report_page,report_pages)
|
1282
1297
|
page_with_no_number=page.gsub("#{report_page}_","")
|
1283
|
-
page_base_name=File.basename(page_with_no_number)
|
1298
|
+
page_base_name=File.basename(page_with_no_number)
|
1284
1299
|
div_body=Array.new
|
1285
1300
|
div_body<<"<div class=\"page_navigation_section\"><center>"<<
|
1286
|
-
"<ul id=\"navigation\">"
|
1301
|
+
"<ul id=\"navigation\">"
|
1287
1302
|
max=10
|
1288
1303
|
start_page=report_page/max
|
1289
1304
|
if start_page==0
|
@@ -1319,8 +1334,8 @@ display: none;
|
|
1319
1334
|
|
1320
1335
|
def write_page_end(page,report_page=nil,report_pages=nil)
|
1321
1336
|
page_ready=nil
|
1322
|
-
if report_page!=nil
|
1323
|
-
navigation_div="#{write_page_navigation_div(page,report_page,report_pages)}"
|
1337
|
+
if report_page!=nil
|
1338
|
+
navigation_div="#{write_page_navigation_div(page,report_page,report_pages)}"
|
1324
1339
|
html_end="#{navigation_div}</body></html>"
|
1325
1340
|
doc = Nokogiri::HTML(open(page))
|
1326
1341
|
b_div_found=false
|
@@ -1328,10 +1343,10 @@ display: none;
|
|
1328
1343
|
if div.text.include?('Next')
|
1329
1344
|
page_ready=report_page
|
1330
1345
|
end
|
1331
|
-
b_div_found=true
|
1346
|
+
b_div_found=true
|
1332
1347
|
div.replace(Nokogiri.make(navigation_div))
|
1333
|
-
end
|
1334
|
-
if b_div_found==false
|
1348
|
+
end
|
1349
|
+
if b_div_found==false
|
1335
1350
|
File.open(page, 'a') do |f|
|
1336
1351
|
f.puts html_end
|
1337
1352
|
end
|
@@ -1345,26 +1360,12 @@ display: none;
|
|
1345
1360
|
File.open(page, 'a') do |f|
|
1346
1361
|
f.puts html_end
|
1347
1362
|
end
|
1348
|
-
end
|
1363
|
+
end
|
1349
1364
|
html_end=nil
|
1350
1365
|
page_ready
|
1351
1366
|
end
|
1352
1367
|
def get_java_script()
|
1353
|
-
|
1354
|
-
'/* Only set closed if JS-enabled */'<<
|
1355
|
-
"document.getElementsByTagName('html')[0].className = 'isJS';"<<
|
1356
|
-
'function tog(dt)'<<
|
1357
|
-
'{'<<
|
1358
|
-
'var display, dd=dt;'<<
|
1359
|
-
'/* get dd */'<<
|
1360
|
-
"do{ dd = dd.nextSibling } while(dd.tagName!='DD');"<<
|
1361
|
-
'toOpen =!dd.style.display;'<<
|
1362
|
-
"dd.style.display = toOpen? 'block':'';"<<
|
1363
|
-
"dt.getElementsByTagName('span')[0].innerHTML"<<
|
1364
|
-
"= toOpen? '<input id=\"Button1\" type=\"button\" value=\"Close\" class=\"btn\" style=\"background-color: #FFFFFF\" />':'<input id=\"Button1\" type=\"button\" value=\"Open\" class=\"btn\" />' ;"<<
|
1365
|
-
'}'<<
|
1366
|
-
'</script>'
|
1367
|
-
java_script
|
1368
|
+
get_expand_collapse_java_script()
|
1368
1369
|
end
|
1369
1370
|
def format_user_log_table(user_data_rows,user_data_columns)
|
1370
1371
|
begin
|