Class: CukeForker::Formatters::JunitScenarioFormatter

Inherits:
Cucumber::Formatter::Junit
  • Object
show all
Defined in:
lib/cukeforker/formatters/junit_scenario_formatter.rb

Instance Method Summary collapse

Instance Method Details

#after_feature(feature) ⇒ Object



10
11
12
# File 'lib/cukeforker/formatters/junit_scenario_formatter.rb', line 10

def after_feature(feature)
  # do nothing
end

#after_feature_element(feature_element) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/cukeforker/formatters/junit_scenario_formatter.rb', line 22

def after_feature_element(feature_element)
  @testsuite = Cucumber::Formatter::OrderedXmlMarkup.new( :indent => 2 )
  @testsuite.instruct!
  @testsuite.testsuite(
    :failures => @failures,
    :errors => @errors,
    :skipped => @skipped,
    :tests => @tests,
    :time => "%.6f" % @time,
    :name => @feature_name ) do
    @testsuite << @builder.target!
  end

  line_number = feature_element_line_number(feature_element)
  write_file(feature_result_filename(feature_element.feature.file+"-#{line_number}"), @testsuite.target!)
end

#feature_element_line_number(feature_element) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/cukeforker/formatters/junit_scenario_formatter.rb', line 14

def feature_element_line_number(feature_element)
  if feature_element.respond_to? :line
    feature_element.line
  else
    feature_element.instance_variable_get(:@line)
  end
end

#feature_result_filename(feature_file) ⇒ Object



6
7
8
# File 'lib/cukeforker/formatters/junit_scenario_formatter.rb', line 6

def feature_result_filename(feature_file)
  File.join(@reportdir, "TEST-#{basename(feature_file)}.xml")
end