Skip to content

About

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

Topics

Resources

Stars

3 stars

Watchers

0 watching

Forks

Latest commit

 

History

39 Commits

Folders and files

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

This project ships a flake exposing the CLI as a package (packages.default / packages.go-test-html-report).

Run it directly:

nix run github:brpaz/go-test-html-report -- --version

Or install it into your profile:

nix profile install github:brpaz/go-test-html-report

In a devenv project

Add it as an input in your devenv.yaml:

inputs:
  go-test-html-report:
    url: github:brpaz/go-test-html-report

Then reference the package in your devenv.nix:

{ inputs, ... }: {
  packages = [ inputs.go-test-html-report.packages.${pkgs.system}.default ];
}

In another flake

Add it as an input in your flake.nix and reference packages.<system>.default from inputs.go-test-html-report.

🔧 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 - oss@brunopaz.dev

🖇️ 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

Stars

3 stars

Watchers

0 watching

Forks

Releases

Sponsor this project

Contributors

Languages