Testing package has SkipNow()
and Skip()
methods. So, an individual test could be prepended with something like this:
func skipCI(t *testing.T) {
if os.Getenv("CI") != "" {
t.Skip("Skipping testing in CI environment")
}
}
func TestNewFeature(t *testing.T) {
skipCI(t)
}
You could then set the environment variable or run CI=true go test
to set CI
as a command-local variable.
Another approach would be to use short mode. Add the following guard to a test
if testing.Short() {
t.Skip("skipping testing in short mode")
}
and then execute your tests with go test -short