test-output-parser 0.0.3 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4161a37a5915d6abe2d2055a10219a7d6a025ecc
4
- data.tar.gz: c7e15dd7b38e1e2ed6bb80273338896fe8a576e3
3
+ metadata.gz: 11363d44bb20be392cf0c364aca640d4e6765d15
4
+ data.tar.gz: 704481936d666f8968aeffe2740a61b81b68b9a0
5
5
  SHA512:
6
- metadata.gz: fa75d70842bb9b2d7e3ff8312f2475b79e8bac08a32cf222ee00186dd899201e0e77a11b6466767786349e0666fb7296e0b8496ff1831e15f5fda43211144dfa
7
- data.tar.gz: aa06922d6642ca48724edcae46bae10126fce96189ab74a9b32fb0e466c7d2f8a82b5f36921d91c104a95ac84445ce69a2da6cbccf3c4f49df02a68e8b3815e3
6
+ metadata.gz: bebc1c57b4e1d95776e36d4bbc1bf21d0972b1a5af56e78041a36277c5e9bc8ba5caf75fd9dde9edbb7b83b18f38e31d5759247a5abbc3fd9d70564d27774ddb
7
+ data.tar.gz: bc74317300f4cdd5952803377f16620ece6607e78824d5dfe198a98f33a0a13ffd94c843a6d96210f39c2dd246f760c8bbbac3857d9ca76f323d453dc46531ad
@@ -2,7 +2,10 @@ 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
- TestOutputParser::Framework::RSpec.count(test_output)
5
+ def self.count(test_output, framework)
6
+ return TestOutputParser::Framework::RSpec.count(test_output) if framework == :rspec
7
+ return TestOutputParser::Framework::TestUnit.count(test_output) if framework == :test_unit
8
+
9
+ raise ArgumentError.new("Invalid argument")
7
10
  end
8
11
  end
@@ -1,4 +1,5 @@
1
1
  require 'test_output_parser/framework/rspec'
2
+ require 'test_output_parser/framework/test_unit'
2
3
 
3
4
  module TestOutputParser
4
5
  module Framework
@@ -0,0 +1,18 @@
1
+ module TestOutputParser
2
+ module Framework
3
+ class TestUnit
4
+ def self.count(test_output)
5
+ summary = Hash.new(0)
6
+ 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
+ summary[:total] += arr[0].to_i
8
+ summary[:assertions] += arr[1].to_i
9
+ summary[:failed] += arr[3].to_i
10
+ summary[:errors] += arr[5].to_i
11
+ summary[:skipped] += arr[7].to_i
12
+ end
13
+
14
+ summary
15
+ end
16
+ end
17
+ end
18
+ end
@@ -1,3 +1,3 @@
1
1
  module TestOutputParser
2
- VERSION = "0.0.3"
2
+ VERSION = "0.1.0"
3
3
  end
@@ -0,0 +1,7 @@
1
+ # Running tests:
2
+
3
+ .
4
+
5
+ Finished tests in 0.003116s, 320.9217 tests/s, 320.9217 assertions/s.
6
+
7
+ 1 tests, 1 assertions, 0 failures, 1 errors, 0 skips
@@ -0,0 +1,7 @@
1
+ # Running tests:
2
+
3
+ .
4
+
5
+ Finished tests in 0.003116s, 320.9217 tests/s, 320.9217 assertions/s.
6
+
7
+ 1 tests, 1 assertions, 1 failures, 0 errors, 0 skips
@@ -0,0 +1,7 @@
1
+ # Running tests:
2
+
3
+ .
4
+
5
+ Finished tests in 0.003116s, 320.9217 tests/s, 320.9217 assertions/s.
6
+
7
+ 1 tests, 1 assertions, 0 failures, 0 errors, 1 skips
@@ -0,0 +1,7 @@
1
+ # Running tests:
2
+
3
+ .
4
+
5
+ Finished tests in 0.003116s, 320.9217 tests/s, 320.9217 assertions/s.
6
+
7
+ 1 tests, 1 assertions, 0 failures, 0 errors, 0 skips
@@ -0,0 +1,31 @@
1
+ require 'spec_helper'
2
+
3
+ describe TestOutputParser::Framework::RSpec do
4
+ it 'should do nothing when there is no spec summary in the output' do
5
+ TestOutputParser::Framework::RSpec.count("123 foo bar examples").should == {}
6
+ end
7
+
8
+ it 'should count the number of specs ran for one example' do
9
+ TestOutputParser::Framework::RSpec.count("1 example, 0 failures").should == {:total => 1, :failed => 0, :pending => 0}
10
+ end
11
+
12
+ it 'should count the number of specs ran for one rspec run' do
13
+ TestOutputParser::Framework::RSpec.count("25 examples, 0 failures").should == {:total => 25, :failed => 0, :pending => 0}
14
+ end
15
+
16
+ it 'should count the number of specs ran for multiple rspec runs' do
17
+ TestOutputParser::Framework::RSpec.count("25 examples, 1 failure\n\n\n5 examples, 3 failures").should == {:total => 30, :failed => 4, :pending => 0}
18
+ end
19
+
20
+ it 'should ignore lines not related to rspec test summary' do
21
+ TestOutputParser::Framework::RSpec.count(File.read("spec/fixtures/sample-rspec-output.txt")).should == {:total => 67, :failed => 0, :pending => 0}
22
+ end
23
+
24
+ it 'should count failures correctly' do
25
+ TestOutputParser::Framework::RSpec.count(File.read("spec/fixtures/sample-failed-rspec-output.txt")).should == {:total => 1460, :failed => 1, :pending => 3}
26
+ end
27
+
28
+ it 'should count the number of pending specs' do
29
+ TestOutputParser::Framework::RSpec.count(File.read("spec/fixtures/sample-failed-rspec-output.txt")).should == {:total => 1460, :failed => 1, :pending => 3}
30
+ end
31
+ end
@@ -0,0 +1,37 @@
1
+ require 'spec_helper'
2
+
3
+ describe TestOutputParser::Framework::TestUnit do
4
+ it 'should do nothing when there is no spec summary in the output' do
5
+ TestOutputParser::Framework::TestUnit.count("1 assertion").should == {}
6
+ end
7
+
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, :assertions => 1, :failed => 0, :errors => 0, :skipped => 0}
10
+ end
11
+
12
+ it 'should count the number of specs ran for one test-unit run' do
13
+ TestOutputParser::Framework::TestUnit.count("30 tests, 77 assertions, 3 failures, 4 errors, 2 skips").should ==
14
+ {:total => 30, :assertions => 77, :failed => 3, :errors => 4, :skipped => 2}
15
+ end
16
+
17
+ it 'should count the number of specs ran for multiple test-unit runs' do
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, :assertions => 80, :failed => 1, :errors => 1, :skipped => 1}
20
+ end
21
+
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, :assertions => 1, :failed => 0, :errors => 0, :skipped => 0}
24
+ end
25
+
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, :assertions => 1, :failed => 1, :errors => 0, :skipped => 0}
28
+ end
29
+
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, :assertions => 1, :failed => 0, :errors => 1, :skipped => 0}
32
+ end
33
+
34
+ it 'should count the number of specs skipped' do
35
+ TestOutputParser::Framework::TestUnit.count(File.read("spec/fixtures/sample-skipped-test-unit-output.txt")).should == {:total => 1, :assertions => 1, :failed => 0, :errors => 0, :skipped => 1}
36
+ end
37
+ end
@@ -1,31 +1,17 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe TestOutputParser do
4
- it 'should do nothing when there is no spec summary in the output' do
5
- TestOutputParser.count("123 foo bar examples").should == {}
4
+ it 'should give the summary of specs for rspec' do
5
+ TestOutputParser.count(File.read("spec/fixtures/sample-failed-rspec-output.txt"), :rspec).should == {:total => 1460, :failed => 1, :pending => 3}
6
6
  end
7
7
 
8
- it 'should count the number of specs ran for one example' do
9
- TestOutputParser.count("1 example, 0 failures").should == {:total => 1, :failed => 0, :pending => 0}
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"), :test_unit).should == {:total => 1, :assertions => 1, :failed => 1, :errors => 0, :skipped => 0}
10
10
  end
11
11
 
12
- it 'should count the number of specs ran for one rspec run' do
13
- TestOutputParser.count("25 examples, 0 failures").should == {:total => 25, :failed => 0, :pending => 0}
14
- end
15
-
16
- it 'should count the number of specs ran for multiple rspec runs' do
17
- TestOutputParser.count("25 examples, 1 failure\n\n\n5 examples, 3 failures").should == {:total => 30, :failed => 4, :pending => 0}
18
- end
19
-
20
- it 'should ignore lines not related to rspec test summary' do
21
- TestOutputParser.count(File.read("spec/fixtures/sample-rspec-output.txt")).should == {:total => 67, :failed => 0, :pending => 0}
22
- end
23
-
24
- it 'should count failures correctly' do
25
- TestOutputParser.count(File.read("spec/fixtures/sample-failed-rspec-output.txt")).should == {:total => 1460, :failed => 1, :pending => 3}
26
- end
27
-
28
- it 'should count the number of pending specs' do
29
- TestOutputParser.count(File.read("spec/fixtures/sample-failed-rspec-output.txt")).should == {:total => 1460, :failed => 1, :pending => 3}
12
+ it 'should raise an error when a valid framework is not specified' do
13
+ lambda do
14
+ TestOutputParser.count("foo", :bar)
15
+ end.should raise_error(ArgumentError)
30
16
  end
31
17
  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.0.3
4
+ version: 0.1.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-01-27 00:00:00.000000000 Z
11
+ date: 2014-02-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -70,10 +70,17 @@ files:
70
70
  - lib/test_output_parser.rb
71
71
  - lib/test_output_parser/framework.rb
72
72
  - lib/test_output_parser/framework/rspec.rb
73
+ - lib/test_output_parser/framework/test_unit.rb
73
74
  - lib/test_output_parser/version.rb
75
+ - spec/fixtures/sample-error-test-unit-output.txt
74
76
  - spec/fixtures/sample-failed-rspec-output.txt
77
+ - spec/fixtures/sample-failed-test-unit-output.txt
75
78
  - spec/fixtures/sample-junit-output.txt
76
79
  - spec/fixtures/sample-rspec-output.txt
80
+ - spec/fixtures/sample-skipped-test-unit-output.txt
81
+ - spec/fixtures/sample-test-unit-output.txt
82
+ - spec/framework/rspec_spec.rb
83
+ - spec/framework/test_unit_spec.rb
77
84
  - spec/spec_helper.rb
78
85
  - spec/test_output_parser_spec.rb
79
86
  - test-output-parser.gemspec
@@ -102,8 +109,14 @@ signing_key:
102
109
  specification_version: 4
103
110
  summary: A gem to get the summary of test outputs for further processing
104
111
  test_files:
112
+ - spec/fixtures/sample-error-test-unit-output.txt
105
113
  - spec/fixtures/sample-failed-rspec-output.txt
114
+ - spec/fixtures/sample-failed-test-unit-output.txt
106
115
  - spec/fixtures/sample-junit-output.txt
107
116
  - spec/fixtures/sample-rspec-output.txt
117
+ - spec/fixtures/sample-skipped-test-unit-output.txt
118
+ - spec/fixtures/sample-test-unit-output.txt
119
+ - spec/framework/rspec_spec.rb
120
+ - spec/framework/test_unit_spec.rb
108
121
  - spec/spec_helper.rb
109
122
  - spec/test_output_parser_spec.rb