testability-driver 1.0.4 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (104) hide show
  1. data/bin/tdriver-devtools +0 -0
  2. data/config/sut_setup.rb +32 -0
  3. data/config/sut_teardown.rb +32 -0
  4. data/ext/extconf.rb +3 -1
  5. data/lib/tdriver-devtools/behaviour/old/xml/update +0 -0
  6. data/lib/tdriver-devtools/behaviour/xml/generate.rb +0 -0
  7. data/lib/tdriver-devtools/doc/update +0 -0
  8. data/lib/tdriver-devtools/doc/xslt/update +0 -0
  9. data/lib/tdriver-devtools/tdriver-devtools.rb +0 -0
  10. data/lib/tdriver-devtools/tests/feature_tests/output/application_closable_0x3f.feature +10 -0
  11. data/lib/tdriver-devtools/tests/feature_tests/output/application_close.feature +15 -0
  12. data/lib/tdriver-devtools/tests/feature_tests/output/application_environment.feature +10 -0
  13. data/lib/tdriver-devtools/tests/feature_tests/output/application_executable_name.feature +10 -0
  14. data/lib/tdriver-devtools/tests/feature_tests/output/application_uid.feature +10 -0
  15. data/lib/tdriver-devtools/tests/feature_tests/output/created.rid +1 -0
  16. data/lib/tdriver-devtools/tests/feature_tests/output/find_find.feature +15 -0
  17. data/lib/tdriver-devtools/tests/feature_tests/output/flash_behaviour_flash.feature +10 -0
  18. data/lib/tdriver-devtools/tests/feature_tests/output/flash_behaviour_flash_images.feature +15 -0
  19. data/lib/tdriver-devtools/tests/feature_tests/output/sut_application.feature +15 -0
  20. data/lib/tdriver-devtools/tests/feature_tests/output/sut_capture_screen.feature +10 -0
  21. data/lib/tdriver-devtools/tests/feature_tests/output/sut_child.feature +10 -0
  22. data/lib/tdriver-devtools/tests/feature_tests/output/sut_clear_verify_blocks.feature +10 -0
  23. data/lib/tdriver-devtools/tests/feature_tests/output/sut_connect.feature +10 -0
  24. data/lib/tdriver-devtools/tests/feature_tests/output/sut_controller_execution_order.feature +10 -0
  25. data/lib/tdriver-devtools/tests/feature_tests/output/sut_controller_execution_order_0x3d.feature +10 -0
  26. data/lib/tdriver-devtools/tests/feature_tests/output/sut_current_application_id.feature +15 -0
  27. data/lib/tdriver-devtools/tests/feature_tests/output/sut_disconnect.feature +10 -0
  28. data/lib/tdriver-devtools/tests/feature_tests/output/sut_dump_count.feature +15 -0
  29. data/lib/tdriver-devtools/tests/feature_tests/output/sut_freeze.feature +10 -0
  30. data/lib/tdriver-devtools/tests/feature_tests/output/sut_frozen.feature +10 -0
  31. data/lib/tdriver-devtools/tests/feature_tests/output/sut_get_application_id.feature +10 -0
  32. data/lib/tdriver-devtools/tests/feature_tests/output/sut_get_object.feature +10 -0
  33. data/lib/tdriver-devtools/tests/feature_tests/output/sut_get_operator_data.feature +10 -0
  34. data/lib/tdriver-devtools/tests/feature_tests/output/sut_get_ui_dump.feature +15 -0
  35. data/lib/tdriver-devtools/tests/feature_tests/output/sut_get_user_information.feature +10 -0
  36. data/lib/tdriver-devtools/tests/feature_tests/output/sut_input.feature +15 -0
  37. data/lib/tdriver-devtools/tests/feature_tests/output/sut_parameter.feature +15 -0
  38. data/lib/tdriver-devtools/tests/feature_tests/output/sut_press_key.feature +10 -0
  39. data/lib/tdriver-devtools/tests/feature_tests/output/sut_received_data.feature +10 -0
  40. data/lib/tdriver-devtools/tests/feature_tests/output/sut_refresh.feature +20 -0
  41. data/lib/tdriver-devtools/tests/feature_tests/output/sut_refresh_timeout.feature +15 -0
  42. data/lib/tdriver-devtools/tests/feature_tests/output/sut_refresh_tries.feature +15 -0
  43. data/lib/tdriver-devtools/tests/feature_tests/output/sut_refresh_ui_dump.feature +20 -0
  44. data/lib/tdriver-devtools/tests/feature_tests/output/sut_run.feature +10 -0
  45. data/lib/tdriver-devtools/tests/feature_tests/output/sut_sent_data.feature +10 -0
  46. data/lib/tdriver-devtools/tests/feature_tests/output/sut_state.feature +10 -0
  47. data/lib/tdriver-devtools/tests/feature_tests/output/sut_translate.feature +30 -0
  48. data/lib/tdriver-devtools/tests/feature_tests/output/sut_ui_type.feature +10 -0
  49. data/lib/tdriver-devtools/tests/feature_tests/output/sut_ui_version.feature +10 -0
  50. data/lib/tdriver-devtools/tests/feature_tests/output/sut_unfreeze.feature +10 -0
  51. data/lib/tdriver-devtools/tests/feature_tests/output/sut_update.feature +10 -0
  52. data/lib/tdriver-devtools/tests/feature_tests/output/sut_verify_always.feature +20 -0
  53. data/lib/tdriver-devtools/tests/feature_tests/output/sut_verify_blocks.feature +10 -0
  54. data/lib/tdriver-devtools/tests/feature_tests/output/sut_x_path.feature +10 -0
  55. data/lib/tdriver-devtools/tests/feature_tests/output/sut_xml_data.feature +10 -0
  56. data/lib/tdriver-devtools/tests/feature_tests/output/sut_xml_data_0x3d.feature +10 -0
  57. data/lib/tdriver-devtools/tests/feature_tests/output/sut_xml_data_crc.feature +10 -0
  58. data/lib/tdriver-devtools/tests/feature_tests/output/switchbox_behaviour_power_down.feature +10 -0
  59. data/lib/tdriver-devtools/tests/feature_tests/output/switchbox_behaviour_power_status.feature +10 -0
  60. data/lib/tdriver-devtools/tests/feature_tests/output/switchbox_behaviour_power_up.feature +10 -0
  61. data/lib/tdriver-devtools/tests/feature_tests/output/switchbox_behaviour_reset.feature +10 -0
  62. data/lib/tdriver-devtools/tests/feature_tests/output/verification_test_object_exists_0x3f.feature +15 -0
  63. data/lib/tdriver-devtools/tests/feature_tests/update +0 -0
  64. data/lib/tdriver/base/behaviour/behaviours/object_composition.rb +4 -4
  65. data/lib/tdriver/base/behaviour/factory.rb +8 -0
  66. data/lib/tdriver/base/sut/generic/behaviours/application.rb +24 -3
  67. data/lib/tdriver/base/sut/generic/behaviours/sut.rb +465 -354
  68. data/lib/tdriver/base/test_object/adapter.rb +2 -2
  69. data/lib/tdriver/base/test_object/behaviours/test_object.rb +22 -5
  70. data/lib/tdriver/base/test_object/cache.rb +1 -1
  71. data/lib/tdriver/base/test_object/factory.rb +23 -3
  72. data/lib/tdriver/env.rb +0 -0
  73. data/lib/tdriver/loader.rb +0 -0
  74. data/lib/tdriver/matti.rb +0 -0
  75. data/lib/tdriver/report/error_recovery/tdriver_error_recovery.rb +22 -24
  76. data/lib/tdriver/report/report.rb +8 -1
  77. data/lib/tdriver/report/report_api.rb +18 -0
  78. data/lib/tdriver/report/report_combine.rb +1 -1
  79. data/lib/tdriver/report/report_creator.rb +5 -1
  80. data/lib/tdriver/report/report_execution_statistics.rb +105 -78
  81. data/lib/tdriver/report/report_test_case_run.rb +2 -1
  82. data/lib/tdriver/report/report_test_run.rb +187 -116
  83. data/lib/tdriver/report/report_writer.rb +49 -29
  84. data/lib/tdriver/tdriver.rb +14 -3
  85. data/lib/tdriver/util/common/exception.rb +53 -0
  86. data/lib/tdriver/util/common/hash.rb +79 -23
  87. data/lib/tdriver/util/common/numeric.rb +26 -5
  88. data/lib/tdriver/util/common/object.rb +44 -15
  89. data/lib/tdriver/util/common/string.rb +4 -1
  90. data/lib/tdriver/util/filters/dynamic_attributes.rb +2 -1
  91. data/lib/tdriver/util/keymap/keymap.rb +81 -0
  92. data/lib/tdriver/util/loader.rb +4 -1
  93. data/lib/tdriver/util/logger/logger.rb +17 -9
  94. data/lib/tdriver/util/other/config.rb +0 -0
  95. data/lib/tdriver/util/parameter/error.rb +3 -0
  96. data/lib/tdriver/util/parameter/loader.rb +6 -1
  97. data/lib/tdriver/util/parameter/parameter.rb +87 -14
  98. data/lib/tdriver/util/parameter/parameter_new.rb +869 -0
  99. data/lib/tdriver/util/parameter/parameter_template.rb +2 -2
  100. data/lib/tdriver/util/parameter/parameter_user_api.rb +27 -3
  101. data/lib/tdriver/util/parameter/parameter_xml.rb +36 -38
  102. data/lib/tdriver/version.rb +1 -1
  103. data/xml/templates/generic.xml +4 -10
  104. metadata +196 -138
@@ -44,12 +44,12 @@ module TDriver
44
44
  if @@partial_match_allowed.include?( [ object_type, key ] )
45
45
 
46
46
  prefix_value = "[contains(.,#{ value })]"
47
- attribute_value = "contains(value/text(),#{ value })"
47
+ attribute_value = "contains(value/.,#{ value })"
48
48
 
49
49
  else
50
50
 
51
51
  prefix_value = "=#{ value }"
52
- attribute_value = "value/text()=#{ value }"
52
+ attribute_value = "value/.=#{ value }"
53
53
 
54
54
  end
55
55
 
@@ -178,7 +178,7 @@ module MobyBehaviour
178
178
  # TODO: add behaviour logging?
179
179
 
180
180
  # raise exception if attribute name variable type is other than string
181
- name.check_type( [ String, Symbol ], "Wrong argument type $1 for attribute (expected $2)" )
181
+ name.check_type( [ String, Symbol ], "wrong argument type $1 for attribute (expected $2)" )
182
182
 
183
183
  # convert name to string if variable type is symbol
184
184
  name = name.to_s if name.kind_of?( Symbol )
@@ -384,7 +384,7 @@ module MobyBehaviour
384
384
  def child( attributes )
385
385
 
386
386
  # verify attributes argument format
387
- attributes.check_type( Hash, "Wrong argument type $1 for attributes (expected $2)" )
387
+ attributes.check_type( Hash, "wrong argument type $1 for attributes (expected $2)" )
388
388
 
389
389
  get_child_objects( attributes )
390
390
 
@@ -424,10 +424,10 @@ module MobyBehaviour
424
424
  def children( attributes, find_all_children = true )
425
425
 
426
426
  # verify attributes argument format
427
- attributes.check_type( Hash, "Wrong argument type $1 for attributes (expected $2)" )
427
+ attributes.check_type( Hash, "wrong argument type $1 for attributes (expected $2)" )
428
428
 
429
429
  # verify find_all_children argument format
430
- find_all_children.check_type( [ TrueClass, FalseClass ], "Wrong argument type $1 for find_all_children (expected $2)" )
430
+ find_all_children.check_type( [ TrueClass, FalseClass ], "wrong argument type $1 for find_all_children (expected $2)" )
431
431
 
432
432
  # If empty or only special attributes then add :type => '*' to search all
433
433
  attributes[ :type ] = '*' if attributes.select{ | key, value | key.to_s !~ /^__/ ? true : false }.empty?
@@ -485,6 +485,9 @@ module MobyBehaviour
485
485
  # compare new environment value with previous
486
486
  if @env != previous_environment
487
487
 
488
+ # remove cached behaviour module
489
+ MobyBase::BehaviourFactory.instance.reset_modules_cache
490
+
488
491
  # reapply behaviours to test object if environment value has changed
489
492
  MobyBase::BehaviourFactory.instance.apply_behaviour!(
490
493
 
@@ -603,6 +606,20 @@ module MobyBehaviour
603
606
  # NOTICE: Please do not add anything unnessecery to this method, it might cause a major performance impact
604
607
  #
605
608
 
609
+ # for backwards compatibility
610
+ if attributes.has_key?( :__logging )
611
+
612
+ # for backward compatibility
613
+ if attributes[ :__logging ].kind_of?( String )
614
+
615
+ warn "warning: deprecated variable type String for :__logging test object creation directive (expected TrueClass or FalseClass)"
616
+
617
+ attributes[ :__logging ] = attributes[ :__logging ].to_boolean
618
+
619
+ end
620
+
621
+ end
622
+
606
623
  # store original hash
607
624
  creation_hash = attributes.clone
608
625
 
@@ -613,7 +630,7 @@ module MobyBehaviour
613
630
 
614
631
  [ TrueClass, FalseClass ],
615
632
 
616
- "Wrong value type $1 for :__logging test object creation directive (expected $2)"
633
+ "wrong value type $1 for :__logging test object creation directive (expected $2)"
617
634
 
618
635
  ) if dynamic_attributes.has_key?( :__logging )
619
636
 
@@ -95,7 +95,7 @@ module TDriver
95
95
  test_object_hash = test_object.hash
96
96
 
97
97
  if @objects.has_key?( test_object_hash )
98
- warn( "Warning: Test object (#{ test_object_hash }) already exists in cache" )
98
+ warn( "warning: Test object (#{ test_object_hash }) already exists in cache" )
99
99
  end
100
100
 
101
101
  @objects[ test_object_hash ] = test_object
@@ -178,17 +178,37 @@ module MobyBase
178
178
 
179
179
  # Fixnum
180
180
  when :__index, :__timeout
181
+
182
+ # for backward compatibility
183
+ if value.kind_of?( String )
184
+
185
+ warn "warning: deprecated variable type String for #{ key.inspect } test object identification directive (expected TrueClass or FalseClass)"
186
+
187
+ raise ArgumentError, "deprecated and wrong variable content format for #{ key.inspect } test object identification directive (expected Numeric string)" unless value.numeric?
188
+
189
+ value = value.to_i
190
+
191
+ end
181
192
 
182
193
  type = Fixnum
183
194
 
184
195
  when :__logging, :__xy_sorting
196
+
197
+ # for backward compatibility
198
+ if value.kind_of?( String )
199
+
200
+ warn "warning: deprecated variable type String for #{ key.inspect } test object identification directive (expected TrueClass or FalseClass)"
201
+
202
+ value = value.to_boolean
203
+
204
+ end
185
205
 
186
206
  type = [ TrueClass, FalseClass ]
187
207
 
188
208
  end
189
209
 
190
210
  # verify hash value if type defined
191
- value.check_type( type, "Wrong variable type $1 for #{ key.inspect } test object identification directive (expected $2)" ) unless type.nil?
211
+ value.check_type( type, "wrong variable type $1 for #{ key.inspect } test object identification directive (expected $2)" ) unless type.nil?
192
212
 
193
213
  }
194
214
 
@@ -499,7 +519,7 @@ module MobyBase
499
519
 
500
520
  def set_timeout( new_timeout )
501
521
 
502
- warn( "Deprecated method: use timeout=(value) instead of TestObjectFactory#set_timeout( value )" )
522
+ warn "warning: deprecated method TestObjectFactory#set_timeout( value ); please use TestObjectFactory#timeout=( value ) instead"
503
523
 
504
524
  self.timeout = new_timeout
505
525
 
@@ -511,7 +531,7 @@ module MobyBase
511
531
  # Numeric:: Timeout
512
532
  def get_timeout
513
533
 
514
- warn( "Deprecated method: use timeout instead of TestObjectFactory#get_timeout" )
534
+ warn "warning: deprecated method TestObjectFactory#get_timeout; please use TestObjectFactory#timeout instead"
515
535
 
516
536
  @timeout
517
537
 
data/lib/tdriver/env.rb CHANGED
File without changes
File without changes
data/lib/tdriver/matti.rb CHANGED
File without changes
@@ -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
- ##
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
 
@@ -88,7 +88,7 @@ module TDriverErrorRecovery
88
88
  current_reconnect_attempt+=1
89
89
  end
90
90
  end
91
- Kernel::raise BehaviourError.new("Error Recovery", "Error recovery failed after #{attempt_reconnects} recovry attemprs") if b_error_recovery_succesful==false
91
+ Kernel::raise BehaviourError.new("Error Recovery", "Error recovery failed after #{attempt_reconnects} recovery attempts") if b_error_recovery_succesful==false
92
92
  end
93
93
 
94
94
  # Reconnects the devices without ping
@@ -96,7 +96,7 @@ module TDriverErrorRecovery
96
96
  # === returns
97
97
  # === raises
98
98
  def reconnect_devices()
99
- begin
99
+
100
100
  MobyBase::SUTFactory.instance.connected_suts.each do |sut_id, sut_attributes|
101
101
  suts=@recovery_settings.get_monitored_sut
102
102
  suts.each do |monitored_sut|
@@ -105,8 +105,7 @@ module TDriverErrorRecovery
105
105
  end
106
106
  end
107
107
  end
108
- rescue
109
- end
108
+
110
109
  end
111
110
 
112
111
  # Ping the current SUT by querying xml state
@@ -119,7 +118,7 @@ module TDriverErrorRecovery
119
118
  def ping_device(current_sut)
120
119
  begin
121
120
  xml_state=current_sut.get_ui_dump()
122
- if xml_state==nil
121
+ if xml_state.to_s.include?("tasMessage")==false
123
122
  MobyUtil::Logger.instance.log "behaviour" , "WARNING;Device ping failed"
124
123
  false
125
124
  else
@@ -127,6 +126,8 @@ module TDriverErrorRecovery
127
126
  true
128
127
  end
129
128
  rescue Exception => e
129
+ puts e.message
130
+ puts e.backtrace
130
131
  MobyUtil::Logger.instance.log "behaviour" , "WARNING;Device ping failed"
131
132
  false
132
133
  end
@@ -139,7 +140,6 @@ module TDriverErrorRecovery
139
140
  def ping_devices_and_reconnect()
140
141
  resetted=false
141
142
  MobyBase::SUTFactory.instance.connected_suts.each do |sut_id, sut_attributes|
142
- begin
143
143
  suts=@recovery_settings.get_monitored_sut
144
144
  suts.each do |monitored_sut|
145
145
  if sut_id.to_s==monitored_sut.to_s
@@ -149,8 +149,6 @@ module TDriverErrorRecovery
149
149
  end
150
150
  end
151
151
  end
152
- rescue
153
- end
154
152
  end
155
153
  resetted
156
154
  end
@@ -17,6 +17,8 @@
17
17
  ##
18
18
  ############################################################################
19
19
 
20
+ require 'fileutils'
21
+ require 'date'
20
22
  require File.expand_path( File.join( File.dirname( __FILE__ ), 'error_recovery/tdriver_error_recovery_settings' ) )
21
23
  require File.expand_path( File.join( File.dirname( __FILE__ ), 'error_recovery/tdriver_error_recovery' ) )
22
24
  require File.expand_path( File.join( File.dirname( __FILE__ ), 'error_recovery/tdriver_custom_error_recovery' ) )
@@ -24,7 +26,12 @@ require File.expand_path( File.join( File.dirname( __FILE__ ), 'report_file_capt
24
26
  require File.expand_path( File.join( File.dirname( __FILE__ ), 'report_crash_file_capture' ) )
25
27
  require File.expand_path( File.join( File.dirname( __FILE__ ), 'report_javascript' ) )
26
28
 
27
- require 'chronic_duration' if Gem.available?('chronic_duration')
29
+ begin
30
+ #Gem for formatting execution duration time
31
+ require 'chronic_duration'
32
+ rescue LoadError
33
+ #Gem not available do nothing
34
+ end
28
35
 
29
36
  require File.expand_path( File.join( File.dirname( __FILE__ ), 'report_writer' ) )
30
37
  require File.expand_path( File.join( File.dirname( __FILE__ ), 'report_combine' ) )
@@ -20,6 +20,24 @@
20
20
 
21
21
  module TDriverReportAPI
22
22
 
23
+ def tdriver_get_current_by_status( status_type )
24
+ Kernel::raise TypeError.new("Argument to method cannot be nil.") if status_type.nil?
25
+ ret = []
26
+ if $tdriver_reporter!=nil
27
+ ret = $tdriver_reporter.parse_results_for_current_test(status_type)
28
+ end
29
+ return ret
30
+ end
31
+
32
+ def tdriver_get_status(status_type)
33
+ Kernel::raise TypeError.new("Argument to method cannot be nil.") if status_type.nil?
34
+ ret = []
35
+ if $tdriver_reporter!=nil
36
+ ret = $tdriver_reporter.read_result_storage(status_type)
37
+ end
38
+ return ret
39
+ end
40
+
23
41
  def tdriver_log_data(data)
24
42
  Kernel::raise TypeError.new("Argument to method cannot be nil.") if data.nil?
25
43
  if $tdriver_reporter!=nil
@@ -44,7 +44,7 @@ class ReportCombine
44
44
 
45
45
  @total_passed=read_result_storage('passed').count
46
46
  @total_failed=read_result_storage('failed').count
47
- @total_not_run=read_result_storage('not run').count
47
+ @total_not_run=read_result_storage('not_run').count
48
48
  @total_run=read_result_storage('all').count
49
49
 
50
50
  $test_case_run_index+=executed_tests.count.to_i
@@ -65,6 +65,7 @@ module TDriverReportCreator
65
65
  $tdriver_reporter.update_test_case_summary_pages('failed')
66
66
  $tdriver_reporter.update_test_case_summary_pages('not run')
67
67
  $tdriver_reporter.update_test_case_summary_pages('statistics')
68
+ $tdriver_reporter.group_results_by_test_case()
68
69
  $tdriver_reporter.create_csv if MobyUtil::Parameter[ :create_run_table_csv, false ]=='true'
69
70
  $new_junit_xml_results.create_junit_xml()
70
71
  #$tdriver_reporter.delete_result_storage()
@@ -159,7 +160,8 @@ module TDriverReportCreator
159
160
  $new_test_case.test_case_total_data_sent,
160
161
  $new_test_case.test_case_total_data_received
161
162
  )
162
-
163
+
164
+
163
165
  $tdriver_reporter.set_end_time(Time.now)
164
166
  $tdriver_reporter.set_total_run(1)
165
167
  $tdriver_reporter.update_summary_page('inprogress')
@@ -169,11 +171,13 @@ module TDriverReportCreator
169
171
  $run_status_thread_active=true
170
172
  Thread.new do
171
173
  begin
174
+ #Update test case summary pages
172
175
  $tdriver_reporter.update_test_case_summary_pages('all')
173
176
  $tdriver_reporter.update_test_case_summary_pages('passed')
174
177
  $tdriver_reporter.update_test_case_summary_pages('failed')
175
178
  $tdriver_reporter.update_test_case_summary_pages('not run')
176
179
  $tdriver_reporter.update_test_case_summary_pages('statistics')
180
+ $tdriver_reporter.group_results_by_test_case()
177
181
  $new_junit_xml_results.create_junit_xml()
178
182
  #tdriver_log_page $tdriver_reporter.update_tdriver_log_page()
179
183
  #ML: Update summary every 10 seconds improves performance during execution
@@ -25,7 +25,7 @@ class ReportingStatistics
25
25
  @pass_statuses=MobyUtil::Parameter[ :report_passed_statuses, "passed" ].split('|')
26
26
  @fail_statuses=MobyUtil::Parameter[ :report_failed_statuses, "failed" ].split('|')
27
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]
28
+ @test_results_per_page=MobyUtil::Parameter[ :report_results_per_page, 50]
29
29
  @statistics_arr=Array.new
30
30
  @total_statistics_arr=Array.new
31
31
  @summary=summary
@@ -52,8 +52,9 @@ class ReportingStatistics
52
52
  @total_statistics_arr << ["dump count",0]
53
53
  @total_statistics_arr << ["sent bytes",0]
54
54
  @total_statistics_arr << ["received bytes",0]
55
- @total_statistics_arr << ["used mem difference",0]
56
- @all_statuses << "reboots" << "crashes" << "duration" << "dump count" << "sent bytes" << "received bytes" << "used mem difference"
55
+ @total_statistics_arr << ["used mem",0]
56
+ @total_statistics_arr << ["pass rate",0]
57
+ @all_statuses << "reboots" << "crashes" << "duration" << "dump count" << "sent bytes" << "received bytes" << "used mem" << "pass rate"
57
58
  end
58
59
 
59
60
  def generate_statistics_headers()
@@ -74,86 +75,102 @@ class ReportingStatistics
74
75
  status_heads << "<th abbr=\"link_column\"><b>Sent bytes</b></th>"
75
76
  status_heads << "<th abbr=\"link_column\"><b>Received bytes</b></th>"
76
77
  status_heads << "<th abbr=\"link_column\"><b>Used mem</b></th>"
78
+ status_heads << "<th abbr=\"link_column\"><b>Pass %</b></th>"
77
79
  status_heads
78
80
  end
79
81
 
80
82
  def update_total_execution_statistics(tc_status,reboots,crashes,dump_count,sent_bytes,received_bytes,memory_usage)
81
83
  current_index=0
82
84
  @total_statistics_arr.each do |total_status|
83
- if tc_status==total_status[0]
84
- @total_statistics_arr[current_index]=[tc_status,total_status[1].to_i+1]
85
- end
86
- if total_status[0]=="reboots"
87
- @total_statistics_arr[current_index]=["reboots",total_status[1].to_i+reboots.to_i]
88
- end
89
- if total_status[0]=="crashes"
90
- @total_statistics_arr[current_index]=["crashes",total_status[1].to_i+crashes.to_i]
91
- end
92
- if total_status[0]=="total"
93
- @total_statistics_arr[current_index]=["total",total_status[1].to_i+1]
94
- end
95
- if total_status[0]=="duration"
96
- @total_statistics_arr[current_index]=["duration",""]
97
- end
98
- if total_status[0]=="dump count"
99
- @total_statistics_arr[current_index]=["dump count",total_status[1].to_i+dump_count.to_i]
100
- end
101
- if total_status[0]=="sent bytes"
102
- @total_statistics_arr[current_index]=["sent bytes",total_status[1].to_i+sent_bytes.to_i]
103
- end
104
- if total_status[0]=="received bytes"
105
- @total_statistics_arr[current_index]=["received bytes",total_status[1].to_i+received_bytes.to_i]
106
- end
107
- if total_status[0]=="used mem difference"
108
- @total_statistics_arr[current_index]=["used mem difference",""]
109
- end
110
- current_index+=1
85
+ if tc_status==total_status[0]
86
+ @total_statistics_arr[current_index]=[tc_status,total_status[1].to_i+1]
87
+ end
88
+ if total_status[0]=="reboots"
89
+ @total_statistics_arr[current_index]=["reboots",total_status[1].to_i+reboots.to_i]
111
90
  end
91
+ if total_status[0]=="crashes"
92
+ @total_statistics_arr[current_index]=["crashes",total_status[1].to_i+crashes.to_i]
93
+ end
94
+ if total_status[0]=="total"
95
+ @total_statistics_arr[current_index]=["total",total_status[1].to_i+1]
96
+ end
97
+ if total_status[0]=="duration"
98
+ @total_statistics_arr[current_index]=["duration",""]
99
+ end
100
+ if total_status[0]=="dump count"
101
+ @total_statistics_arr[current_index]=["dump count",total_status[1].to_i+dump_count.to_i]
102
+ end
103
+ if total_status[0]=="sent bytes"
104
+ @total_statistics_arr[current_index]=["sent bytes",total_status[1].to_i+sent_bytes.to_i]
105
+ end
106
+ if total_status[0]=="received bytes"
107
+ @total_statistics_arr[current_index]=["received bytes",total_status[1].to_i+received_bytes.to_i]
108
+ end
109
+ if total_status[0]=="used mem"
110
+ @total_statistics_arr[current_index]=["used mem",""]
111
+ end
112
+ if total_status[0]=="pass rate"
113
+ @total_statistics_arr[current_index]=["pass rate",""]
114
+ end
115
+ current_index+=1
116
+ end
112
117
  end
113
118
 
114
119
  def update_test_case_execution_statistics(tc_name,tc_status,tc_execution,duration,tc_link,reboots,crashes,dump_count,sent_bytes,received_bytes,memory_usage)
115
120
  b_test_in_statistics=false
116
121
  current_index=0
117
- @statistics_arr.each do |total_status|
118
- if total_status[1]==tc_status && total_status[0]==tc_name
119
- b_test_in_statistics=true
120
- @statistics_arr[current_index]=[tc_name,tc_status,total_status[2].to_i+1,tc_execution,tc_link]
121
- end
122
- if total_status[1]=="reboots" && total_status[0]==tc_name
123
- b_test_in_statistics=true
124
- @statistics_arr[current_index]=[tc_name,"reboots",total_status[2].to_i+reboots.to_i,tc_execution,tc_link]
125
- end
126
- if total_status[1]=="crashes" && total_status[0]==tc_name
127
- b_test_in_statistics=true
128
- @statistics_arr[current_index]=[tc_name,"crashes",total_status[2].to_i+crashes.to_i,tc_execution,tc_link]
129
- end
130
- if total_status[1]=="total" && total_status[0]==tc_name
131
- b_test_in_statistics=true
132
- @statistics_arr[current_index]=[tc_name,"total",total_status[2].to_i+1,tc_execution,tc_link]
133
- end
134
- if total_status[1]=="duration" && total_status[0]==tc_name
135
- b_test_in_statistics=true
136
- @statistics_arr[current_index]=[tc_name,"duration",duration,tc_execution,tc_link]
137
- end
138
- if total_status[1]=="dump count" && total_status[0]==tc_name
139
- b_test_in_statistics=true
140
- @statistics_arr[current_index]=[tc_name,"dump count",total_status[2].to_i+dump_count.to_i,tc_execution,tc_link]
141
- end
142
- if total_status[1]=="sent bytes" && total_status[0]==tc_name
143
- b_test_in_statistics=true
144
- @statistics_arr[current_index]=[tc_name,"sent bytes",total_status[2].to_i+sent_bytes.to_i,tc_execution,tc_link]
145
- end
146
- if total_status[1]=="received bytes" && total_status[0]==tc_name
147
- b_test_in_statistics=true
148
- @statistics_arr[current_index]=[tc_name,"received bytes",total_status[2].to_i+received_bytes.to_i,tc_execution,tc_link]
149
- end
150
- if total_status[1]=="used mem difference" && total_status[0]==tc_name
151
- b_test_in_statistics=true
152
- @statistics_arr[current_index]=[tc_name,"used mem difference",total_status[2].to_i,tc_execution,tc_link]
153
- end
154
- current_index+=1
122
+ total_run=0
123
+ total_not_run=0
124
+ total_passed=0
125
+ @statistics_arr.each do |total_status|
126
+ if total_status[1]==tc_status && total_status[0]==tc_name
127
+ b_test_in_statistics=true
128
+ @statistics_arr[current_index]=[tc_name,tc_status,total_status[2].to_i+1,tc_execution,tc_link]
129
+ total_passed=total_status[2].to_i+1 if @pass_statuses.include?(total_status[1])
130
+ total_not_run=total_status[2].to_i+1 if @not_run_statuses.include?(total_status[1])
131
+ end
132
+ if total_status[1]=="reboots" && total_status[0]==tc_name
133
+ b_test_in_statistics=true
134
+ @statistics_arr[current_index]=[tc_name,"reboots",total_status[2].to_i+reboots.to_i,tc_execution,tc_link]
155
135
  end
156
- b_test_in_statistics
136
+ if total_status[1]=="crashes" && total_status[0]==tc_name
137
+ b_test_in_statistics=true
138
+ @statistics_arr[current_index]=[tc_name,"crashes",total_status[2].to_i+crashes.to_i,tc_execution,tc_link]
139
+ end
140
+ if total_status[1]=="total" && total_status[0]==tc_name
141
+ b_test_in_statistics=true
142
+ @statistics_arr[current_index]=[tc_name,"total",total_status[2].to_i+1,tc_execution,tc_link]
143
+ total_run=total_status[2].to_i+1
144
+ end
145
+ if total_status[1]=="duration" && total_status[0]==tc_name
146
+ b_test_in_statistics=true
147
+ @statistics_arr[current_index]=[tc_name,"duration",duration,tc_execution,tc_link]
148
+ end
149
+ if total_status[1]=="dump count" && total_status[0]==tc_name
150
+ b_test_in_statistics=true
151
+ @statistics_arr[current_index]=[tc_name,"dump count",total_status[2].to_i+dump_count.to_i,tc_execution,tc_link]
152
+ end
153
+ if total_status[1]=="sent bytes" && total_status[0]==tc_name
154
+ b_test_in_statistics=true
155
+ @statistics_arr[current_index]=[tc_name,"sent bytes",total_status[2].to_i+sent_bytes.to_i,tc_execution,tc_link]
156
+ end
157
+ if total_status[1]=="received bytes" && total_status[0]==tc_name
158
+ b_test_in_statistics=true
159
+ @statistics_arr[current_index]=[tc_name,"received bytes",total_status[2].to_i+received_bytes.to_i,tc_execution,tc_link]
160
+ end
161
+ if total_status[1]=="used mem" && total_status[0]==tc_name
162
+ b_test_in_statistics=true
163
+ @statistics_arr[current_index]=[tc_name,"used mem",total_status[2].to_i,tc_execution,tc_link]
164
+ end
165
+ if total_status[1]=="pass rate" && total_status[0]==tc_name
166
+ b_test_in_statistics=true
167
+ pass_rate=(total_passed.to_f/(total_run.to_f-total_not_run.to_f))*100
168
+ pass_rate="%0.2f" % pass_rate
169
+ @statistics_arr[current_index]=[tc_name,"pass rate",pass_rate,tc_execution,tc_link]
170
+ end
171
+ current_index+=1
172
+ end
173
+ b_test_in_statistics
157
174
  end
158
175
 
159
176
  def collect_test_case_statistics()
@@ -181,14 +198,20 @@ class ReportingStatistics
181
198
  b_test_in_statistics=update_test_case_execution_statistics(tc_name,tc_status,tc_execution,duration,tc_link,reboots,crashes,dump_count,sent_bytes,received_bytes,memory_usage)
182
199
 
183
200
  if b_test_in_statistics==false
201
+ total_run=0
202
+ total_not_run=0
203
+ total_passed=0
184
204
  @all_statuses.each do |status|
185
205
  if status==tc_status
186
206
  @statistics_arr << [tc_name,tc_status,1,tc_execution,tc_link]
207
+ total_passed=1 if @pass_statuses.include?(tc_status)
208
+ total_not_run=1 if @not_run_statuses.include?(tc_status)
187
209
  elsif status=="reboots"
188
210
  @statistics_arr << [tc_name,"reboots",reboots.to_i,tc_execution,tc_link]
189
211
  elsif status=="crashes"
190
212
  @statistics_arr << [tc_name,"crashes",crashes.to_i,tc_execution,tc_link]
191
213
  elsif status=="total"
214
+ total_run=1
192
215
  @statistics_arr << [tc_name,"total",1,tc_execution,tc_link]
193
216
  elsif status=="duration"
194
217
  @statistics_arr << [tc_name,"duration",duration,tc_execution,tc_link]
@@ -198,8 +221,12 @@ class ReportingStatistics
198
221
  @statistics_arr << [tc_name,"sent bytes",sent_bytes,tc_execution,tc_link]
199
222
  elsif status=="received bytes"
200
223
  @statistics_arr << [tc_name,"received bytes",received_bytes,tc_execution,tc_link]
201
- elsif status=="used mem difference"
202
- @statistics_arr << [tc_name,"used mem difference",memory_usage,tc_execution,tc_link]
224
+ elsif status=="used mem"
225
+ @statistics_arr << [tc_name,"used mem",memory_usage,tc_execution,tc_link]
226
+ elsif status=="pass rate"
227
+ pass_rate=(total_passed.to_f/(total_run.to_f-total_not_run.to_f))*100
228
+ pass_rate="%0.2f" % pass_rate
229
+ @statistics_arr << [tc_name,"pass rate",pass_rate,tc_execution,tc_link]
203
230
  else
204
231
  @statistics_arr << [tc_name,status,0,tc_execution,tc_link]
205
232
  end
@@ -231,16 +258,16 @@ class ReportingStatistics
231
258
  tc_link='<a href="cases/'+result_page.to_i.to_s+'_chronological_total_run_index.html">'
232
259
  tc_link='<a href="cases/1_reboot_index.html">' if status=="reboots" && total>0
233
260
  tc_link='<a href="cases/1_crash_index.html">' if status=="crashes" && total>0
234
- 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
235
- 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
236
- 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
261
+ tc_link='<a href="cases/1_'+@pass_statuses.first.gsub(' ','_')+'_'+test_case.gsub(' ','_')+'_index.html">' if @pass_statuses.include?(status) && total>0
262
+ tc_link='<a href="cases/1_'+@fail_statuses.first.gsub(' ','_')+'_'+test_case.gsub(' ','_')+'_index.html">' if @fail_statuses.include?(status) && total>0
263
+ tc_link='<a href="cases/1_'+@not_run_statuses.first.gsub(' ','_')+'_'+test_case.gsub(' ','_')+'_index.html">' if @not_run_statuses.include?(status) && total>0
237
264
  else
238
265
  tc_link='<a href="'+result_page.to_i.to_s+'_chronological_total_run_index.html">'
239
266
  tc_link='<a href="1_reboot_index.html">' if status=="reboots" && total>0
240
267
  tc_link='<a href="1_crash_index.html">' if status=="crashes" && total>0
241
- 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
242
- 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
243
- 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
268
+ tc_link='<a href="1_'+@pass_statuses.first.gsub(' ','_')+'_'+test_case.gsub(' ','_')+'_index.html">' if @pass_statuses.include?(status) && total>0
269
+ tc_link='<a href="1_'+@fail_statuses.first.gsub(' ','_')+'_'+test_case.gsub(' ','_')+'_index.html">' if @fail_statuses.include?(status) && total>0
270
+ tc_link='<a href="1_'+@not_run_statuses.first.gsub(' ','_')+'_'+test_case.gsub(' ','_')+'_index.html">' if @not_run_statuses.include?(status) && total>0
244
271
  end
245
272
  tc_link
246
273