How to `go test` all tests in my project?

This should run all tests in current directory and all of its subdirectories:

$ go test ./...

This should run all tests for given specific directories:

$ go test ./tests/... ./unit-tests/... ./my-packages/...

This should run all tests with import path prefixed with foo/:

$ go test foo/...

This should run all tests import path prefixed with foo:

$ go test foo...

This should run all tests in your $GOPATH:

$ go test ...

Leave a Comment