Method: CukeSniffer::Formatter.output_xml

Defined in:
lib/cuke_sniffer/formatter.rb

.output_xml(cuke_sniffer, file_name = DEFAULT_OUTPUT_FILE_NAME) ⇒ Object

Creates a xml file with the collected project details file_name defaults to “cuke_sniffer_result.xml” unless specified

cuke_sniffer.output_xml

Or

cuke_sniffer.output_xml("cuke_sniffer01-01-0001.xml")


97
98
99
100
101
102
103
104
105
# File 'lib/cuke_sniffer/formatter.rb', line 97

def self.output_xml(cuke_sniffer, file_name = DEFAULT_OUTPUT_FILE_NAME)
  file_name = file_name + ".xml" unless file_name =~ /\.xml$/

  doc = Nokogiri::XML::Document.new
  doc.root = cuke_sniffer.to_xml
  open(file_name, "w") do |file|
    file << doc.serialize
  end
end