class Rproof::XMLReporter
Public Class Methods
new(xml_pathname:)
click to toggle source
# File lib/rproof/xml_reporter.rb, line 13 def initialize(xml_pathname:) @xml_pathname = xml_pathname end
Public Instance Methods
assertion_to_xml(assertion, xml_assertion)
click to toggle source
# File lib/rproof/xml_reporter.rb, line 32 def assertion_to_xml(assertion, xml_assertion) xml_assertion.file = assertion.file xml_assertion.line = assertion.line xml_assertion.method = assertion.method xml_assertion.comment = assertion.comment xml_assertion.expected = assertion.expected.inspect xml_assertion.obtained = assertion.obtained.inspect xml_assertion end
report_campaign_begin()
click to toggle source
# File lib/rproof/xml_reporter.rb, line 17 def report_campaign_begin end
report_campaign_end(test_results, start_time, end_time)
click to toggle source
# File lib/rproof/xml_reporter.rb, line 42 def report_campaign_end(test_results, start_time, end_time) results = (test_results.is_a? Array) ? test_results.flatten : [test_results] xml = Builder::XmlMarkup.new(indent: 2) xml.test_campgain do |xml_campgain| results.each do |result| xml_campgain.test_result do |xml_result| xml_result.name result.name xml_result.description result.description xml_result.assertions do |xml_assertions| result.assertions.each do |assertion| if assertion.is_successful xml_assertions.success do |xml_assertion| xml_assertion = assertion_to_xml(assertion, xml_assertion) end else xml_assertions.failure do |xml_assertion| xml_assertion = assertion_to_xml(assertion, xml_assertion) end end end end xml_result.warnings do |xml_warnings| result.warnings.each do |warning| xml_warnings.warning warning.message end end xml_result.exceptions do |xml_exceptions| result.exceptions.each do |exception| xml_exceptions.exception do |xml_exception| xml_exception.message = exception.message xml_exception.backtrace = exception.backtrace.join("\n") end end end end end end xml_file = File.open(@xml_pathname, "w") xml_file << xml.target! xml_file.close end
report_suite_begin(id, name, description)
click to toggle source
# File lib/rproof/xml_reporter.rb, line 20 def report_suite_begin(id, name, description) end
report_suite_end(id, test_results)
click to toggle source
# File lib/rproof/xml_reporter.rb, line 29 def report_suite_end(id, test_results) end
report_test_begin(id, name, description)
click to toggle source
# File lib/rproof/xml_reporter.rb, line 23 def report_test_begin(id, name, description) end
report_test_end(id, test_result)
click to toggle source
# File lib/rproof/xml_reporter.rb, line 26 def report_test_end(id, test_result) end