3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
# File 'lib/test-parser/parsers/rubyunit.rb', line 3
def self.parse test_results
test_info = Hash.new(0)
test_info[:failures] = []
test_results.scan(/(\d+) tests?, \d+ assertions?, (\d+) failures?, (\d+) errors/).each do |(tests,failures,errors)|
test_info[:failure_count] += failures.to_i + errors.to_i
test_info[:test_count] += tests.to_i
end
test_results.scan(/\s+\d+\) Failure:\n(.*?) \[(.*?):(\d+)\]:\n(.*?)\n/).each do |(test,file,line,message)|
test_info[:failures] << {:test => test,
:file => file,
:line => line.to_i,
:message => message}
end
test_results.scan(/\s+\d+\) Error:\n(.+?):\n(.+?): (.+?)\n\s*(.+?):(\d+):in `(.+?)'/).each do |(test,error_type,message,file,line,method)|
test_info[:failures] << {:test => test,
:error_type => error_type,
:message => message,
:file => file,
:line => line.to_i,
:method => method}
end
test_info[:success_count] = test_info[:test_count] - test_info[:failure_count]
test_info.default = nil
test_info
end
|