Skip to content

brpaz/go-test-html-report

Repository files navigation

go-test-html-report

A Golang library for generating HTML reports from go test results.

GitHub go.mod Go version Latest Release Go Report Card GitHub Actions Workflow Status Codecov LICENSE

🎯 Features

  • Generates a good looking single page HTML report from Go test results, using Tailwind CSS for the UI.
  • Test Report includes summary statistics (number of tests, passed/failed, total test duration), test case details, and relevant test output.
  • Failed tests are highlighted at the top for easy identification.
  • Support for reading test results from a JSON file or standard input, which makes it easy to use with go test command.
  • No external dependencies besides testify.

🖼️ Example Output

Screenshot

You can find a full page screenshot of the resulting report here and a full HTML example here.

🚀 Getting Started

Installation

Binary install

The simplest way to install this tool is by using the binary release. See Releases for details.

Go install

go install github.com/brpaz/go-test-html-report/cmd/go-test-html-report@latest

Nix

Coming soon...

🔧 Usage

After installing go-test-html-report, you can use it to generate an HTML report from your Go test results.

The tool supports reading test results from a JSON file or directly from standard input.

From file

go-test-html-report -i path/to/test-results.json -o path/to/report.html -t "Test Report"

From standard input

go test -json ./... | go-test-html-report -i - -o path/to/report.html -t "Test Report"

Command flags

Flag Short Description Default Value
--input -i Input file containing Go test results (use '-' for stdin) test_results.json
--output -o Output file for the HTML report report.html
--title -t Title for the HTML report Go Test Report
--help -h Show help information -
--version -v Show version information -

🤝 Contributing

Contributions are welcome! If you find a bug or have a feature request, please open an issue or submit a pull request.

🫶 Support

If you find this project helpful and would like to support its development, there are a few ways you can contribute:

Sponsor me on GitHub

Buy Me A Coffee

📩 Contact

✉️ Email - [email protected]

🖇️ Source code: (https://github.com/brpaz/go-test-html-report)

📃 License

Distributed under the MIT License. See LICENSE file for details.

About

A Golang library for generating HTML reports from go test results.

Topics

Resources

License

Stars

Watchers

Forks

Contributors 2

  •  
  •  

Languages