How to write pending tests in Go

Is there a legitimate way to write a test case for which I intend to write a complete test function later? How are pending urine tests?

+4
source share
1 answer

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 Skipwill be printed if you run go testwith the flag -v(in this example, you also need to specify a flag -shortto view the skip message).

+10
source

Source: https://habr.com/ru/post/1613527/


All Articles