Class: Test::Unit::Collector::XML

Inherits:
Object
  • Object
show all
Includes:
Test::Unit::Collector
Defined in:
lib/test/unit/collector/xml.rb

Defined Under Namespace

Classes: Listener

Instance Method Summary collapse

Methods included from Test::Unit::Collector

#add_suite, #filter=, #include?, #initialize, #sort

Instance Method Details

#collect(xml_log_path) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
# File 'lib/test/unit/collector/xml.rb', line 21

def collect(xml_log_path)
  listener = Listener.new
  File.open(xml_log_path) do |xml_log|
    parser = REXML::Parsers::StreamParser.new(xml_log, listener)
    parser.parse
  end
  suite = TestSuite.new("tests in #{xml_log_path}")
  suites = listener.test_suites
  sort(suites).each {|s| add_suite(suite, s)}
  suite
end