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

Passing tests reported as failures when using godog junit format #218

Closed
Samfucious opened this issue Oct 11, 2021 · 4 comments
Closed

Passing tests reported as failures when using godog junit format #218

Samfucious opened this issue Oct 11, 2021 · 4 comments

Comments

@Samfucious
Copy link

Samfucious commented Oct 11, 2021

The junit xml appears to be malformed.

✓ . (196ms)

=== Failed
=== FAIL: . TestMain (unknown)

--- PASS: TestMain (0.00s)

DONE 4 tests, 1 failure in 0.633s
testlib_test.go.txt

testlib.go.txt

@dnephin
Copy link
Member

dnephin commented Oct 12, 2021

Thank you for the bug report! I suspect this is actually a bug in test2json failing to parse the test output. This has happened a few times. See #141, #105, and golang/go#38063

When there is a missing pass or fail line gotestsum has to assume that the test failed so it can print the output, as assuming the test passed would be worse. The exit status of the process is always correct, so it should be used to determine real pass or fail.

I took a quick look at the attached files. Maybe that godog library is using parallelism, or printing extra stdout which is breaking the test2json parser? If you are using an older version of Go it may not have the fix yet.

If you can reproduce the issue with a more minimal example we can open an issue on the Go issue tracker.

@Samfucious
Copy link
Author

Thanks for the quick response. Here's a more minimal example.
My go version is 1.17, and godog version 0.12.0.
testlib_test.go.txt

@Samfucious
Copy link
Author

It's only when using the "junit" formatting from godog that this is an issue.

Further experimentation has shown that either using "pretty" godog formatting, or not using godog at all, while running "gotestsum --junitfile " produces expected behavior.

@dnephin dnephin changed the title Passing tests reported as failures with using junit xml Passing tests reported as failures when using godog junit format Oct 17, 2021
@dnephin
Copy link
Member

dnephin commented Aug 6, 2022

It sounds like this is expected (because the output from godog is not json), or a bug in godog not producing the correct json. I'm going to close this issue since it seems there is nothing to fix in gotestsum. Please comment if I've misunderstood and there is a problem to fix here.

@dnephin dnephin closed this as not planned Won't fix, can't repro, duplicate, stale Aug 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants