Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/elliotchance/testify-stats
🔢 testify: print test and assertions statistics at the end of the test suite
https://github.com/elliotchance/testify-stats
golang testify testify-suites testing
Last synced: 4 months ago
JSON representation
🔢 testify: print test and assertions statistics at the end of the test suite
- Host: GitHub
- URL: https://github.com/elliotchance/testify-stats
- Owner: elliotchance
- License: mit
- Created: 2019-05-02T09:09:11.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2024-09-11T14:34:01.000Z (5 months ago)
- Last Synced: 2024-10-09T11:36:18.347Z (4 months ago)
- Topics: golang, testify, testify-suites, testing
- Language: Go
- Homepage:
- Size: 8.79 KB
- Stars: 7
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 🔢 github.com/elliotchance/testify-stats
`testify-stats` is a drop in replacement for
[testify](https://github.com/stretchr/testify) that will print stats at the end
of the test suite:```txt
$ 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`:
```go
import "github.com/elliotchance/testify-stats"func TestMain(m *testing.M) {
os.Exit(testify_stats.Run(m))
}
```3. 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:```bash
$(exit $(grep -r '"github.com/stretchr/testify"' . --include \*.go | wc -l))
```