gotestyourself / gotestyourself/gotestsum
Support for parsing gocheck tests when present
- Dominant language
- Go
- Stars
- 2.7k
- Forks
- 171
- PR merge metrics
- No merged PRs in 30d
Description
For those of us unlucky be stuck with a codebase hat uses the aging [gocheck](https://pkg.go.dev/gopkg.in/check.v1), but would like to be able to get the benefit of using gotestsum to report individual tests.
I think that this can be done by consuming the `go test -json` output and parsing any output from tests that _look_ like gocheck output and promoting those to be top-level tests. For example, consider the following output created by running `cat gocheck-before.json | go run gotest.tools/gotestsum@latest --format testname --raw-command -- cat`
```
PASS somepackage.Test (0.02s)
PASS somepackage
DONE 1 tests in 0.633s
```
Ideally, I'd like to see something like this, created by modifying the JSON to promote the check-based tests to be the "real" tests in `gocheck-after.json`
```
PASS somepackage.MarshalTests.TestGeneric (0.00s)
PASS somepackage.MarshalTests.TestMarshal (0.00s)
PASS somepackage.MarshalTests.TestNoPacking (0.00s)
PASS somepackage.MarshalTests.TestPacked (0.00s)
PASS somepackage
DONE 4 tests in 0.633s
```
Of course, it's important for these tests to be not only visible in the output, but also recognized in the junit.xml emitted if that is desired.
It's arguable that this is too niche for gotestsum, as one could write a tool that would parse, filter and augment the emitted JSON and have that fed into gotestsum for the desired results. Also, getting this information requires the user to run the tests with `-check.vv` for it to show up at all, which is a limitation.
I may attempt a fork to do this for my own sake, knowing that it might not reach the mainline. I don't know how many people out there are still using gocheck, but it seems to be a non-zero amount of people based on the fact that there are abandoned projects (e.g. https://github.com/tebeka/go2xunit) out there that do support parsing gocheck test output into junit.xml.
[gocheck-before.json](https://github.com/user-attachments/files/21267420/gocheck-before.json)
[gocheck-after.json](https://github.com/user-attachments/files/21267421/gocheck-after.json)
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the attached gocheck-before.json and gocheck-after.json, then trace gotestsum's current go test -json parsing and JUnit XML reporting. Determine how gocheck output can be promoted to individual tests while preserving the package result. Done means the promoted tests appear in human-readable output and in generated junit.xml.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- testing
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100