{"id":14008187,"url":"https://github.com/jstemmer/go-junit-report","last_synced_at":"2025-12-29T23:21:46.694Z","repository":{"id":40313616,"uuid":"3673833","full_name":"jstemmer/go-junit-report","owner":"jstemmer","description":"Convert Go test output to JUnit XML","archived":false,"fork":false,"pushed_at":"2024-08-20T22:12:14.000Z","size":338,"stargazers_count":780,"open_issues_count":32,"forks_count":225,"subscribers_count":10,"default_branch":"master","last_synced_at":"2024-10-29T21:00:07.547Z","etag":null,"topics":["go","go-junit-report","go-test","go-test-json","golang","junit","junit-xml","testing"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jstemmer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2012-03-09T19:15:01.000Z","updated_at":"2024-10-25T14:19:18.000Z","dependencies_parsed_at":"2024-10-20T14:15:46.906Z","dependency_job_id":null,"html_url":"https://github.com/jstemmer/go-junit-report","commit_stats":{"total_commits":331,"total_committers":30,"mean_commits":"11.033333333333333","dds":0.1570996978851964,"last_synced_commit":"85bf4716ac1f025f2925510a9f5e9f5bb347c009"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jstemmer%2Fgo-junit-report","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jstemmer%2Fgo-junit-report/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jstemmer%2Fgo-junit-report/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jstemmer%2Fgo-junit-report/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jstemmer","download_url":"https://codeload.github.com/jstemmer/go-junit-report/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227410491,"owners_count":17774757,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["go","go-junit-report","go-test","go-test-json","golang","junit","junit-xml","testing"],"created_at":"2024-08-10T11:01:23.118Z","updated_at":"2025-12-29T23:21:46.640Z","avatar_url":"https://github.com/jstemmer.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"# go-junit-report\n\ngo-junit-report is a tool that converts [`go test`] output to a JUnit compatible\nXML report, suitable for use with applications such as [Jenkins].\n\n[![Build status](https://github.com/jstemmer/go-junit-report/actions/workflows/main.yml/badge.svg)](https://github.com/jstemmer/go-junit-report/actions)\n[![Go Reference](https://pkg.go.dev/badge/github.com/jstemmer/go-junit-report/v2.svg)](https://pkg.go.dev/github.com/jstemmer/go-junit-report/v2)\n[![Go Report Card](https://goreportcard.com/badge/github.com/jstemmer/go-junit-report/v2)](https://goreportcard.com/report/github.com/jstemmer/go-junit-report/v2)\n\n## Install from package (recommended)\n\nPre-built packages for Windows, macOS and Linux are found on the [Releases]\npage.\n\n## Install from source\n\nDownload and install the latest stable version from source by running:\n\n```bash\ngo install github.com/jstemmer/go-junit-report/v2@latest\n```\n\n## Usage\n\nBy default, go-junit-report reads `go test -v` output generated by the standard\nlibrary [testing] package from `stdin` and writes a JUnit XML report to\n`stdout`.\n\nGo build and runtime errors are also supported, but this requires that `stderr`\nis redirected to go-junit-report as well.\n\nTypical use looks like this:\n\n```bash\ngo test -v 2\u003e\u00261 ./... | go-junit-report -set-exit-code \u003e report.xml\n```\n\n### More examples\n\nJSON produced by `go test -json` is supported by the `gojson` parser. Note that\n`stderr` still needs to be redirected to go-junit-report in order for build\nerrors to be detected. For example:\n\n```bash\ngo test -json 2\u003e\u00261 | go-junit-report -parser gojson \u003e report.xml\n```\n\nGo benchmark output is also supported. The following example runs benchmarks for\nthe package in the current directory and uses the `-out` flag to write the\noutput to a file called `report.xml`.\n\n```bash\ngo test -v -bench . -count 5 2\u003e\u00261 | go-junit-report -out report.xml\n```\n\nThe `-iocopy` flag copies `stdin` directly to `stdout`, which is helpful if you\nwant to see what was sent to go-junit-report. The following example reads test\ninput from a file called `tests.txt`, copies the input to `stdout` and writes\nthe output to a file called `report.xml`.\n\n```bash\ngo-junit-report -in tests.txt -iocopy -out report.xml\n```\n\n### Flags\n\nRun `go-junit-report -help` for a list of all supported flags.\n\n| Flag                  | Description                                                                     |\n| --------------------  | -----------                                                                     |\n| `-in file`            | read go test log from `file`                                                    |\n| `-iocopy`             | copy input to stdout; can only be used in conjunction with -out                 |\n| `-no-xml-header`      | do not print xml header                                                         |\n| `-out file`           | write XML report to `file`                                                      |\n| `-package-name name`  | specify a default package name to use if output does not contain a package name |\n| `-parser parser`      | specify the parser to use, available parsers are: `gotest` (default), `gojson`  |\n| `-p key=value`        | add property to generated report; properties should be specified as `key=value` |\n| `-set-exit-code`      | set exit code to 1 if tests failed                                              |\n| `-subtest-mode`       | set subtest `mode`, modes are: `ignore-parent-results`, `exclude-parents`       |\n| `-version`            | print version and exit                                                          |\n\n## Go packages\n\nThe test output parser and JUnit XML report generator are also available as Go\npackages. This can be helpful if you want to use the `go test` output parser or\ncreate your own custom JUnit reports for example. See the package documentation\non pkg.go.dev for more information:\n\n- [github.com/jstemmer/go-junit-report/v2/parser/gotest]\n- [github.com/jstemmer/go-junit-report/v2/junit]\n\n## Changelog\n\n### v2.1.0\n\n- Fix #147: Make timestamps in generated report more accurate.\n- Fix #140: Escape illegal XML characters in junit output.\n- Fix #145: Handle build errors in test packages with the `_test` suffix.\n- Fix #145: Don't ignore build errors that did not belong to a package.\n- Fix #134: Json test output was not parsed correctly when using the `-race` flag in `go test`.\n- Add support for `=== NAME` lines introduced in Go1.20\n- junit: Add File attribute to `testsuite`.\n- junit: Allow multiple properties with the same name.\n- junit: Add the `Testsuites.WriteXML` convenience method.\n\n### v2.0.0\n\n- Support for parsing `go test -json` output.\n- Distinguish between build/runtime errors and test failures.\n- JUnit report now includes output for all tests and benchmarks, and global output that doesn't belong to any test.\n- Use full Go package name in generated report instead of only last path segment.\n- Add support for reading skipped/failed benchmarks.\n- Add `-subtest-mode` flag to exclude or ignore results of subtest parent tests.\n- Add `-in` and `-out` flags for specifying input and output files respectively.\n- Add `-iocopy` flag to copy stdin directly to stdout.\n- Add `-prop` flags to set key/value properties in generated report.\n- Add `-parser` flag to switch between regular `go test` (default) and `go test -json` parsing.\n- Output in JUnit XML is written in `\u003c![CDATA[]]\u003e` tags for improved readability.\n- Add `hostname`, `timestamp` and `id` attributes to JUnit XML.\n- Improve accuracy of benchmark time calculation and update formatting in report.\n- No longer strip leading whitespace from test output.\n- The `formatter` and `parser` packages have been replaced with `junit` and `parser/gotest` packages respectively.\n- Add support for parsing lines longer than 64KiB.\n- The JUnit errors/failures attributes are now required fields.\n- Drop support for parsing pre-Go1.13 test output.\n- Deprecate `-go-version` flag.\n\n## Contributing\n\nSee [CONTRIBUTING.md].\n\n[`go test`]: https://pkg.go.dev/cmd/go#hdr-Test_packages\n[Jenkins]: https://www.jenkins.io/\n[github.com/jstemmer/go-junit-report/v2/parser/gotest]: https://pkg.go.dev/github.com/jstemmer/go-junit-report/v2/parser/gotest\n[github.com/jstemmer/go-junit-report/v2/junit]: https://pkg.go.dev/github.com/jstemmer/go-junit-report/v2/junit\n[Releases]: https://github.com/jstemmer/go-junit-report/releases\n[testing]: https://pkg.go.dev/testing\n[CONTRIBUTING.md]: https://github.com/jstemmer/go-junit-report/blob/master/CONTRIBUTING.md\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjstemmer%2Fgo-junit-report","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjstemmer%2Fgo-junit-report","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjstemmer%2Fgo-junit-report/lists"}