Posted By

noah on 11/20/10


Tagged

data testing ruby grep irb aggregator analysis Hudson


Versions (?)

analysis of Hudson JUNit logfiles


 / Published in: Ruby
 

assuming you are standing in$HUDSON_HOME/jobs/job_foo/builds/123

  1. require 'nokogiri'
  2.  
  3. d=Nokogiri::XML(open("#{ARGV[0]}/junitResult.xml"))
  4.  
  5. suite = d.search('suite case')
  6.  
  7. name_for_test = ''
  8. slowest = 0
  9.  
  10.  
  11. def get_name el
  12. el.search('className').text +
  13. '::' +
  14. el.search('testName').text
  15. end
  16.  
  17. def get_duration el
  18. el.search('duration').text.to_f
  19. end
  20.  
  21. d.search('case').each {|el| t=get_duration(el); t > slowest && slowest = t; t >= slowest && name_for_test = get_name(el)}
  22.  
  23. p name_for_test,slowest

Report this snippet  

You need to login to post a comment.