Sha256: 219c8148630ed69eeda2cf79a398483a872b842edd273419e9b93d43c70b34fc

Contents?: true

Size: 1.21 KB

Versions: 12

Compression:

Stored size: 1.21 KB

Contents

require 'cucumber/formatter/junit'
require 'cucumber/formatter/ordered_xml_markup'
module CukeForker
  module Formatters
    class JunitScenarioFormatter < Cucumber::Formatter::Junit
      def feature_result_filename(feature_file)
        File.join(@reportdir, "TEST-#{basename(feature_file)}.xml")
      end

      def after_feature(feature)
        # do nothing
      end

      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

      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
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
cukeforker-0.2.5 lib/cukeforker/formatters/junit_scenario_formatter.rb
cukeforker-0.2.4 lib/cukeforker/formatters/junit_scenario_formatter.rb
cukeforker-0.2.3 lib/cukeforker/formatters/junit_scenario_formatter.rb
cukeforker-0.2.2 lib/cukeforker/formatters/junit_scenario_formatter.rb
cukeforker-0.2.1 lib/cukeforker/formatters/junit_scenario_formatter.rb
cukeforker-0.2.0 lib/cukeforker/formatters/junit_scenario_formatter.rb
cukeforker-0.1.9 lib/cukeforker/formatters/junit_scenario_formatter.rb
cukeforker-0.1.8 lib/cukeforker/formatters/junit_scenario_formatter.rb
cukeforker-0.1.7 lib/cukeforker/formatters/junit_scenario_formatter.rb
cukeforker-0.1.6 lib/cukeforker/formatters/junit_scenario_formatter.rb
cukeforker-0.1.5 lib/cukeforker/formatters/junit_scenario_formatter.rb
cukeforker-0.1.4 lib/cukeforker/formatters/junit_scenario_formatter.rb