Created
June 7, 2010 13:22
-
-
Save lucascs/428658 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
post '/junit-results' do | |
result = JSON.parse(request.body.read) | |
passes = result['stats']['passes'] | |
failures = result['stats']['failures'] | |
File.open(File.dirname(__FILE__) + '/../../target/artifacts/reports/javascript.xml', 'w') do |f| | |
xml = Builder::XmlMarkup.new | |
suite = xml.testsuite :errors => 0, :failures => failures, :tests => passes, :name => "javascript.tests" do | |
result['results'].each do |tc| | |
unless tc.nil? | |
tc['specs'].each do |s| | |
xml.testcase :classname => tc['description'], :name => s['description'] do | |
if s['status'] != 'pass' | |
xml.failure s['assertions'].inspect, :message => s['assertions'].inspect | |
end | |
end | |
end | |
end | |
end | |
end | |
f.write suite | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment