Skipping tests
You can skip certain tests based on an input flag. This feature lets you have a quick test where only a subset of the tests are run and a comprehensive test where all the tests are run.
How to do it...
- Check the
testing.Short()flag for tests that should be excluded from short test runs:func TestService(t *testing.T) { Â Â if testing.Short() { Â Â Â Â t.Skip("Service") Â Â } Â Â ... } - Run tests with the
test.shortflag:$ go test -test.short -v === RUN   TestService     service_test.go:15: Service --- SKIP: TestService (0.00s) === RUN   TestHandler --- PASS: TestHandler (0.00s) PASS