test-output-parser 0.2.0 → 0.2.1
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.rb +1 -0
- data/lib/test_output_parser/framework.rb +1 -0
- data/lib/test_output_parser/framework/junit.rb +21 -0
- data/lib/test_output_parser/version.rb +1 -1
- data/spec/fixtures/sample-gradle-output.txt +79 -0
- data/spec/framework/junit_spec.rb +31 -0
- data/spec/test_output_parser_spec.rb +4 -0
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ff35a4c7d8d503b03bce1c540bfbca8f4f7a3982
|
4
|
+
data.tar.gz: 0dc6a7af57db982c6040d6331328c3c62d29d7bc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e242af1c68e565df57c5f296713f55b6f7b310ca3bce37799e2eda08397d6185aaef24b236f81c61d2dc3be36eb29e3d914bf19712f3c580da37fc75b43ce901
|
7
|
+
data.tar.gz: 8cefeda5bc9df0e9c4be85e2085369e4e43cdb20242b9cc7dd43f7c213778eef21bef6cb1e7d9186752f3b817afab94874adb6cb12687b32c2001bf2aefa149a
|
data/lib/test_output_parser.rb
CHANGED
@@ -0,0 +1,21 @@
|
|
1
|
+
module TestOutputParser
|
2
|
+
module Framework
|
3
|
+
class JUnit
|
4
|
+
def self.count(test_output, summary=Hash.new(0))
|
5
|
+
test_output.scan(/Running\s+.*$\nTest[s]?\s+run:\s+(\d+),\s+Failure[s]?:\s+(\d+),\s+Error[s]?:\s+(\d+),\s+Skipped:\s+(\d+)/).each do |arr|
|
6
|
+
summary[:total] += arr[0].to_i
|
7
|
+
summary[:failed] += arr[1].to_i
|
8
|
+
summary[:errors] += arr[2].to_i
|
9
|
+
summary[:pending] += arr[3].to_i
|
10
|
+
end
|
11
|
+
|
12
|
+
test_output.scan(/(\d+)\s+test[s]?\s+completed,\s+(\d+)\s+failed/).each do |arr|
|
13
|
+
summary[:total] += arr[0].to_i
|
14
|
+
summary[:failed] += arr[1].to_i
|
15
|
+
end
|
16
|
+
|
17
|
+
summary
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,79 @@
|
|
1
|
+
$ gradle test
|
2
|
+
The ConfigurationContainer.add() method has been deprecated and is scheduled to be removed in Gradle 2.0. Please use the create() method instead.
|
3
|
+
The TaskContainer.add() method has been deprecated and is scheduled to be removed in Gradle 2.0. Please use the create() method instead.
|
4
|
+
:compileJava
|
5
|
+
:processResources
|
6
|
+
:classes
|
7
|
+
:compileTestJavaNote: Some input files use unchecked or unsafe operations.
|
8
|
+
Note: Recompile with -Xlint:unchecked for details.
|
9
|
+
|
10
|
+
:processTestResources UP-TO-DATE
|
11
|
+
:testClasses
|
12
|
+
:test
|
13
|
+
Running test: test shouldPassNotFoundMessageWhenIDIsInvalid(com.thoughtworks.twu.controller.BookViewControllerTest)
|
14
|
+
Running test: test shouldPassBookToBookViewPageWhenIDIsValid(com.thoughtworks.twu.controller.BookViewControllerTest)
|
15
|
+
Running test: test shouldVerifyThatBookServiceReturnsBook(com.thoughtworks.twu.controller.BookViewControllerTest)
|
16
|
+
Running test: test shouldVerifyThatBookServiceUpdatesCount(com.thoughtworks.twu.controller.BookViewControllerTest)
|
17
|
+
Running test: test shouldPassNotFoundMessageWhenIDIsEmpty(com.thoughtworks.twu.controller.BookViewControllerTest)
|
18
|
+
Running test: test shouldHaveEmptyNotificationWhenUserViewsBookForFirstTime(com.thoughtworks.twu.controller.BookViewControllerTest)
|
19
|
+
Running test: test shouldPassANotificationToTheViewThatBookWasRecommended(com.thoughtworks.twu.controller.BookViewControllerTest)
|
20
|
+
Running test: test shouldRetrieveResultFromBookSearch(com.thoughtworks.twu.controller.SearchControllerTest)
|
21
|
+
Running test: test shouldNotRetrieveResultFromBookSearchWhenTitleIsEmpty(com.thoughtworks.twu.controller.SearchControllerTest)
|
22
|
+
Running test: test shouldSendErrorMessageWhenNoBooksWhereFound(com.thoughtworks.twu.controller.SearchControllerTest)
|
23
|
+
Running test: test shouldReturnSearchTypeToTheView(com.thoughtworks.twu.controller.SearchControllerTest)
|
24
|
+
Running test: test shouldRenderSearchPage(com.thoughtworks.twu.controller.SearchControllerTest)
|
25
|
+
Running test: test shouldAddListOfWantToReadBooksToModelForTheLoggedInUser(com.thoughtworks.twu.controller.BookshelfControllerTest)
|
26
|
+
Running test: test shouldSendBookNotFoundMessageIfNoBooksInWantToReadList(com.thoughtworks.twu.controller.BookshelfControllerTest)
|
27
|
+
Running test: test shouldNotAddBookToDBIfItIsInSystem(com.thoughtworks.twu.controller.AddBookControllerTest)
|
28
|
+
Running test: test shouldRedirectToViewBook(com.thoughtworks.twu.controller.AddBookControllerTest)
|
29
|
+
Running test: test shouldAddBookToDBIfNotInSystem(com.thoughtworks.twu.controller.AddBookControllerTest)
|
30
|
+
|
31
|
+
com.thoughtworks.twu.controller.AddBookControllerTest > shouldAddBookToDBIfNotInSystem FAILED
|
32
|
+
java.lang.AssertionError at AddBookControllerTest.java:28
|
33
|
+
Running test: test shouldRedirectToCreateUserPageIfUserIsUnRegistered(com.thoughtworks.twu.controller.LoginControllerTest)
|
34
|
+
Running test: test shouldSaveUnregisteredUser(com.thoughtworks.twu.controller.LoginControllerTest)
|
35
|
+
Running test: test shouldRedirectToWelcomePageIfUserIsRegistered(com.thoughtworks.twu.controller.LoginControllerTest)
|
36
|
+
Running test: test shouldStayOnSamePageIfUsernameIsBlank(com.thoughtworks.twu.controller.LoginControllerTest)
|
37
|
+
Running test: test shouldRedirectToRightBookWithCorrectNotificationWhenBookIsPutInList(com.thoughtworks.twu.controller.WantToReadBookControllerTest)
|
38
|
+
Running test: test shouldRedirectToRightBookWithCorrectNotificationWhenBookIsNotPutInList(com.thoughtworks.twu.controller.WantToReadBookControllerTest)
|
39
|
+
Running test: test shouldReturnValidResponseWhenBookAlreadySaved(com.thoughtworks.twu.controller.WantToReadBookControllerTest)
|
40
|
+
Running test: test shouldNotAddBookToWantTOReadListWhenTheBookIsAlreadyAdded(com.thoughtworks.twu.controller.WantToReadBookControllerTest)
|
41
|
+
Running test: test shouldSuccessfullyAddBookToWantToReadList(com.thoughtworks.twu.controller.WantToReadBookControllerTest)
|
42
|
+
Running test: test shouldReturnValidResponseWhenBookNotAlreadySaved(com.thoughtworks.twu.controller.WantToReadBookControllerTest)
|
43
|
+
Running test: test shouldNotAssignDefaultImageWhenBookImageIsAvailable(com.thoughtworks.twu.domain.BookTest)
|
44
|
+
Running test: test shouldAssignDefaultDescriptionWhenBookHasNoDescription(com.thoughtworks.twu.domain.BookTest)
|
45
|
+
Running test: test shouldUnderstandBook(com.thoughtworks.twu.domain.BookTest)
|
46
|
+
Running test: test shouldAssignDefaultImageWhenBookHasNoImage(com.thoughtworks.twu.domain.BookTest)
|
47
|
+
Running test: test shouldNotAssignDefaultDescriptionWhenBookDescriptionIsAvailable(com.thoughtworks.twu.domain.BookTest)
|
48
|
+
Running test: test shouldFindBooksByTitle(com.thoughtworks.twu.service.SearchServiceTest)
|
49
|
+
Running test: test shouldAddBookToWantToReadList(com.thoughtworks.twu.service.UserServiceTest)
|
50
|
+
Running test: test shouldCheckExistingUser(com.thoughtworks.twu.service.UserServiceTest)
|
51
|
+
Running test: test shouldGetUserByName(com.thoughtworks.twu.service.UserServiceTest)
|
52
|
+
Running test: test shouldCreateUser(com.thoughtworks.twu.service.UserServiceTest)
|
53
|
+
Running test: test shouldReturnFalseWhenBookIsNotMarkedAsWantToReadInDB(com.thoughtworks.twu.service.UserServiceTest)
|
54
|
+
Running test: test shouldReturnTrueWhenBookIsMarkedAsWantToReadInDB(com.thoughtworks.twu.service.UserServiceTest)
|
55
|
+
Running test: test shouldReturnAListOfWantToReadBooks(com.thoughtworks.twu.service.UserServiceTest)
|
56
|
+
Running test: test shouldGetBookInfoFromDB(com.thoughtworks.twu.service.BookServiceTest)
|
57
|
+
Running test: test shouldInsertBookToDB(com.thoughtworks.twu.service.BookServiceTest)
|
58
|
+
Running test: test shouldReturnTrueIfBookExistedInDB(com.thoughtworks.twu.service.BookServiceTest)
|
59
|
+
Running test: test shouldReturnFalseIfBookIsNotExistedInDB(com.thoughtworks.twu.service.BookServiceTest)
|
60
|
+
Running test: test shouldGetBookById(com.thoughtworks.twu.service.BookServiceTest)
|
61
|
+
Running test: test shouldUpdateRecommendCountByOne(com.thoughtworks.twu.service.BookServiceTest)
|
62
|
+
Running test: test shouldReturnBookWithIDWhenTheBookIsInDB(com.thoughtworks.twu.service.BookServiceTest)
|
63
|
+
|
64
|
+
47 tests completed, 1 failed
|
65
|
+
:test FAILED
|
66
|
+
|
67
|
+
FAILURE: Build failed with an exception.
|
68
|
+
|
69
|
+
* What went wrong:
|
70
|
+
Execution failed for task ':test'.
|
71
|
+
> There were failing tests. See the report at: file:///var/go/repo/build/reports/tests/index.html
|
72
|
+
|
73
|
+
* Try:
|
74
|
+
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
|
75
|
+
|
76
|
+
BUILD FAILED
|
77
|
+
|
78
|
+
Total time: 10.732 secs
|
79
|
+
Command gradle test failed with status 1. Took 10.99 seconds.
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe TestOutputParser::Framework::JUnit do
|
4
|
+
it 'should do nothing when there is no spec summary in the output' do
|
5
|
+
TestOutputParser::Framework::JUnit.count("Tests not run").should == {}
|
6
|
+
end
|
7
|
+
|
8
|
+
it 'should count the number of specs ran for one example' do
|
9
|
+
TestOutputParser::Framework::JUnit.count("Running com.foo.microblog.core.ErrorResponseTest\nTests run: 1, Failures: 0, Errors: 0, Skipped: 0").should ==
|
10
|
+
{:total => 1, :failed => 0, :errors => 0, :pending => 0}
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'should count the number of specs ran for one JUnit run' do
|
14
|
+
TestOutputParser::Framework::JUnit.count("Running com.foo.microblog.core.ErrorResponseTest\nTests run: 10, Failures: 1, Errors: 5, Skipped: 3").should ==
|
15
|
+
{:total => 10, :failed => 1, :errors => 5, :pending => 3}
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'should count the number of specs ran for multiple JUnit runs' do
|
19
|
+
TestOutputParser::Framework::JUnit.count("Running com.foo.microblog.core.ErrorResponseTest\nTests run: 10, Failures: 1, Errors: 5, Skipped: 3\n\n\n" \
|
20
|
+
"Running com.foo.microblog.core.UserResourceTest\nTests run: 1, Failures: 0, Errors: 0, Skipped: 0").should ==
|
21
|
+
{:total => 11, :failed => 1, :errors => 5, :pending => 3}
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'should handle gradle output' do
|
25
|
+
TestOutputParser::Framework::JUnit.count("47 tests completed, 1 failed").should == {:total => 47, :failed => 1}
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'should ignore lines not related to JUnit test summary' do
|
29
|
+
TestOutputParser::Framework::JUnit.count(File.read("spec/fixtures/sample-junit-output.txt")).should == {:total => 13, :failed => 0, :errors => 0, :pending => 0}
|
30
|
+
end
|
31
|
+
end
|
@@ -9,6 +9,10 @@ describe TestOutputParser do
|
|
9
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 give the summary of specs for junit' do
|
13
|
+
TestOutputParser.count(File.read("spec/fixtures/sample-gradle-output.txt")).should == {:total => 47, :failed => 1}
|
14
|
+
end
|
15
|
+
|
12
16
|
it 'should add up the summaries when there are specs for multiple frameworks' do
|
13
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}
|
14
18
|
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.
|
4
|
+
version: 0.2.1
|
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-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -69,16 +69,19 @@ files:
|
|
69
69
|
- Rakefile
|
70
70
|
- lib/test_output_parser.rb
|
71
71
|
- lib/test_output_parser/framework.rb
|
72
|
+
- lib/test_output_parser/framework/junit.rb
|
72
73
|
- lib/test_output_parser/framework/rspec.rb
|
73
74
|
- lib/test_output_parser/framework/test_unit.rb
|
74
75
|
- lib/test_output_parser/version.rb
|
75
76
|
- spec/fixtures/sample-error-test-unit-output.txt
|
76
77
|
- spec/fixtures/sample-failed-rspec-output.txt
|
77
78
|
- spec/fixtures/sample-failed-test-unit-output.txt
|
79
|
+
- spec/fixtures/sample-gradle-output.txt
|
78
80
|
- spec/fixtures/sample-junit-output.txt
|
79
81
|
- spec/fixtures/sample-pending-test-unit-output.txt
|
80
82
|
- spec/fixtures/sample-rspec-output.txt
|
81
83
|
- spec/fixtures/sample-test-unit-output.txt
|
84
|
+
- spec/framework/junit_spec.rb
|
82
85
|
- spec/framework/rspec_spec.rb
|
83
86
|
- spec/framework/test_unit_spec.rb
|
84
87
|
- spec/spec_helper.rb
|
@@ -112,10 +115,12 @@ test_files:
|
|
112
115
|
- spec/fixtures/sample-error-test-unit-output.txt
|
113
116
|
- spec/fixtures/sample-failed-rspec-output.txt
|
114
117
|
- spec/fixtures/sample-failed-test-unit-output.txt
|
118
|
+
- spec/fixtures/sample-gradle-output.txt
|
115
119
|
- spec/fixtures/sample-junit-output.txt
|
116
120
|
- spec/fixtures/sample-pending-test-unit-output.txt
|
117
121
|
- spec/fixtures/sample-rspec-output.txt
|
118
122
|
- spec/fixtures/sample-test-unit-output.txt
|
123
|
+
- spec/framework/junit_spec.rb
|
119
124
|
- spec/framework/rspec_spec.rb
|
120
125
|
- spec/framework/test_unit_spec.rb
|
121
126
|
- spec/spec_helper.rb
|