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

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

Defined Under Namespace

Classes: Listener

Instance Method Summary collapse

Methods included from Test::Unit::Collector

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

Instance Method Details

#collect(xml_log_path) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/test/unit/collector/xml.rb', line 12

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