0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Goで特定のテストケースだけ実行しない方法

Posted at

go test で「特定のテストケースだけ実行しない」ということをしたい。

もっといいやり方あったら教えてください。

方法

ビルドタグを使う

手順

1. 実行したくないテストケースを別ファイルにする

パッケージは変えなくていいです。

2. ビルドタグを追加

除外したいテストケースを書いたファイルの冒頭にビルドタグを追加します。

// +build !abnormal_test

package foo
...

3. tag 指定で go test

$ go test -tags="abnormal_test" ./...

おわり

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?