Skip to content

fix(junit): Correctly identify panicking test in JUnit report#492

Open
vtsachev wants to merge 1 commit into
gotestyourself:mainfrom
vtsachev:main
Open

fix(junit): Correctly identify panicking test in JUnit report#492
vtsachev wants to merge 1 commit into
gotestyourself:mainfrom
vtsachev:main

Conversation

@vtsachev
Copy link
Copy Markdown

@vtsachev vtsachev commented Apr 16, 2025

When a test panics, the JUnit XML report previously marked all tests in the package as failed. This change introduces tracking for the specific test ID that first emits panic output. The JUnit reporter now uses this ID to mark the panicking test with instead of the generic "Failed", while allowing other tests in the package to retain their correct status. This addresses the issue where a single panic would incorrectly attribute failure to the entire package in the report.

@dnephin
Copy link
Copy Markdown
Member

dnephin commented May 6, 2025

Thanks for the PR!

Since all the tests in a package run in the same process, I don't think it's safe to assume anything about which test caused the panic. From what I remember the go test runner itself is not all that reliable about reporting where the panic came from. Plenty of times it will parse the panic as not being part of any test, but only part of the package.

Is the current behaviour causing problems? Do you see panics that often? Maybe there's a way the source of the panics can be fixed so that tests fail instead of panic?

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

Successfully merging this pull request may close these issues.

2 participants