Sha256: 0d151ac651ae64f120d0a062630b4b3ff52c8be3bc3902ef55f512ee3f49dac5

Contents?: true

Size: 1.21 KB

Versions: 10

Compression:

Stored size: 1.21 KB

Contents

require 'cucumber/formatter/junit'
require 'cucumber/formatter/ordered_xml_markup'
module JCukeForker
  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

10 entries across 10 versions & 1 rubygems

Version Path
jcukeforker-0.3.1 lib/jcukeforker/formatters/junit_scenario_formatter.rb
jcukeforker-0.2.10 lib/jcukeforker/formatters/junit_scenario_formatter.rb
jcukeforker-0.2.9 lib/jcukeforker/formatters/junit_scenario_formatter.rb
jcukeforker-0.2.8 lib/jcukeforker/formatters/junit_scenario_formatter.rb
jcukeforker-0.2.7 lib/jcukeforker/formatters/junit_scenario_formatter.rb
jcukeforker-0.2.6 lib/jcukeforker/formatters/junit_scenario_formatter.rb
jcukeforker-0.2.5 lib/jcukeforker/formatters/junit_scenario_formatter.rb
jcukeforker-0.2.4 lib/jcukeforker/formatters/junit_scenario_formatter.rb
jcukeforker-0.2.3 lib/jcukeforker/formatters/junit_scenario_formatter.rb
jcukeforker-0.2.2 lib/jcukeforker/formatters/junit_scenario_formatter.rb