Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add code for parsing format that ginkgo tests emit #528

Merged
merged 3 commits into from
Oct 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions web/server/parser/packageParser.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,15 @@ func (self *outputParser) separateTestFunctionsAndMetadata() {
if self.processNonTestOutput() {
break
}
// Hack for results from ginkgo tests
lines := strings.Split(self.line, " --- ")
if len(lines) == 2 && len(strings.TrimSpace(lines[0])) > 0 && strings.HasPrefix(lines[1], "PASS") {
self.line = lines[0]
self.processTestOutput()
self.line = "--- " + lines[1]
self.processTestOutput()
continue
}
self.processTestOutput()
}
}
Expand Down
42 changes: 42 additions & 0 deletions web/server/parser/package_parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1068,3 +1068,45 @@ var expectedGolang17Subtests = contract.PackageResult{
},
},
}

const inputGinkgo_Passes = `
SUCCESS! -- 12 Passed | 0 Failed | 0 Pending | 0 Skipped --- PASS: TestModels (0.01s)
PASS
ok github.com/smartystreets/goconvey/webserver/examples 3.433s
`

var expectedGinkgo_Passes = contract.PackageResult{
PackageName: "github.com/smartystreets/goconvey/webserver/examples",
Elapsed: 3.433,
Outcome: contract.Passed,
}

func TestParsePackage_GinkgoWithSuccessOutput(t *testing.T) {
actual := &contract.PackageResult{PackageName: expectedGinkgo_Passes.PackageName}
ParsePackageResults(actual, inputGinkgo_Passes)
assertEqual(t, expectedGinkgo_Passes, *actual)
}

const inputGinkgo_Fails = `
Summarizing 1 Failure:

[Fail] main.go GetHostname [It] returns an error if systemInfo.hostname == nil
/Users/joeuser/go/src/github.com/smartystreets/goconvey/webserver/examples/main.go:141

Ran 33 of 33 Specs in 0.005 seconds
FAIL! -- 32 Passed | 1 Failed | 0 Pending | 0 Skipped --- FAIL: TestRoutes (0.01s)
FAIL
FAIL github.com/smartystreets/goconvey/webserver/examples 0.810s
`

var expectedGinkgo_Fails = contract.PackageResult{
PackageName: "github.com/smartystreets/goconvey/webserver/examples",
Elapsed: 0.810,
Outcome: contract.Failed,
}

func TestParsePackage_GinkgoWithFailureOutput(t *testing.T) {
actual := &contract.PackageResult{PackageName: expectedGinkgo_Fails.PackageName}
ParsePackageResults(actual, inputGinkgo_Fails)
assertEqual(t, expectedGinkgo_Fails, *actual)
}