Class: JunitReportGenerator::TestSuites

Inherits:
Element
  • Object
show all
Defined in:
lib/junit_report_generator/elements/test_suites.rb

Instance Attribute Summary

Attributes included from Elementary

#attributes

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Element

create

Methods included from Elementary

#assemble_attributes, #method_missing, #update_attributes

Constructor Details

#initializeTestSuites

Returns a new instance of TestSuites.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/junit_report_generator/elements/test_suites.rb', line 7

def initialize
  @tests = 0
  @errors = 0
  @failures = 0
  @disabled = 0
  @time = 0
  assemble_attributes(:tests, :errors, :failures, :disabled, :time)
  register do |sub_elements|
    sub_elements.each do |sub_element|
      attributes = sub_element.attributes
      @tests += attributes.fetch(:tests, 0).to_i
      @errors += attributes.fetch(:errors, 0).to_i
      @failures += attributes.fetch(:failures, 0).to_i
      @disabled += attributes.fetch(:disabled, 0).to_i
      @time += attributes.fetch(:time, 0).to_f
    end
    update_attributes(:tests, :errors, :failures, :disabled, :time)
  end
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class JunitReportGenerator::Elementary

Class Method Details

.xml_tag_nameObject



28
29
30
# File 'lib/junit_report_generator/elements/test_suites.rb', line 28

def xml_tag_name
  'testsuites'
end