🔢 testify: print test and assertions statistics at the end of the test suite
MIT License
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.
Swap all imports of github.com/stretchr/testify/assert
with
github.com/elliotchance/testify-stats/assert
.
Either update or create a TestMain
:
import "github.com/elliotchance/testify-stats"
func TestMain(m *testing.M) {
os.Exit(testify_stats.Run(m))
}
go test
as normal.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))