A utility to create a minimalistic html report for failed test cases from the go test -json
output
- Clone the repo
- Run
go build
- (Optional) For more convinient usage I'd recommend adding the path to the binary to the PATH variable
- You may generate the report from a file:
$ go test -json > results
$ gotest2html results
- Or on Linux (and Mac, I guess) pipe the output from
go test -json
directly:
$ go test -json | gotest2html
- It is also possible to generate a report from the precompiled test binary output (mind the -test.v option though!). In this case the timestamps will be missing, the rest stays the same:
$ go tool test2json ./yourBin.test -test.v | gotest2html
Once done, the folder "reports" will be created in the current directory. The folder will contain two files: "report_failed.html" and "styles.css".
Opened in a browser, the report will look like this:
The "Total" field includes the stats for both, so to speak, primary tests (func Test...
) and the subtests executed viat.Run
. The output of the subtests (passing or failing) will be included in the primary test output if it fails, like this: