Package documents describe such an example with testing.(*T).Skip
:
Tests and control tests may be skipped if they are not applicable when calling the Skip method for * T and * B:
func TestTimeConsuming(t *testing.T) {
if testing.Short() {
t.Skip("skipping test in short mode.")
}
...
}
The message you provided for Skip
will be printed if you run go test
with the flag -v
(in this example, you also need to specify a flag -short
to view the skip message).
source
share