Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How To Write Pending Tests In Go

Is there legitimate way to write down a test case for which I intent to write full test function later on? As like pending tests of mochajs?

like image 206
Rana Avatar asked Oct 28 '15 16:10

Rana


1 Answers

The package docs describe such example with testing.(*T).Skip:

Tests and benchmarks may be skipped if not applicable with a call to the Skip method of *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 launch go test with a -v flag (in this example you'll also need to provide -short flag to see the skip message).

like image 162
Ainar-G Avatar answered Oct 14 '22 01:10

Ainar-G