Class: Minitest::Queue::JUnitReporter
- Inherits:
-
Reporters::BaseReporter
- Object
- Reporters::BaseReporter
- Minitest::Queue::JUnitReporter
- Defined in:
- lib/minitest/queue/junit_reporter.rb
Defined Under Namespace
Classes: XmlMarkup
Instance Method Summary collapse
-
#initialize(report_path = 'log/junit.xml', options = {}) ⇒ JUnitReporter
constructor
A new instance of JUnitReporter.
- #report ⇒ Object
Constructor Details
#initialize(report_path = 'log/junit.xml', options = {}) ⇒ JUnitReporter
Returns a new instance of JUnitReporter.
14 15 16 17 18 |
# File 'lib/minitest/queue/junit_reporter.rb', line 14 def initialize(report_path = 'log/junit.xml', = {}) super({}) @report_path = File.absolute_path(report_path) @base_path = [:base_path] || Dir.pwd end |
Instance Method Details
#report ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/minitest/queue/junit_reporter.rb', line 20 def report super suites = tests.group_by { |test| test.klass } xml = Builder::XmlMarkup.new(indent: 2) xml.instruct! xml.testsuites do suites.each do |suite, tests| add_tests_to(xml, suite, tests) end end FileUtils.mkdir_p(File.dirname(@report_path)) File.open(@report_path, 'w+') { |file| file << xml.target! } end |