Skip to content

Generate a markdown test report from the go json test result

License

Notifications You must be signed in to change notification settings

becheran/go-testreport

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

80 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go Test Report

Pipeline Status Go Report Card PRs Welcome License GHAction

Generate a markdown test report from the go json test result.

Matches perfectly with github job summaries to visualize test results:

ReportExample

The default output sorts the tests by failing and slowest execution time.

Install

Go

Install via the go install command:

go install github.com/becheran/go-testreport@latest

Binaries

Or use the pre-compiled binaries for Linux, Windows, and Mac OS from the github releases page.

Usage

Run the following command to get a list of all available command line options:

go-testreport -h

Input and Output

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

Templates

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

GitHub Actions

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

About

Generate a markdown test report from the go json test result

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages