Skip to content

elliotchance/testify-stats

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🔢 github.com/elliotchance/testify-stats

testify-stats is a drop in replacement for testify that will print stats at the end of the test suite:

$ go test -v
PASS
Tests: 460, Assertions: 1319, Time: 18.600047ms
ok      github.com/elliotchance/testify-stats   0.014s

Note: The statistics will only print with the -v option. This is because the testing package will capture all stdout and only print it under verbose more, or if there was a failure. I couldn't find a way around this. If you know of one, please let me know.

How to Use It

  1. Swap all imports of github.com/stretchr/testify/assert with github.com/elliotchance/testify-stats/assert.

  2. Either update or create a TestMain:

import "github.com/elliotchance/testify-stats"

func TestMain(m *testing.M) {
	os.Exit(testify_stats.Run(m))
}
  1. Run go test as normal.

Build/CI Check

To make sure all assertions are recorded you can add the following step to your build/CI:

$(exit $(grep -r '"github.com/stretchr/testify"' . --include \*.go | wc -l))

About

🔢 testify: print test and assertions statistics at the end of the test suite

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages