testability-driver 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (116) hide show
  1. data/lib/tdriver-devtools/behaviour/xml/rdoc_behaviour_xml_generator.rb +2 -2
  2. data/lib/tdriver-devtools/tdriver-devtools.rb +1 -1
  3. data/lib/tdriver-devtools/tests/feature_tests/lib/custom_rdoc_generator.rb +3 -3
  4. data/lib/tdriver/base/behaviour/behaviours/object_behaviour_composition.rb +6 -1
  5. data/lib/tdriver/base/behaviour/behaviours/object_behaviour_description.rb +5 -3
  6. data/lib/tdriver/base/behaviour/behaviours/object_composition.rb +1 -1
  7. data/lib/tdriver/base/behaviour/factory.rb +225 -225
  8. data/lib/tdriver/base/errors.rb +1 -1
  9. data/lib/tdriver/base/state_object.rb +227 -179
  10. data/lib/tdriver/base/sut/controller.rb +2 -2
  11. data/lib/tdriver/base/sut/factory.rb +190 -182
  12. data/lib/tdriver/base/sut/generic/behaviours/application.rb +69 -25
  13. data/lib/tdriver/base/sut/generic/behaviours/controller.rb +1 -1
  14. data/lib/tdriver/base/sut/generic/behaviours/find.rb +4 -4
  15. data/lib/tdriver/base/sut/generic/behaviours/flash_behaviour.rb +3 -3
  16. data/lib/tdriver/base/sut/generic/behaviours/sut.rb +350 -165
  17. data/lib/tdriver/base/sut/generic/behaviours/switchbox_behaviour.rb +9 -9
  18. data/lib/tdriver/base/sut/generic/behaviours/verification.rb +191 -103
  19. data/lib/tdriver/base/sut/generic/commands/application.rb +1 -1
  20. data/lib/tdriver/base/sut/generic/commands/key_sequence.rb +1 -1
  21. data/lib/tdriver/base/sut/generic/commands/screen_capture.rb +1 -1
  22. data/lib/tdriver/base/sut/generic/plugin.rb +1 -1
  23. data/lib/tdriver/base/sut/sut.rb +5 -1
  24. data/lib/tdriver/base/test_object/abstract.rb +136 -151
  25. data/lib/tdriver/base/test_object/adapter.rb +293 -82
  26. data/lib/tdriver/base/test_object/behaviours/syncronization.rb +20 -17
  27. data/lib/tdriver/base/test_object/behaviours/test_object.rb +159 -532
  28. data/lib/tdriver/base/test_object/cache.rb +1 -1
  29. data/lib/tdriver/base/test_object/factory.rb +254 -605
  30. data/lib/tdriver/base/test_object/identificator.rb +1 -1
  31. data/lib/tdriver/base/test_object/loader.rb +1 -1
  32. data/lib/tdriver/base/test_object/verification.rb +17 -17
  33. data/lib/tdriver/loader.rb +20 -9
  34. data/lib/tdriver/report/report.rb +5 -0
  35. data/lib/tdriver/report/report_creator.rb +2 -2
  36. data/lib/tdriver/report/report_cucumber_listener.rb +4 -4
  37. data/lib/tdriver/report/report_cucumber_reporter.rb +4 -4
  38. data/lib/tdriver/report/report_execution_statistics.rb +22 -22
  39. data/lib/tdriver/report/report_grouping.rb +2 -2
  40. data/lib/tdriver/report/report_javascript.rb +11 -4
  41. data/lib/tdriver/report/report_test_case_run.rb +2 -2
  42. data/lib/tdriver/report/report_test_run.rb +5 -5
  43. data/lib/tdriver/report/report_test_unit.rb +74 -26
  44. data/lib/tdriver/report/report_writer.rb +70 -13
  45. data/lib/tdriver/tdriver.rb +17 -8
  46. data/lib/tdriver/util/common/array.rb +1 -1
  47. data/lib/tdriver/util/common/crc16.rb +1 -1
  48. data/lib/tdriver/util/common/environment.rb +1 -1
  49. data/lib/tdriver/util/common/file.rb +18 -9
  50. data/lib/tdriver/util/common/gem.rb +1 -1
  51. data/lib/tdriver/util/common/hash.rb +21 -0
  52. data/lib/tdriver/util/common/kernel.rb +1 -1
  53. data/lib/tdriver/util/common/loader.rb +5 -2
  54. data/lib/tdriver/util/common/numeric.rb +54 -3
  55. data/lib/tdriver/util/common/retryable.rb +30 -12
  56. data/lib/tdriver/util/common/stackable.rb +185 -0
  57. data/lib/tdriver/util/common/string.rb +21 -5
  58. data/lib/tdriver/util/{dbaccess/dbaccess.rb → database/access.rb} +4 -1
  59. data/lib/tdriver/util/{dbaccess/dbconnection.rb → database/connection.rb} +3 -0
  60. data/lib/tdriver/util/{dbaccess → database}/error.rb +0 -1
  61. data/lib/tdriver/util/{dbaccess → database}/loader.rb +5 -6
  62. data/lib/tdriver/util/{dynamic_attribute_filter.rb → filters/dynamic_attributes.rb} +1 -1
  63. data/lib/tdriver/util/hooking/hooking.rb +477 -0
  64. data/lib/tdriver/util/loader.rb +35 -29
  65. data/lib/tdriver/util/localisation/error.rb +0 -1
  66. data/lib/tdriver/util/localisation/loader.rb +1 -4
  67. data/lib/tdriver/util/localisation/localisation.rb +30 -27
  68. data/lib/tdriver/util/{common.rb → logger/loader.rb} +2 -4
  69. data/lib/tdriver/util/logger/logger.rb +574 -0
  70. data/lib/tdriver/util/operator_data/loader.rb +4 -3
  71. data/lib/tdriver/util/operator_data/operator_data.rb +5 -5
  72. data/lib/tdriver/util/parameter/parameter.rb +7 -1
  73. data/lib/tdriver/util/parameter/parameter_hash.rb +1 -1
  74. data/lib/tdriver/util/parameter/parameter_template.rb +1 -1
  75. data/lib/tdriver/util/parameter/parameter_user_api.rb +28 -20
  76. data/lib/tdriver/util/parameter/parameter_xml.rb +1 -1
  77. data/lib/tdriver/util/plugin/abstract.rb +1 -1
  78. data/lib/tdriver/util/plugin/service.rb +1 -1
  79. data/lib/tdriver/util/{localisation.rb → recorder/loader.rb} +4 -3
  80. data/lib/tdriver/util/recorder/recorder.rb +66 -0
  81. data/lib/tdriver/util/recorder/scripter.rb +258 -0
  82. data/lib/tdriver/util/{stats.rb → statistics/statistics.rb} +7 -8
  83. data/lib/tdriver/util/user_data/error.rb +0 -1
  84. data/lib/tdriver/util/user_data/loader.rb +1 -2
  85. data/lib/tdriver/util/user_data/user_data.rb +6 -6
  86. data/lib/tdriver/util/video/camera.rb +67 -0
  87. data/lib/tdriver/util/video/camera_linux.rb +139 -0
  88. data/lib/tdriver/util/video/camera_windows.rb +174 -0
  89. data/lib/tdriver/util/video/loader.rb +31 -0
  90. data/lib/tdriver/util/video/video_utils.rb +139 -0
  91. data/lib/tdriver/util/xml/abstraction.rb +56 -5
  92. data/lib/tdriver/util/xml/builder.rb +2 -5
  93. data/lib/tdriver/util/{parameter.rb → xml/comment.rb} +10 -2
  94. data/lib/tdriver/util/xml/loader.rb +32 -22
  95. data/lib/tdriver/util/xml/nil_node.rb +2 -2
  96. data/lib/tdriver/util/xml/parsers/loader.rb +0 -1
  97. data/lib/tdriver/util/xml/parsers/nokogiri/abstraction.rb +18 -44
  98. data/lib/tdriver/util/xml/parsers/nokogiri/attribute.rb +9 -13
  99. data/lib/tdriver/util/xml/parsers/nokogiri/builder.rb +9 -3
  100. data/lib/tdriver/util/xml/parsers/nokogiri/comment.rb +39 -0
  101. data/lib/tdriver/util/xml/parsers/nokogiri/document.rb +6 -11
  102. data/lib/tdriver/util/xml/parsers/nokogiri/element.rb +2 -122
  103. data/lib/tdriver/util/xml/parsers/nokogiri/loader.rb +26 -16
  104. data/lib/tdriver/util/xml/parsers/nokogiri/node.rb +203 -0
  105. data/lib/tdriver/util/xml/parsers/nokogiri/nodeset.rb +1 -2
  106. data/lib/tdriver/util/xml/parsers/nokogiri/text.rb +2 -20
  107. data/lib/tdriver/util/xml/xml.rb +52 -20
  108. data/lib/tdriver/verify/verify.rb +238 -81
  109. data/xml/behaviours/generic.xml +12 -10
  110. metadata +156 -180
  111. data/lib/tdriver/base/test_object/factory_new.rb +0 -202
  112. data/lib/tdriver/util/hooking.rb +0 -434
  113. data/lib/tdriver/util/logger.rb +0 -506
  114. data/lib/tdriver/util/recorder.rb +0 -297
  115. data/lib/tdriver/util/video_utils.rb +0 -384
  116. data/lib/tdriver/util/xml/nil_element.rb +0 -89
@@ -511,7 +511,7 @@ module MobyBase
511
511
  end
512
512
 
513
513
  # enable hooking for performance measurement & debug logging
514
- MobyUtil::Hooking.instance.hook_methods( self ) if defined?( MobyUtil::Hooking )
514
+ TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
515
515
 
516
516
  end # TestObjectIdentificator
517
517
 
@@ -21,7 +21,7 @@
21
21
  require File.expand_path( File.join( File.dirname( __FILE__ ), 'abstract' ) )
22
22
 
23
23
  # load test object identificator
24
- require File.expand_path( File.join( File.dirname( __FILE__ ), 'identificator' ) )
24
+ #require File.expand_path( File.join( File.dirname( __FILE__ ), 'identificator' ) )
25
25
 
26
26
  # load test object factory
27
27
  require File.expand_path( File.join( File.dirname( __FILE__ ), 'factory' ) )
@@ -9,13 +9,13 @@ module TDriver
9
9
  # TODO: Document me (TestObjectFactory::check_verify_always_reporting_settings)
10
10
  def check_verify_always_reporting_settings
11
11
 
12
- @@reporter_attached = MobyUtil::Parameter[ :report_attach_continuous_verification_to_reporter, 'false' ]
12
+ @@reporter_attached = $parameters[ :report_attach_continuous_verification_to_reporter, 'false' ]
13
13
 
14
- @@rcv_raise_errors = MobyUtil::Parameter[ :report_continuous_verification_raise_errors, 'true' ]
14
+ @@rcv_raise_errors = $parameters[ :report_continuous_verification_raise_errors, 'true' ]
15
15
 
16
- @@rcv_fail_test_case = MobyUtil::Parameter[ :report_continuous_verification_fail_test_case_on_error, 'true' ]
16
+ @@rcv_fail_test_case = $parameters[ :report_continuous_verification_fail_test_case_on_error, 'true' ]
17
17
 
18
- @@rvc_capture_screen = MobyUtil::Parameter[ :report_continuous_verification_capture_screen_on_error, 'true' ]
18
+ @@rvc_capture_screen = $parameters[ :report_continuous_verification_capture_screen_on_error, 'true' ]
19
19
 
20
20
  end
21
21
 
@@ -35,13 +35,13 @@ module TDriver
35
35
  def initialize_settings
36
36
 
37
37
  # defaults
38
- @@global_reporter_attached = MobyUtil::Parameter[ :report_attach_continuous_verification_to_reporter, 'false' ]
38
+ @@global_reporter_attached = $parameters[ :report_attach_continuous_verification_to_reporter, 'false' ]
39
39
 
40
- @@rcv_global_raise_errors = MobyUtil::Parameter[ :report_continuous_verification_raise_errors, 'true' ]
40
+ @@rcv_global_raise_errors = $parameters[ :report_continuous_verification_raise_errors, 'true' ]
41
41
 
42
- @@rcv_global_fail_test_case = MobyUtil::Parameter[ :report_continuous_verification_fail_test_case_on_error, 'true' ]
42
+ @@rcv_global_fail_test_case = $parameters[ :report_continuous_verification_fail_test_case_on_error, 'true' ]
43
43
 
44
- @@rvc_global_capture_screen = MobyUtil::Parameter[ :report_continuous_verification_capture_screen_on_error, 'true' ]
44
+ @@rvc_global_capture_screen = $parameters[ :report_continuous_verification_capture_screen_on_error, 'true' ]
45
45
 
46
46
  @@inside_verify = false
47
47
 
@@ -64,7 +64,7 @@ module TDriver
64
64
 
65
65
  @@inside_verify = true
66
66
 
67
- logging_enabled = MobyUtil::Logger.instance.enabled
67
+ logging_enabled = $logger.enabled
68
68
 
69
69
  sut.verify_blocks.each do | verify |
70
70
 
@@ -72,7 +72,7 @@ module TDriver
72
72
 
73
73
  begin
74
74
 
75
- MobyUtil::Logger.instance.enabled = false
75
+ $logger.enabled = false
76
76
 
77
77
  begin
78
78
 
@@ -103,8 +103,8 @@ module TDriver
103
103
 
104
104
  TDriverReportAPI::tdriver_report_log("<hr />")
105
105
 
106
- MobyUtil::Logger.instance.enabled = logging_enabled
107
- MobyUtil::Logger.instance.log "behaviour" , "FAIL;Verification #{verify.message.nil? ? '' : '\"' << verify.message << '\" '}failed:#{e.to_s}.\n#{verify.timeout.nil? ? '' : ' using timeout ' + verify.timeout.to_s}.;#{sut.id.to_s+';sut'};{};verify_always;" << verify.expected.to_s
106
+ $logger.enabled = logging_enabled
107
+ $logger.log "behaviour", "FAIL;Verification #{verify.message.nil? ? '' : '\"' << verify.message << '\" '}failed:#{e.to_s}.\n#{verify.timeout.nil? ? '' : ' using timeout ' + verify.timeout.to_s}.;#{sut.id.to_s+';sut'};{};verify_always;" << verify.expected.to_s
108
108
 
109
109
  end
110
110
 
@@ -142,9 +142,9 @@ module TDriver
142
142
 
143
143
  TDriverReportAPI::tdriver_report_log("<hr />")
144
144
 
145
- MobyUtil::Logger.instance.enabled = logging_enabled
145
+ $logger.enabled = logging_enabled
146
146
 
147
- MobyUtil::Logger.instance.log "behaviour" , "FAIL;Verification #{verify.message.nil? ? '' : '\"' << verify.message << '\" '}failed:#{e.to_s}.\n#{verify.timeout.nil? ? '' : ' using timeout ' + verify.timeout.to_s}.;#{sut.id.to_s+';sut'};{};verify_always;" << verify.expected.to_s
147
+ $logger.log "behaviour", "FAIL;Verification #{verify.message.nil? ? '' : '\"' << verify.message << '\" '}failed:#{e.to_s}.\n#{verify.timeout.nil? ? '' : ' using timeout ' + verify.timeout.to_s}.;#{sut.id.to_s+';sut'};{};verify_always;" << verify.expected.to_s
148
148
 
149
149
  end
150
150
 
@@ -152,9 +152,9 @@ module TDriver
152
152
 
153
153
  rescue Exception => e
154
154
 
155
- MobyUtil::Logger.instance.enabled = logging_enabled
155
+ $logger.enabled = logging_enabled
156
156
 
157
- MobyUtil::Logger.instance.log "behaviour" , "FAIL;Verification #{verify.message.nil? ? '' : '\"' << verify.message << '\" '}failed:#{e.to_s}.\n#{verify.timeout.nil? ? '' : ' using timeout ' + verify.timeout.to_s}.;#{sut.id.to_s+';sut'};{};verify_always;" << verify.expected.to_s
157
+ $logger.log "behaviour", "FAIL;Verification #{verify.message.nil? ? '' : '\"' << verify.message << '\" '}failed:#{e.to_s}.\n#{verify.timeout.nil? ? '' : ' using timeout ' + verify.timeout.to_s}.;#{sut.id.to_s+';sut'};{};verify_always;" << verify.expected.to_s
158
158
 
159
159
  @@inside_verify = false
160
160
 
@@ -169,7 +169,7 @@ module TDriver
169
169
 
170
170
  ensure
171
171
 
172
- MobyUtil::Logger.instance.enabled = logging_enabled
172
+ $logger.enabled = logging_enabled
173
173
  @@inside_verify = false
174
174
 
175
175
  end
@@ -19,18 +19,29 @@
19
19
 
20
20
  # load globally used external modules
21
21
  require 'singleton'
22
- require 'set'
23
22
 
24
- # load native extensions if available
25
- begin; require File.expand_path( File.join( File.dirname( __FILE__ ), 'native_extensions' ) ); rescue LoadError; end
23
+ #require 'set'
26
24
 
27
- # generic utility modules
28
- require File.expand_path( File.join( File.dirname( __FILE__ ), 'util/loader' ) )
25
+ begin
26
+
27
+ # load native extensions if available
28
+ require File.expand_path( File.join( File.dirname( __FILE__ ), 'native_extensions' ) )
29
+
30
+ rescue LoadError
31
+
32
+ # do nothing
33
+
34
+ end
35
+
36
+ # utility modules
37
+ require File.expand_path( File.join( File.dirname( __FILE__ ), 'util/loader.rb' ) )
29
38
 
30
39
  # base modules
31
- require File.expand_path( File.join( File.dirname( __FILE__ ), 'base/loader' ) )
40
+ require File.expand_path( File.join( File.dirname( __FILE__ ), 'base/loader.rb' ) )
41
+
42
+ # reporting modules
43
+ require File.expand_path( File.join( File.dirname( __FILE__ ), 'report/report.rb' ) )
32
44
 
33
- # misc modules
34
- require File.expand_path( File.join( File.dirname( __FILE__ ), 'report/report' ) )
35
- require File.expand_path( File.join( File.dirname( __FILE__ ), 'verify/verify' ) )
45
+ # verify module
46
+ require File.expand_path( File.join( File.dirname( __FILE__ ), 'verify/verify.rb' ) )
36
47
 
@@ -23,6 +23,9 @@ require File.expand_path( File.join( File.dirname( __FILE__ ), 'error_recovery/t
23
23
  require File.expand_path( File.join( File.dirname( __FILE__ ), 'report_file_capture' ) )
24
24
  require File.expand_path( File.join( File.dirname( __FILE__ ), 'report_crash_file_capture' ) )
25
25
  require File.expand_path( File.join( File.dirname( __FILE__ ), 'report_javascript' ) )
26
+
27
+ require 'chronic_duration' if Gem.available?('chronic_duration')
28
+
26
29
  require File.expand_path( File.join( File.dirname( __FILE__ ), 'report_writer' ) )
27
30
  require File.expand_path( File.join( File.dirname( __FILE__ ), 'report_combine' ) )
28
31
  require File.expand_path( File.join( File.dirname( __FILE__ ), 'report_data_table' ) )
@@ -42,7 +45,9 @@ require File.expand_path( File.join( File.dirname( __FILE__ ), 'report_data_pres
42
45
 
43
46
 
44
47
  if MobyUtil::Parameter[ :custom_error_recovery_module, nil ]!=nil
48
+
45
49
  require MobyUtil::Parameter[ :custom_error_recovery_module ]
50
+
46
51
  end
47
52
 
48
53
 
@@ -280,7 +280,7 @@ module TDriverReportCreator
280
280
 
281
281
  each_video_device do | video_device, device_index |
282
282
  begin
283
- File.copy( "cam_" + device_index + "_" + @_video_file_name, "cam_" + device_index + "_" + @_previous_video_file_name )
283
+ FileUtils.copy( "cam_" + device_index + "_" + @_video_file_name, "cam_" + device_index + "_" + @_previous_video_file_name )
284
284
  rescue
285
285
  # do nothing..
286
286
  end
@@ -594,4 +594,4 @@ end #TDriverReportCreator
594
594
 
595
595
 
596
596
 
597
-
597
+
@@ -51,21 +51,21 @@ module TDriverReport
51
51
  # === raises
52
52
  def step_name(keyword, step_match, status, source_indent, background)
53
53
  if status == :passed
54
- step_name = step_match.format_args(lambda{|param| "*#{param}*"})
54
+ step_name = step_match.format_args(lambda{|param| "#{param}"})
55
55
  update_test_case("#{step_name} PASSED")
56
56
  @tc_status='passed'
57
57
  end
58
58
  if status == :failed
59
- step_name = step_match.format_args(lambda{|param| "*#{param}*"})
59
+ step_name = step_match.format_args(lambda{|param| "#{param}"})
60
60
  update_test_case("#{step_name} FAILED")
61
61
  @tc_status='failed'
62
62
  end
63
63
  if status == :skipped
64
- step_name = step_match.format_args(lambda{|param| "*#{param}*"})
64
+ step_name = step_match.format_args(lambda{|param| "#{param}"})
65
65
  update_test_case("#{step_name} SKIPPED")
66
66
  end
67
67
  if status == :undefined
68
- step_name = step_match.format_args(lambda{|param| "*#{param}*"})
68
+ step_name = step_match.format_args(lambda{|param| "#{param}"})
69
69
  update_test_case("#{step_name} NOT RUN")
70
70
  @tc_status='not run'
71
71
  end
@@ -49,21 +49,21 @@ module TDriverReport
49
49
  # === raises
50
50
  def step_name(keyword, step_match, status, source_indent, background)
51
51
  if status == :passed
52
- step_name = step_match.format_args(lambda{|param| "*#{param}*"})
52
+ step_name = step_match.format_args(lambda{|param| "#{param}"})
53
53
  update_test_case("#{step_name} PASSED")
54
54
  @tc_status='passed'
55
55
  end
56
56
  if status == :failed
57
- step_name = step_match.format_args(lambda{|param| "*#{param}*"})
57
+ step_name = step_match.format_args(lambda{|param| "#{param}"})
58
58
  update_test_case("#{step_name} FAILED")
59
59
  @tc_status='failed'
60
60
  end
61
61
  if status == :skipped
62
- step_name = step_match.format_args(lambda{|param| "*#{param}*"})
62
+ step_name = step_match.format_args(lambda{|param| "#{param}"})
63
63
  update_test_case("#{step_name} SKIPPED")
64
64
  end
65
65
  if status == :undefined
66
- step_name = step_match.format_args(lambda{|param| "*#{param}*"})
66
+ step_name = step_match.format_args(lambda{|param| "#{param}"})
67
67
  update_test_case("#{step_name} NOT RUN")
68
68
  @tc_status='not run'
69
69
  end
@@ -59,21 +59,21 @@ class ReportingStatistics
59
59
  def generate_statistics_headers()
60
60
  status_heads=Array.new
61
61
  @pass_statuses.each do |status|
62
- status_heads << "<td><b>#{status}</b></td>"
62
+ status_heads << "<th abbr=\"link_column\"><b>#{status}</b></th>"
63
63
  end
64
64
  @fail_statuses.each do |status|
65
- status_heads << "<td><b>#{status}</b></td>"
65
+ status_heads << "<th abbr=\"link_column\"><b>#{status}</b></th>"
66
66
  end
67
67
  @not_run_statuses.each do |status|
68
- status_heads << "<td><b>#{status}</b></td>"
68
+ status_heads << "<th abbr=\"link_column\"><b>#{status}</b></th>"
69
69
  end
70
- status_heads << "<td><b>Reboots</b></td>"
71
- status_heads << "<td><b>Crashes</b></td>"
72
- status_heads << "<td><b>Duration</b></td>"
73
- status_heads << "<td><b>Dump count</b></td>"
74
- status_heads << "<td><b>Sent bytes</b></td>"
75
- status_heads << "<td><b>Received bytes</b></td>"
76
- status_heads << "<td><b>Used mem</b></td>"
70
+ status_heads << "<th abbr=\"link_column\"><b>Reboots</b></th>"
71
+ status_heads << "<th abbr=\"link_column\"><b>Crashes</b></th>"
72
+ status_heads << "<th abbr=\"link_column\"><b>Duration</b></th>"
73
+ status_heads << "<th abbr=\"link_column\"><b>Dump count</b></th>"
74
+ status_heads << "<th abbr=\"link_column\"><b>Sent bytes</b></th>"
75
+ status_heads << "<th abbr=\"link_column\"><b>Received bytes</b></th>"
76
+ status_heads << "<th abbr=\"link_column\"><b>Used mem</b></th>"
77
77
  status_heads
78
78
  end
79
79
 
@@ -289,16 +289,16 @@ class ReportingStatistics
289
289
  table_body=Array.new
290
290
  reset_total_statistics()
291
291
  collect_test_case_statistics()
292
- table_body='<table id="statistics_table" align="center" border="0" cellspacing="0" style="width:100%;">'<<
293
- '<tr>'<<
294
- '<td>'<<
295
- '<b>Row</b></td>'<<
296
- '<td>'<<
297
- '<b>Name</b></td>'<<
298
- '<td>'<<
299
- '<b>Total</b></td>'<<
292
+ table_body='<table id="statistics_table" class="sortable" align="center" border="0" cellspacing="0" style="width:100%;">'<<
293
+ '<thead><tr>'<<
294
+ '<th>'<<
295
+ '<b>Row</b></th>'<<
296
+ '<th abbr="link_column">'<<
297
+ '<b>Name</b></th>'<<
298
+ '<th abbr="link_column">'<<
299
+ '<b>Total</b></th>'<<
300
300
  generate_statistics_headers.to_s <<
301
- '</tr>'
301
+ '</tr></thead><tbody>'
302
302
 
303
303
  test_case_added=Array.new
304
304
  row=1
@@ -326,14 +326,14 @@ class ReportingStatistics
326
326
  end
327
327
 
328
328
 
329
- table_body << '<tr></tr>'
330
- table_body << '<tr>' <<
329
+ table_body << '</tbody>'
330
+ table_body << '<tfoot><tr>' <<
331
331
  '<td></td><td>'<<
332
332
  '<b>Total</b></td>'
333
333
  @total_statistics_arr.each do |statistic|
334
334
  table_body << "<td><b>#{statistic[1]}</b></td>"
335
335
  end
336
- table_body << '</tr>' <<
336
+ table_body << '</tr></tfoot>' <<
337
337
  '</table>'
338
338
 
339
339
 
@@ -102,7 +102,7 @@ class ReportingGroups
102
102
  test_statistics=tog_list_statistics(tc_arr,name,status)
103
103
  if test_statistics != 0
104
104
  html_body='<dl class="togList">'<<
105
- '<dt onclick="tog(this)" style="background-color: #CCCCCC;"><b><span><input id="Button1" type="button" value="Open" class="btn" /></span> '<<
105
+ '<dt onclick="tog(this)" style="background-color: #CCCCCC;"><b><span><input id="Button1" type="button" value="Close" class="btn" /></span> '<<
106
106
  name.to_s<<
107
107
  '</b> '<<
108
108
  '</dt>'<<
@@ -115,7 +115,7 @@ class ReportingGroups
115
115
  end
116
116
  else
117
117
  html_body='<dl class="togList">'<<
118
- '<dt onclick="tog(this)" style="background-color: #CCCCCC;"><b><span><input id="Button1" type="button" value="Open" class="btn" /></span> '<<
118
+ '<dt onclick="tog(this)" style="background-color: #CCCCCC;"><b><span><input id="Button1" type="button" value="Close" class="btn" /></span> '<<
119
119
  name.to_s<<
120
120
  '</b> '<<
121
121
  '</dt>'<<
@@ -30,10 +30,17 @@ module TDriverReportJavascript
30
30
  '/* get dd */'<<
31
31
  "do{ dd = dd.nextSibling } while(dd.tagName!='DD');"<<
32
32
  'toOpen =!dd.style.display;'<<
33
- "dd.style.display = toOpen? 'block':'';"<<
33
+ "dd.style.display = toOpen? 'none':'';"<<
34
34
  "dt.getElementsByTagName('span')[0].innerHTML"<<
35
- "= toOpen? '<input id=\"Button1\" type=\"button\" value=\"Close\" class=\"btn\" style=\"background-color: #FFFFFF\" />':'<input id=\"Button1\" type=\"button\" value=\"Open\" class=\"btn\" />' ;"<<
35
+ "= toOpen? '<input id=\"Button1\" type=\"button\" value=\"Open\" class=\"btn\" />':'<input id=\"Button1\" type=\"button\" value=\"Close\" class=\"btn\" style=\"background-color: #FFFFFF\" />' ;"<<
36
36
  '}'<<
37
+ get_table_sorting_java_script <<
38
+ 'function init()
39
+ {
40
+ var Table1Sorter = new TSorter;
41
+ Table1Sorter.init(\'statistics_table\');
42
+ }
43
+ window.onload = init;'<<
37
44
  '</script>'
38
45
  java_script
39
46
  end
@@ -111,11 +118,11 @@ module TDriverReportJavascript
111
118
  {
112
119
  case \"link_column\":
113
120
  get = function(index){
114
- return getCell(index).firstChild.firstChild.nodeValue;
121
+ return parseFloat(getCell(index).firstChild.firstChild.nodeValue);
115
122
  };
116
123
  break;
117
124
  default:
118
- get = function(index){ return getCell(index).firstChild.nodeValue;};
125
+ get = function(index){ return parseInt(getCell(index).firstChild.nodeValue);};
119
126
  break;
120
127
  };
121
128
  }
@@ -491,13 +491,13 @@ module TDriverReportCreator
491
491
  each_video_device do | video_device, device_index |
492
492
 
493
493
  begin
494
- File.copy("cam_" + device_index + "_" + @tc_video_filename, video_folder)
494
+ FileUtils.copy("cam_" + device_index + "_" + @tc_video_filename, video_folder)
495
495
  rescue
496
496
  # Copy failed, do nothing
497
497
  end
498
498
 
499
499
  begin
500
- File.copy("cam_" + device_index + "_" + @tc_previous_video_filename, video_folder)
500
+ FileUtils.copy("cam_" + device_index + "_" + @tc_previous_video_filename, video_folder)
501
501
  rescue
502
502
  # Copy failed, do nothing
503
503
  end
@@ -473,7 +473,7 @@ module TDriverReportCreator
473
473
  write_page_start(@report_folder+'/cases/statistics_index.html','Statistics')
474
474
  write_page_end(@report_folder+'/cases/statistics_index.html')
475
475
  rescue Exception => e
476
- Kernel::raise e, "Unable to create report folder", caller
476
+ Kernel::raise e, "Unable to create report folder: #{@report_folder}", caller
477
477
  end
478
478
  return nil
479
479
  end
@@ -606,7 +606,7 @@ module TDriverReportCreator
606
606
  MobyUtil::Logger.instance.enabled=false
607
607
  lang_version='-'
608
608
  begin
609
- if MobyUtil::Parameter[sut_id][:type]=='S60' || MobyUtil::Parameter[sut_id][:type]=='S60QT'
609
+ if MobyUtil::Parameter[sut_id][:type]=='S60' || MobyUtil::Parameter[sut_id][:type]=='Symbian'
610
610
  lang_version=sut_attributes[:sut].sysinfo( :Lang_version )
611
611
  end
612
612
  if MobyUtil::Parameter[sut_id][:type]=='QT'
@@ -637,7 +637,7 @@ module TDriverReportCreator
637
637
  MobyUtil::Logger.instance.enabled=false
638
638
  sw_version='-'
639
639
  begin
640
- if MobyUtil::Parameter[sut_id][:type]=='S60' || MobyUtil::Parameter[sut_id][:type]=='S60QT'
640
+ if MobyUtil::Parameter[sut_id][:type]=='S60' || MobyUtil::Parameter[sut_id][:type]=='Symbian'
641
641
  sw_version=sut_attributes[:sut].sysinfo( :Sw_version )
642
642
  end
643
643
  if MobyUtil::Parameter[sut_id][:type]=='QT'
@@ -668,7 +668,7 @@ module TDriverReportCreator
668
668
  MobyUtil::Logger.instance.enabled=false
669
669
  memory=0
670
670
  begin
671
- if MobyUtil::Parameter[sut_id][:type]=='S60' || MobyUtil::Parameter[sut_id][:type]=='S60QT'
671
+ if MobyUtil::Parameter[sut_id][:type]=='S60' || MobyUtil::Parameter[sut_id][:type]=='Symbian'
672
672
  memory=sut_attributes[:sut].sysinfo( :Get_used_ram )
673
673
  end
674
674
  if MobyUtil::Parameter[sut_id][:type]=='QT'
@@ -700,7 +700,7 @@ module TDriverReportCreator
700
700
  MobyUtil::Logger.instance.enabled=false
701
701
  memory=0
702
702
  begin
703
- if MobyUtil::Parameter[sut_id][:type]=='S60' || MobyUtil::Parameter[sut_id][:type]=='S60QT'
703
+ if MobyUtil::Parameter[sut_id][:type]=='S60' || MobyUtil::Parameter[sut_id][:type]=='Symbian'
704
704
  memory=sut_attributes[:sut].sysinfo( :Get_total_ram )
705
705
  end
706
706
  if MobyUtil::Parameter[sut_id][:type]=='QT'
@@ -1,32 +1,50 @@
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
- ##
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
- ##
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
18
  ############################################################################
19
19
 
20
20
 
21
21
  require File.expand_path( File.join( File.dirname( __FILE__ ), 'report' ) )
22
- #Report module which contains the Cucumber, Test::Unit and RSpec report formatters
23
- module TDriverReport
22
+ #Report module which contains the Test::Unit report formatter
23
+ def create_global_reporter_hook_for_test_unit()
24
+ eval("
25
+ module Test #:nodoc:all
26
+ module Unit
27
+ module UI
28
+ module Console
29
+ class TestRunner
30
+ def create_mediator(suite)
31
+ # swap in TDriver custom mediator
32
+ return TDriverReportTestUnit::TestUnit.new(suite)
33
+ end
34
+ end #TestRunner
35
+ end #Console
36
+ end #UI
37
+ end #Unit
38
+ end #Test
39
+ ")
40
+ end
41
+ module TDriverReportTestUnit
24
42
  def create_test_unit_formatter()
25
43
  eval "
26
44
  require 'test/unit'
27
45
  require 'test/unit/ui/console/testrunner'
28
46
  #class for listening test unit execution process
29
- class TestUnit < Test::Unit::UI::TestRunnerMediator
47
+ class TestUnit < Test::Unit::UI::TestRunnerMediator
30
48
  include TDriverReportCreator
31
49
  def initialize(suite, report_mgr = nil)
32
50
  super(suite)
@@ -36,13 +54,13 @@ module TDriverReport
36
54
  add_listener(Test::Unit::UI::TestRunnerMediator::STARTED, &method(:started))
37
55
  add_listener(Test::Unit::TestCase::STARTED, &method(:test_started))
38
56
  add_listener(Test::Unit::TestCase::FINISHED, &method(:test_finished))
39
- add_listener(Test::Unit::TestResult::FAULT, &method(:fault))
57
+ add_listener(Test::Unit::TestResult::FAULT, &method(:fault))
40
58
  end
41
59
  def get_class_name(full_test_name) #:nodoc:
42
60
  begin
43
61
  name=full_test_name
44
62
  name=name.gsub(/[)]/,'')
45
- name_arr=name.split('(')
63
+ name_arr=name.split('(')
46
64
  return [name_arr[1].gsub(/[:]/,'_'),name_arr[0].gsub(/[:]/,'_')]
47
65
  rescue
48
66
  return ['Ruby test',full_test_name]
@@ -53,7 +71,7 @@ module TDriverReport
53
71
  # === params
54
72
  # === returns
55
73
  # === raises
56
- def started(result)
74
+ def started(result)
57
75
  start_run()
58
76
  add_report_group(@current_suite_name+'|')
59
77
  end
@@ -64,7 +82,7 @@ module TDriverReport
64
82
  # === raises
65
83
  def test_started(name)
66
84
  full_name=get_class_name(name)
67
- @current_test_name=full_name[1]
85
+ @current_test_name=full_name[1]
68
86
  add_report_group(@current_suite_name+':'+full_name[0]+'|')
69
87
  start_test_case(@current_test_name)
70
88
  add_test_case_group(full_name[0])
@@ -90,14 +108,42 @@ module TDriverReport
90
108
  capture_screen_test_case()
91
109
  update_test_case(fault)
92
110
  @tc_result='failed'
93
- end
111
+ end
94
112
  end
95
113
  "
96
- end
114
+ end
115
+
116
+ def TDriverReportTestUnit.included(mod)
117
+
118
+ create_test_unit_formatter()
119
+ create_global_reporter_hook_for_test_unit()
120
+
121
+ end
122
+
97
123
  end
98
124
 
99
- module MattiReport
125
+ module TDriverReport
100
126
  def create_test_unit_formatter()
127
+ $stderr.puts "Warning: TDriverReport#create_test_unit_formatter() is deprecated please use only \"include TDriverReportTestUnit\" instead of
128
+ begin
129
+ include TDriverReport
130
+ create_test_unit_formatter()
131
+ end
132
+ module Test #:nodoc:all
133
+ module Unit
134
+ module UI
135
+ module Console
136
+ class TestRunner
137
+ def create_mediator(suite)
138
+ # swap in TDriver custom mediator
139
+ return TDriverReport::TestUnit.new(suite)
140
+ end
141
+ end
142
+ end
143
+ end
144
+ end
145
+ end
146
+ "
101
147
  eval "
102
148
  require 'test/unit'
103
149
  require 'test/unit/ui/console/testrunner'
@@ -173,3 +219,5 @@ module MattiReport
173
219
  end
174
220
 
175
221
 
222
+
223
+