Skip to content

Instantly share code, notes, and snippets.

@dnephin
Created April 17, 2021 19:45
Show Gist options
  • Save dnephin/09d7e0ad588d9755ad70922d92dd57a0 to your computer and use it in GitHub Desktop.
Save dnephin/09d7e0ad588d9755ad70922d92dd57a0 to your computer and use it in GitHub Desktop.
gotestsum with benchmarks
$ go test -bench Something -run Nothing -tags stubpkg ./testjson/internal/good/
goos: linux
goarch: amd64
pkg: gotest.tools/gotestsum/testjson/internal/good
cpu: Intel(R) Core(TM) i7-4790K CPU @ 4.00GHz
BenchmarkSomething-8 88722897 13.12 ns/op
PASS
ok gotest.tools/gotestsum/testjson/internal/good 1.181s
$ gotestsum -f standard-quiet -- -bench Something -run Nothing -tags stubpkg ./testjson/internal/good/
goos: linux
goarch: amd64
pkg: gotest.tools/gotestsum/testjson/internal/good
cpu: Intel(R) Core(TM) i7-4790K CPU @ 4.00GHz
BenchmarkSomething
BenchmarkSomething-8 89151012 13.05 ns/op
ok gotest.tools/gotestsum/testjson/internal/good 1.179s
DONE 0 tests in 1.298s
$ gotestsum -f standard-verbose -- -bench Something -run Nothing -tags stubpkg ./testjson/internal/good/
goos: linux
goarch: amd64
pkg: gotest.tools/gotestsum/testjson/internal/good
cpu: Intel(R) Core(TM) i7-4790K CPU @ 4.00GHz
BenchmarkSomething
BenchmarkSomething-8 87865257 13.07 ns/op
PASS
ok gotest.tools/gotestsum/testjson/internal/good 1.165s
DONE 0 tests in 1.284s
$ gotestsum -f pkgname -- -bench Something -run Nothing -tags stubpkg ./testjson/internal/good/
✓ testjson/internal/good (1.182s)
DONE 0 tests in 1.299s
$ gotestsum -f testname -- -bench Something -run Nothing -tags stubpkg ./testjson/internal/good/
goos: linux
goarch: amd64
pkg: gotest.tools/gotestsum/testjson/internal/good
cpu: Intel(R) Core(TM) i7-4790K CPU @ 4.00GHz
BenchmarkSomething
BenchmarkSomething-8 88901953 13.13 ns/op
PASS testjson/internal/good
DONE 0 tests in 1.297s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment