Skip to content

A utility to create a minimalistic html report from the go test output

License

Notifications You must be signed in to change notification settings

SergeyBibikov/gotest2html

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gotest2html

A utility to create a minimalistic html report for failed test cases from the go test -json output

Build

  1. Clone the repo
  2. Run go build
  3. (Optional) For more convinient usage I'd recommend adding the path to the binary to the PATH variable

Usage

  • 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: sample_report
    The "Total" field includes the stats for both, so to speak, primary tests (func Test...) and the subtests executed via t.Run. The output of the subtests (passing or failing) will be included in the primary test output if it fails, like this:
    subtests_example

About

A utility to create a minimalistic html report from the go test output

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages