Generate a markdown test report from the go json test result.
Matches perfectly with github job summaries to visualize test results:
The default output sorts the tests by failing and slowest execution time.
Install via the go install command:
go install github.com/becheran/go-testreport@latest
Or use the pre-compiled binaries for Linux, Windows, and Mac OS from the github releases page.
Run the following command to get a list of all available command line options:
go-testreport -h
When -input
and -output
is not set, the stdin stream will be used and return the result will be written to stdout. Will exit with a non zero exit code if at least one test failed:
go test ./... -json | go-testreport > result.html
Use the -input
and -output
file to set files for the input and output. Will always exit with zero also if tests fail:
go-testreport -input result.json -output result.html
Customize by providing a own template file. See also the default markdown template which is used if the -template
argument is left empty. With the vars
options custom dynamic values can be passed to the template from the outside which can be resolved within the template:
go test ./... -json | go-testreport -template=./html.tmpl -vars="Title:Test Report Linux" > $GITHUB_STEP_SUMMARY
The Golang Test Report from the marketplace can be used to integrate the go-testreport tool into an GitHub workflow:
- name: Test
run: go test ./... -json > report.json
- name: Report
uses: becheran/go-testreport@main
with:
input: report.json