8. Testを実行する
# ディレクトリ構成
$ tree ../covertest
../covertest
├── coverage.go
└── coverage_test.go
# Testを実行
$ go test ./...
ok
covertest
0.001s
# Testを実行(詳細表示)
$ go test -v ./...
=== RUN TestSize
--- PASS: TestSize (0.00 seconds)
PASS
ok
covertest
0.001s
11. Coverage測定する1
・Go1.2 (2013/12/1 Released) から使えるように
http://golang.org/doc/go1.2#cover
・使い方はカンタン
$ go test -cover ./...
ok
covertest
0.001s coverage: 42.9% of statements
12. Coverage測定する2
・テストが通っていない個所を特定する
$ go test -coverprofile=coverage.out ./...
ok
covertest
0.002s coverage: 42.9% of statements
$ go tool cover -html=coverage.out