test-output-parser 0.2.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/test_output_parser/framework.rb +0 -3
- data/lib/test_output_parser/framework/junit.rb +9 -0
- data/lib/test_output_parser/framework/rspec.rb +2 -0
- data/lib/test_output_parser/framework/test_unit.rb +2 -0
- data/lib/test_output_parser/version.rb +1 -1
- data/spec/fixtures/sample-failed-junit-output.txt +105 -0
- data/spec/fixtures/sample-failed-rspec-output.txt +19 -2
- data/spec/fixtures/sample-failed-test-unit-output.txt +16 -3
- data/spec/framework/junit_spec.rb +23 -0
- data/spec/framework/rspec_spec.rb +13 -4
- data/spec/framework/test_unit_spec.rb +16 -4
- data/spec/test_output_parser_spec.rb +42 -4
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 62e8801a738f5c54e2a87b487b5ed1de94801b75
|
4
|
+
data.tar.gz: e130c6f72a8fcafb778c911ca68a8b3e3a9e7e2a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 37e20fec72155d567da774fed81bae22c5779d14f0b47d0980ee6ee7ee7769baebcd99f4d98260edb6c0ad524a2dfe508680205fc2cb1efac22fa93ac8f71ae5
|
7
|
+
data.tar.gz: 51f36e46f9688610415b9f186f2affb269c54ecd44d75edc31e1a2101cab6eee83f8e2c35f09fde23d1563d72441e631317a5acf1a493ee9d9a5e6055f8b4741
|
@@ -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
|
@@ -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
|
-
|
2
|
-
|
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
|
-
|
15
|
+
2) Failure:
|
16
|
+
test_passes(FooTest) [/var/go/repo/test/foo_test.rb:10]:
|
17
|
+
Failed assertion, no message given.
|
6
18
|
|
7
|
-
|
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
|
25
|
-
TestOutputParser::Framework::RSpec.count(
|
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
|
29
|
-
TestOutputParser::Framework::RSpec.count(File.read("spec/fixtures/sample-failed-rspec-output.txt")).should ==
|
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 ==
|
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 ==
|
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 ==
|
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 ==
|
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.
|
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-
|
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
|