snippetgoCritical
How to `go test` all tests in my project?
Viewed 0 times
projecthowallteststest
Problem
The
I want to
What's the command to do this?
go test command covers *_test.go files in only one dir.I want to
go test the whole project, which means the test should cover all *_test.go files in the dir ./ and every children tree dir under the dir ./.What's the command to do this?
Solution
This should run all tests in current directory and all of its subdirectories:
This should run all tests for given specific directories:
This should run all tests with import path prefixed with
This should run all tests import path prefixed with
This should run all tests in your $GOPATH:
$ 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 ...Code Snippets
$ go test ./...$ go test ./tests/... ./unit-tests/... ./my-packages/...$ go test foo/...$ go test foo...$ go test ...Context
Stack Overflow Q#16353016, score: 621
Revisions (0)
No revisions yet.