test-output-parser 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/test_output_parser.rb +3 -5
- data/lib/test_output_parser/framework.rb +3 -0
- data/lib/test_output_parser/framework/rspec.rb +1 -2
- data/lib/test_output_parser/framework/test_unit.rb +3 -4
- data/lib/test_output_parser/version.rb +1 -1
- data/spec/fixtures/{sample-skipped-test-unit-output.txt → sample-pending-test-unit-output.txt} +0 -0
- data/spec/framework/test_unit_spec.rb +8 -8
- data/spec/test_output_parser_spec.rb +4 -6
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: af6f80610f90a75280a15fd9ae8a0c93d7991d6b
|
4
|
+
data.tar.gz: 375e847ab92cc5c02c7ec3c9cda9d07992e63ead
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a1f711eb3266edd2457d83a9b5694c23fd2b244bcbbf936b7e1f76cd40f78b30c2ae57309aa011386fd5083dfe5c46ba550ade9d8a077cd324b23ba6e60ad029
|
7
|
+
data.tar.gz: 2c9faab045e24dce8a4ea1aa3757e7ca856fd762e69ac9a49e11b195ad3ad3cd13184528aae5b0f8850359261904aee33270f0d4916d13e8a5975a2058fecf72
|
data/lib/test_output_parser.rb
CHANGED
@@ -2,10 +2,8 @@ require 'test_output_parser/version'
|
|
2
2
|
require 'test_output_parser/framework'
|
3
3
|
|
4
4
|
module TestOutputParser
|
5
|
-
def self.count(test_output
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
raise ArgumentError.new("Invalid argument")
|
5
|
+
def self.count(test_output)
|
6
|
+
summary = TestOutputParser::Framework::RSpec.count(test_output)
|
7
|
+
TestOutputParser::Framework::TestUnit.count(test_output, summary)
|
10
8
|
end
|
11
9
|
end
|
@@ -1,8 +1,7 @@
|
|
1
1
|
module TestOutputParser
|
2
2
|
module Framework
|
3
3
|
class RSpec
|
4
|
-
def self.count(test_output)
|
5
|
-
summary = Hash.new(0)
|
4
|
+
def self.count(test_output, summary=Hash.new(0))
|
6
5
|
test_output.scan(/(\d+)\s+example[s]?,\s+(\d+)\s+failure[s]?(,\s*(\d+)\s+pending)?/).each do |arr|
|
7
6
|
summary[:total] += arr[0].to_i
|
8
7
|
summary[:failed] += arr[1].to_i
|
@@ -1,14 +1,13 @@
|
|
1
1
|
module TestOutputParser
|
2
2
|
module Framework
|
3
3
|
class TestUnit
|
4
|
-
def self.count(test_output)
|
5
|
-
summary = Hash.new(0)
|
4
|
+
def self.count(test_output, summary=Hash.new(0))
|
6
5
|
test_output.scan(/(\d+)\s+test[s]?,\s+(\d+)\s+assertion[s]?(,\s*(\d+)\s+failures)?(,\s*(\d+)\s+error[s]?)?(,\s*(\d+)\s+skip[s]?)?/).each do |arr|
|
7
6
|
summary[:total] += arr[0].to_i
|
8
|
-
summary[:assertions] += arr[1].to_i
|
7
|
+
#summary[:assertions] += arr[1].to_i
|
9
8
|
summary[:failed] += arr[3].to_i
|
10
9
|
summary[:errors] += arr[5].to_i
|
11
|
-
summary[:
|
10
|
+
summary[:pending] += arr[7].to_i
|
12
11
|
end
|
13
12
|
|
14
13
|
summary
|
data/spec/fixtures/{sample-skipped-test-unit-output.txt → sample-pending-test-unit-output.txt}
RENAMED
File without changes
|
@@ -6,32 +6,32 @@ describe TestOutputParser::Framework::TestUnit do
|
|
6
6
|
end
|
7
7
|
|
8
8
|
it 'should count the number of tests ran for one test' do
|
9
|
-
TestOutputParser::Framework::TestUnit.count("1 tests, 1 assertions").should == {:total => 1, :
|
9
|
+
TestOutputParser::Framework::TestUnit.count("1 tests, 1 assertions").should == {:total => 1, :failed => 0, :errors => 0, :pending => 0}
|
10
10
|
end
|
11
11
|
|
12
12
|
it 'should count the number of specs ran for one test-unit run' do
|
13
13
|
TestOutputParser::Framework::TestUnit.count("30 tests, 77 assertions, 3 failures, 4 errors, 2 skips").should ==
|
14
|
-
{:total => 30, :
|
14
|
+
{:total => 30, :failed => 3, :errors => 4, :pending => 2}
|
15
15
|
end
|
16
16
|
|
17
17
|
it 'should count the number of specs ran for multiple test-unit runs' do
|
18
18
|
TestOutputParser::Framework::TestUnit.count("30 tests, 77 assertions, 0 failures\n\n\n1 tests, 3 assertions, 1 failures, 1 errors, 1 skips").should ==
|
19
|
-
{:total => 31, :
|
19
|
+
{:total => 31, :failed => 1, :errors => 1, :pending => 1}
|
20
20
|
end
|
21
21
|
|
22
22
|
it 'should ignore lines not related to test-unit test summary' do
|
23
|
-
TestOutputParser::Framework::TestUnit.count(File.read("spec/fixtures/sample-test-unit-output.txt")).should == {:total => 1, :
|
23
|
+
TestOutputParser::Framework::TestUnit.count(File.read("spec/fixtures/sample-test-unit-output.txt")).should == {:total => 1, :failed => 0, :errors => 0, :pending => 0}
|
24
24
|
end
|
25
25
|
|
26
26
|
it 'should count failures correctly' do
|
27
|
-
TestOutputParser::Framework::TestUnit.count(File.read("spec/fixtures/sample-failed-test-unit-output.txt")).should == {:total => 1, :
|
27
|
+
TestOutputParser::Framework::TestUnit.count(File.read("spec/fixtures/sample-failed-test-unit-output.txt")).should == {:total => 1, :failed => 1, :errors => 0, :pending => 0}
|
28
28
|
end
|
29
29
|
|
30
30
|
it 'should count the number of specs errors' do
|
31
|
-
TestOutputParser::Framework::TestUnit.count(File.read("spec/fixtures/sample-error-test-unit-output.txt")).should == {:total => 1, :
|
31
|
+
TestOutputParser::Framework::TestUnit.count(File.read("spec/fixtures/sample-error-test-unit-output.txt")).should == {:total => 1, :failed => 0, :errors => 1, :pending => 0}
|
32
32
|
end
|
33
33
|
|
34
|
-
it 'should count the number of specs
|
35
|
-
TestOutputParser::Framework::TestUnit.count(File.read("spec/fixtures/sample-
|
34
|
+
it 'should count the number of specs pending' do
|
35
|
+
TestOutputParser::Framework::TestUnit.count(File.read("spec/fixtures/sample-pending-test-unit-output.txt")).should == {:total => 1, :failed => 0, :errors => 0, :pending => 1}
|
36
36
|
end
|
37
37
|
end
|
@@ -2,16 +2,14 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe TestOutputParser do
|
4
4
|
it 'should give the summary of specs for rspec' do
|
5
|
-
TestOutputParser.count(File.read("spec/fixtures/sample-failed-rspec-output.txt")
|
5
|
+
TestOutputParser.count(File.read("spec/fixtures/sample-failed-rspec-output.txt")).should == {:total => 1460, :failed => 1, :pending => 3}
|
6
6
|
end
|
7
7
|
|
8
8
|
it 'should give the summary of specs for test unit' do
|
9
|
-
TestOutputParser.count(File.read("spec/fixtures/sample-failed-test-unit-output.txt")
|
9
|
+
TestOutputParser.count(File.read("spec/fixtures/sample-failed-test-unit-output.txt")).should == {:total => 1, :failed => 1, :errors => 0, :pending => 0}
|
10
10
|
end
|
11
11
|
|
12
|
-
it 'should
|
13
|
-
|
14
|
-
TestOutputParser.count("foo", :bar)
|
15
|
-
end.should raise_error(ArgumentError)
|
12
|
+
it 'should add up the summaries when there are specs for multiple frameworks' do
|
13
|
+
TestOutputParser.count(File.read("spec/fixtures/sample-failed-test-unit-output.txt") + File.read("spec/fixtures/sample-failed-rspec-output.txt")).should == {:total => 1461, :failed => 2, :errors => 0, :pending => 3}
|
16
14
|
end
|
17
15
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: test-output-parser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Akshay Karle
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-02-
|
11
|
+
date: 2014-02-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -76,8 +76,8 @@ files:
|
|
76
76
|
- spec/fixtures/sample-failed-rspec-output.txt
|
77
77
|
- spec/fixtures/sample-failed-test-unit-output.txt
|
78
78
|
- spec/fixtures/sample-junit-output.txt
|
79
|
+
- spec/fixtures/sample-pending-test-unit-output.txt
|
79
80
|
- spec/fixtures/sample-rspec-output.txt
|
80
|
-
- spec/fixtures/sample-skipped-test-unit-output.txt
|
81
81
|
- spec/fixtures/sample-test-unit-output.txt
|
82
82
|
- spec/framework/rspec_spec.rb
|
83
83
|
- spec/framework/test_unit_spec.rb
|
@@ -113,8 +113,8 @@ test_files:
|
|
113
113
|
- spec/fixtures/sample-failed-rspec-output.txt
|
114
114
|
- spec/fixtures/sample-failed-test-unit-output.txt
|
115
115
|
- spec/fixtures/sample-junit-output.txt
|
116
|
+
- spec/fixtures/sample-pending-test-unit-output.txt
|
116
117
|
- spec/fixtures/sample-rspec-output.txt
|
117
|
-
- spec/fixtures/sample-skipped-test-unit-output.txt
|
118
118
|
- spec/fixtures/sample-test-unit-output.txt
|
119
119
|
- spec/framework/rspec_spec.rb
|
120
120
|
- spec/framework/test_unit_spec.rb
|