class InspecPlugins::JUnitReporter::Reporter
Public Class Methods
run_data_schema_constraints()
click to toggle source
# File lib/plugins/inspec-reporter-junit/lib/inspec-reporter-junit/reporter.rb, line 3 def self.run_data_schema_constraints "~> 0.0" end
Public Instance Methods
count_profile_errored_tests(profile)
click to toggle source
# File lib/plugins/inspec-reporter-junit/lib/inspec-reporter-junit/reporter.rb, line 47 def count_profile_errored_tests(profile) profile.controls.reduce(0) do |acc, elem| acc + elem.results.reduce(0) do |err_test_total, test_case| test_case.backtrace.nil? ? err_test_total : err_test_total + 1 end end end
count_profile_failed_tests(profile)
click to toggle source
# File lib/plugins/inspec-reporter-junit/lib/inspec-reporter-junit/reporter.rb, line 31 def count_profile_failed_tests(profile) profile.controls.reduce(0) do |acc, elem| acc + elem.results.reduce(0) do |fail_test_total, test_case| test_case.status == "failed" ? fail_test_total + 1 : fail_test_total end end end
count_profile_skipped_tests(profile)
click to toggle source
# File lib/plugins/inspec-reporter-junit/lib/inspec-reporter-junit/reporter.rb, line 39 def count_profile_skipped_tests(profile) profile.controls.reduce(0) do |acc, elem| acc + elem.results.reduce(0) do |skip_test_total, test_case| test_case.status == "skipped" ? skip_test_total + 1 : skip_test_total end end end
count_profile_tests(profile)
click to toggle source
# File lib/plugins/inspec-reporter-junit/lib/inspec-reporter-junit/reporter.rb, line 25 def count_profile_tests(profile) profile.controls.reduce(0) do |acc, elem| acc + elem.results.count end end
render()
click to toggle source
# File lib/plugins/inspec-reporter-junit/lib/inspec-reporter-junit/reporter.rb, line 7 def render require "rexml/document" unless defined?(REXML::Document) xml_output = REXML::Document.new xml_output.add(REXML::XMLDecl.new) testsuites = REXML::Element.new("testsuites") xml_output.add(testsuites) run_data.profiles.each_with_index do |profile, idx| testsuites.add(build_profile_xml(profile, idx)) end formatter = REXML::Formatters::Pretty.new formatter.compact = true output(formatter.write(xml_output.xml_decl, "")) output(formatter.write(xml_output.root, "")) end