test-output-parser 0.2.1 → 0.3.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: ff35a4c7d8d503b03bce1c540bfbca8f4f7a3982
4
- data.tar.gz: 0dc6a7af57db982c6040d6331328c3c62d29d7bc
3
+ metadata.gz: 62e8801a738f5c54e2a87b487b5ed1de94801b75
4
+ data.tar.gz: e130c6f72a8fcafb778c911ca68a8b3e3a9e7e2a
5
5
  SHA512:
6
- metadata.gz: e242af1c68e565df57c5f296713f55b6f7b310ca3bce37799e2eda08397d6185aaef24b236f81c61d2dc3be36eb29e3d914bf19712f3c580da37fc75b43ce901
7
- data.tar.gz: 8cefeda5bc9df0e9c4be85e2085369e4e43cdb20242b9cc7dd43f7c213778eef21bef6cb1e7d9186752f3b817afab94874adb6cb12687b32c2001bf2aefa149a
6
+ metadata.gz: 37e20fec72155d567da774fed81bae22c5779d14f0b47d0980ee6ee7ee7769baebcd99f4d98260edb6c0ad524a2dfe508680205fc2cb1efac22fa93ac8f71ae5
7
+ data.tar.gz: 51f36e46f9688610415b9f186f2affb269c54ecd44d75edc31e1a2101cab6eee83f8e2c35f09fde23d1563d72441e631317a5acf1a493ee9d9a5e6055f8b4741
@@ -4,8 +4,5 @@ require 'test_output_parser/framework/junit'
4
4
 
5
5
  module TestOutputParser
6
6
  module Framework
7
- def count(test_output)
8
- raise 'Sub class responsibility'
9
- end
10
7
  end
11
8
  end
@@ -9,11 +9,20 @@ module TestOutputParser
9
9
  summary[:pending] += arr[3].to_i
10
10
  end
11
11
 
12
+ failures = test_output.match(/^Failed\stests:\s+(.+\n)+\n/)
13
+ summary[:failures] = failures.to_s.strip if failures
14
+
12
15
  test_output.scan(/(\d+)\s+test[s]?\s+completed,\s+(\d+)\s+failed/).each do |arr|
13
16
  summary[:total] += arr[0].to_i
14
17
  summary[:failed] += arr[1].to_i
15
18
  end
16
19
 
20
+ failures = test_output.scan(/^Running\stest:\s.*\n\n.*\s+FAILED\n.*/)
21
+ if summary.has_key?(:failures)
22
+ summary[:failures] = summary[:failures].join(failures.join("\n")) unless failures.empty?
23
+ else
24
+ summary[:failures] = failures.join("\n") unless failures.empty?
25
+ end
17
26
  summary
18
27
  end
19
28
  end
@@ -7,6 +7,8 @@ module TestOutputParser
7
7
  summary[:failed] += arr[1].to_i
8
8
  summary[:pending] += arr[3].to_i
9
9
  end
10
+ failures = test_output.scan(/Failures:\n+(.*)Finished in/m)
11
+ summary[:failures] = failures.flatten.first.strip unless failures.empty?
10
12
 
11
13
  summary
12
14
  end
@@ -10,6 +10,8 @@ module TestOutputParser
10
10
  summary[:pending] += arr[7].to_i
11
11
  end
12
12
 
13
+ failures = test_output.scan(/(^\s+\d\)\sFailure:\n+.*)+\d+\stests/m)
14
+ summary[:failures] = failures.flatten.first.strip unless failures.empty?
13
15
  summary
14
16
  end
15
17
  end
@@ -1,3 +1,3 @@
1
1
  module TestOutputParser
2
- VERSION = "0.2.1"
2
+ VERSION = "0.3.0"
3
3
  end
@@ -0,0 +1,105 @@
1
+
2
+
3
+ $ git fetch --prune --all
4
+ Fetching origin
5
+ From git://localhost/akshaykarle/dropwizard-snapci-sample
6
+ 3b3521d..1597fd3 master -> origin/master
7
+ Command git fetch --prune --all exited successfully with status 0.
8
+
9
+ $ git reset --hard FETCH_HEAD
10
+ HEAD is now at 1597fd3 Fail one more
11
+ Command git reset --hard FETCH_HEAD exited successfully with status 0.
12
+
13
+ $ git clean -fdx
14
+ Removing target/
15
+ Command git clean -fdx exited successfully with status 0.
16
+
17
+ $ git checkout master
18
+ Already on 'master'
19
+ Command git checkout master exited successfully with status 0.
20
+
21
+ $ git reset --hard 1597fd3f06dc8e8950e407142782d20a1025e080
22
+ HEAD is now at 1597fd3 Fail one more
23
+ Command git reset --hard 1597fd3f06dc8e8950e407142782d20a1025e080 exited successfully with status 0.
24
+
25
+ $ git submodule update --init
26
+ Command git submodule update --init exited successfully with status 0.
27
+
28
+ $ git remote set-url --push origin 'git@github.com:akshaykarle/dropwizard-snapci-sample'
29
+ Command git remote set-url --push origin 'git@github.com:akshaykarle/dropwizard-snapci-sample' exited successfully with status 0.
30
+
31
+ $ export SNAP_CI=true
32
+ $ export CI=true
33
+ $ export LANG=en_US.UTF-8
34
+ $ export LC_ALL=en_US.UTF-8
35
+ $ export SNAP_PIPELINE_COUNTER=9
36
+ $ export SNAP_STAGE_NAME=Test
37
+ $ export SNAP_BRANCH=master
38
+ $ export SNAP_COMMIT=1597fd3f06dc8e8950e407142782d20a1025e080
39
+ $ export SNAP_COMMIT_SHORT=1597fd3
40
+
41
+ $ mvn package
42
+ [INFO] Scanning for projects...
43
+ [INFO]
44
+ [INFO] ------------------------------------------------------------------------
45
+ [INFO] Building microblog 0.0.1-SNAPSHOT
46
+ [INFO] ------------------------------------------------------------------------
47
+ [INFO]
48
+ [INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ microblog ---
49
+ [debug] execute contextualize
50
+ [INFO] Using 'UTF-8' encoding to copy filtered resources.
51
+ [INFO] Copying 1 resource
52
+ [INFO]
53
+ [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ microblog ---
54
+ [INFO] Changes detected - recompiling the module!
55
+ [INFO] Compiling 13 source files to /var/go/repo/target/classes
56
+ [INFO]
57
+ [INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) @ microblog ---
58
+ [debug] execute contextualize
59
+ [INFO] Using 'UTF-8' encoding to copy filtered resources.
60
+ [INFO] skip non existing resourceDirectory /var/go/repo/src/test/resources
61
+ [INFO]
62
+ [INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ microblog ---
63
+ [INFO] Changes detected - recompiling the module!
64
+ [INFO] Compiling 4 source files to /var/go/repo/target/test-classes
65
+ [INFO]
66
+ [INFO] --- maven-surefire-plugin:2.10:test (default-test) @ microblog ---
67
+ [INFO] Surefire report directory: /var/go/repo/target/surefire-reports
68
+
69
+ -------------------------------------------------------
70
+ T E S T S
71
+ -------------------------------------------------------
72
+ Running com.snapci.microblog.core.ErrorResponseTest
73
+ Tests run: 3, Failures: 2, Errors: 0, Skipped: 0, Time elapsed: 0.134 sec <<< FAILURE!
74
+ Running com.snapci.microblog.resources.MicroBlogResourceTest
75
+ Tests run: 7, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.253 sec
76
+ Running com.snapci.microblog.resources.UserResourceTest
77
+ Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.061 sec
78
+
79
+ Results :
80
+
81
+ Failed tests: testFromExceptionWithUniqueConstraintViolation(com.snapci.microblog.core.ErrorResponseTest)
82
+ testFromException(com.snapci.microblog.core.ErrorResponseTest)
83
+
84
+ Tests run: 13, Failures: 2, Errors: 0, Skipped: 0
85
+
86
+ [INFO] ------------------------------------------------------------------------
87
+ [INFO] BUILD FAILURE
88
+ [INFO] ------------------------------------------------------------------------
89
+ [INFO] Total time: 3.903s
90
+ [INFO] Finished at: Thu Feb 13 13:42:59 UTC 2014
91
+ [INFO] Final Memory: 20M/232M
92
+ [INFO] ------------------------------------------------------------------------
93
+ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.10:test (default-test) on project microblog: There are test failures.
94
+ [ERROR]
95
+ [ERROR] Please refer to /var/go/repo/target/surefire-reports for the individual test results.
96
+ [ERROR] -> [Help 1]
97
+ [ERROR]
98
+ [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
99
+ [ERROR] Re-run Maven using the -X switch to enable full debug logging.
100
+ [ERROR]
101
+ [ERROR] For more information about the errors and possible solutions, please read the following articles:
102
+ [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
103
+ Command mvn package failed with status 1. Took 5.45 seconds.
104
+ Saving console log for later
105
+ Saving artifact in target
@@ -1,2 +1,19 @@
1
- Finished in 4 minutes 43.2 seconds
2
- 1460 examples, 1 failure, 3 pending
1
+ $ bundle exec rake spec:controllers
2
+ /opt/local/ruby/1.9.3-p484/bin/ruby -S rspec ./spec/controllers/posts_controller_spec.rb
3
+ .......F........
4
+
5
+ Failures:
6
+
7
+ 1) PostsController GET index assigns all posts as @posts
8
+ Failure/Error: assert false
9
+ MiniTest::Assertion:
10
+ Failed assertion, no message given.
11
+ # (eval):2:in `assert'
12
+ # ./spec/controllers/posts_controller_spec.rb:39:in `block (3 levels) in <top (required)>'
13
+
14
+ Finished in 0.13092 seconds
15
+ 16 examples, 1 failure
16
+
17
+ Failed examples:
18
+
19
+ rspec ./spec/controllers/posts_controller_spec.rb:38 # PostsController GET index assigns all posts as @posts
@@ -1,7 +1,20 @@
1
+ $ bundle exec rake test
2
+ /opt/local/ruby/1.9.3-p484/bin/ruby -I"lib:test" -I"/opt/local/ruby/1.9.3-p484/lib/ruby/1.9.1" "/opt/local/ruby/1.9.3-p484/lib/ruby/1.9.1/rake/rake_test_loader.rb" "test/foo_test.rb"
3
+ Run options:
4
+
1
5
  # Running tests:
2
6
 
3
- .
7
+ .FF
8
+
9
+ Finished tests in 0.000557s, 1793.7831 tests/s, 1793.7831 assertions/s.
10
+
11
+ 1) Failure:
12
+ test_passes(FooTest) [/var/go/repo/test/foo_test.rb:5]:
13
+ Failed assertion, no message given.
4
14
 
5
- Finished tests in 0.003116s, 320.9217 tests/s, 320.9217 assertions/s.
15
+ 2) Failure:
16
+ test_passes(FooTest) [/var/go/repo/test/foo_test.rb:10]:
17
+ Failed assertion, no message given.
6
18
 
7
- 1 tests, 1 assertions, 1 failures, 0 errors, 0 skips
19
+ 3 tests, 3 assertions, 2 failures, 0 errors, 0 skips
20
+ rake aborted!
@@ -28,4 +28,27 @@ describe TestOutputParser::Framework::JUnit do
28
28
  it 'should ignore lines not related to JUnit test summary' do
29
29
  TestOutputParser::Framework::JUnit.count(File.read("spec/fixtures/sample-junit-output.txt")).should == {:total => 13, :failed => 0, :errors => 0, :pending => 0}
30
30
  end
31
+
32
+ it 'should include the failures in the test summary for JUnit output' do
33
+ TestOutputParser::Framework::JUnit.count(File.read("spec/fixtures/sample-failed-junit-output.txt")).should ==
34
+ {
35
+ :total => 13,
36
+ :failed => 2,
37
+ :errors=>0,
38
+ :pending=>0,
39
+ :failures => "Failed tests: testFromExceptionWithUniqueConstraintViolation(com.snapci.microblog.core.ErrorResponseTest)\n"\
40
+ " testFromException(com.snapci.microblog.core.ErrorResponseTest)"
41
+ }
42
+ end
43
+
44
+ it 'should include the failures in the test summary for gradle output' do
45
+ TestOutputParser::Framework::JUnit.count(File.read("spec/fixtures/sample-gradle-output.txt")).should ==
46
+ {
47
+ :total => 47,
48
+ :failed => 1,
49
+ :failures => "Running test: test shouldAddBookToDBIfNotInSystem(com.thoughtworks.twu.controller.AddBookControllerTest)\n\n"\
50
+ "com.thoughtworks.twu.controller.AddBookControllerTest > shouldAddBookToDBIfNotInSystem FAILED\n"\
51
+ " java.lang.AssertionError at AddBookControllerTest.java:28"
52
+ }
53
+ end
31
54
  end
@@ -21,11 +21,20 @@ describe TestOutputParser::Framework::RSpec do
21
21
  TestOutputParser::Framework::RSpec.count(File.read("spec/fixtures/sample-rspec-output.txt")).should == {:total => 67, :failed => 0, :pending => 0}
22
22
  end
23
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}
24
+ it 'should count the number of pending specs' do
25
+ TestOutputParser::Framework::RSpec.count("16 examples, 0 failures, 1 pending").should == {:total => 16, :failed => 0, :pending => 1}
26
26
  end
27
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}
28
+ it 'should count the name of the specs that failed' do
29
+ TestOutputParser::Framework::RSpec.count(File.read("spec/fixtures/sample-failed-rspec-output.txt")).should ==
30
+ {:total => 16, :failed => 1, :pending => 0,
31
+ :failures => "1) PostsController GET index assigns all posts as @posts\n" \
32
+ " Failure/Error: assert false\n" \
33
+ " MiniTest::Assertion:\n" \
34
+ " Failed assertion, no message given.\n" \
35
+ " # (eval):2:in `assert'\n" \
36
+ " # ./spec/controllers/posts_controller_spec.rb:39:in `block (3 levels) in <top (required)>'"
37
+
38
+ }
30
39
  end
31
40
  end
@@ -23,10 +23,6 @@ describe TestOutputParser::Framework::TestUnit do
23
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
- it 'should count failures correctly' do
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
- end
29
-
30
26
  it 'should count the number of specs errors' do
31
27
  TestOutputParser::Framework::TestUnit.count(File.read("spec/fixtures/sample-error-test-unit-output.txt")).should == {:total => 1, :failed => 0, :errors => 1, :pending => 0}
32
28
  end
@@ -34,4 +30,20 @@ describe TestOutputParser::Framework::TestUnit do
34
30
  it 'should count the number of specs pending' do
35
31
  TestOutputParser::Framework::TestUnit.count(File.read("spec/fixtures/sample-pending-test-unit-output.txt")).should == {:total => 1, :failed => 0, :errors => 0, :pending => 1}
36
32
  end
33
+
34
+ it 'should add the failures to the summary' do
35
+ TestOutputParser::Framework::TestUnit.count(File.read("spec/fixtures/sample-failed-test-unit-output.txt")).should ==
36
+ {
37
+ :total => 3,
38
+ :failed => 2,
39
+ :errors => 0,
40
+ :pending => 0,
41
+ :failures => "1) Failure:\n" \
42
+ "test_passes(FooTest) [/var/go/repo/test/foo_test.rb:5]:\n" \
43
+ "Failed assertion, no message given.\n"\
44
+ "\n 2) Failure:\n"\
45
+ "test_passes(FooTest) [/var/go/repo/test/foo_test.rb:10]:\n"\
46
+ "Failed assertion, no message given."
47
+ }
48
+ end
37
49
  end
@@ -2,18 +2,56 @@ 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")).should == {:total => 1460, :failed => 1, :pending => 3}
5
+ TestOutputParser.count(File.read("spec/fixtures/sample-failed-rspec-output.txt")).should ==
6
+ {
7
+ :total=>16,
8
+ :failed=>1,
9
+ :pending=>0,
10
+ :failures=>"1) PostsController GET index assigns all posts as @posts\n"\
11
+ " Failure/Error: assert false\n"\
12
+ " MiniTest::Assertion:\n"\
13
+ " Failed assertion, no message given.\n"\
14
+ " # (eval):2:in `assert'\n"\
15
+ " # ./spec/controllers/posts_controller_spec.rb:39:in `block (3 levels) in <top (required)>'"
16
+ }
6
17
  end
7
18
 
8
19
  it 'should give the summary of specs for test unit' do
9
- TestOutputParser.count(File.read("spec/fixtures/sample-failed-test-unit-output.txt")).should == {:total => 1, :failed => 1, :errors => 0, :pending => 0}
20
+ TestOutputParser.count(File.read("spec/fixtures/sample-failed-test-unit-output.txt")).should ==
21
+ {
22
+ :total=>3,
23
+ :failed=>2,
24
+ :errors=>0,
25
+ :pending=>0,
26
+ :failures=>"1) Failure:\ntest_passes(FooTest) [/var/go/repo/test/foo_test.rb:5]:\n"\
27
+ "Failed assertion, no message given.\n\n"\
28
+ " 2) Failure:\ntest_passes(FooTest) [/var/go/repo/test/foo_test.rb:10]:\nFailed assertion, no message given."
29
+ }
10
30
  end
11
31
 
12
32
  it 'should give the summary of specs for junit' do
13
- TestOutputParser.count(File.read("spec/fixtures/sample-gradle-output.txt")).should == {:total => 47, :failed => 1}
33
+ TestOutputParser.count(File.read("spec/fixtures/sample-gradle-output.txt")).should ==
34
+ {
35
+ :total=>47,
36
+ :failed=>1,
37
+ :failures=>"Running test: test shouldAddBookToDBIfNotInSystem(com.thoughtworks.twu.controller.AddBookControllerTest)\n\n"\
38
+ "com.thoughtworks.twu.controller.AddBookControllerTest > shouldAddBookToDBIfNotInSystem FAILED\n"\
39
+ " java.lang.AssertionError at AddBookControllerTest.java:28"
40
+ }
14
41
  end
15
42
 
16
43
  it 'should add up the summaries when there are specs for multiple frameworks' do
17
- 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}
44
+ TestOutputParser.count(File.read("spec/fixtures/sample-failed-test-unit-output.txt") + File.read("spec/fixtures/sample-failed-rspec-output.txt")).should ==
45
+ {
46
+ :total=>19,
47
+ :failed=>3,
48
+ :pending=>0,
49
+ :failures=>"1) Failure:\n"\
50
+ "test_passes(FooTest) [/var/go/repo/test/foo_test.rb:5]:\n"\
51
+ "Failed assertion, no message given.\n\n"\
52
+ " 2) Failure:\ntest_passes(FooTest) [/var/go/repo/test/foo_test.rb:10]:\n"\
53
+ "Failed assertion, no message given.",
54
+ :errors=>0
55
+ }
18
56
  end
19
57
  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.2.1
4
+ version: 0.3.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-05 00:00:00.000000000 Z
11
+ date: 2014-02-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -74,6 +74,7 @@ files:
74
74
  - lib/test_output_parser/framework/test_unit.rb
75
75
  - lib/test_output_parser/version.rb
76
76
  - spec/fixtures/sample-error-test-unit-output.txt
77
+ - spec/fixtures/sample-failed-junit-output.txt
77
78
  - spec/fixtures/sample-failed-rspec-output.txt
78
79
  - spec/fixtures/sample-failed-test-unit-output.txt
79
80
  - spec/fixtures/sample-gradle-output.txt
@@ -113,6 +114,7 @@ specification_version: 4
113
114
  summary: A gem to get the summary of test outputs for further processing
114
115
  test_files:
115
116
  - spec/fixtures/sample-error-test-unit-output.txt
117
+ - spec/fixtures/sample-failed-junit-output.txt
116
118
  - spec/fixtures/sample-failed-rspec-output.txt
117
119
  - spec/fixtures/sample-failed-test-unit-output.txt
118
120
  - spec/fixtures/sample-gradle-output.txt