1 回答

TA貢獻(xiàn)1801條經(jīng)驗(yàn) 獲得超16個(gè)贊
我認(rèn)為gotestsum工具接近您正在尋找的東西。它是一個(gè)包裝器,用于打印格式化的測(cè)試輸出和測(cè)試運(yùn)行的摘要。go test
違約:go test
go test ./...
? github.com/marco-m/timeit/cmd/sleepit [no test files]
ok github.com/marco-m/timeit/cmd/timeit 0.601s
違約:gotestsum
gotestsum
? cmd/sleepit
? cmd/timeit (cached)
DONE 11 tests in 0.273s <== see here
查看文檔和內(nèi)置幫助,它寫得很好。
根據(jù)我的經(jīng)驗(yàn),gotestsum(以及同一組織的其他工具)是好的。對(duì)我來說,能夠使用標(biāo)準(zhǔn)的Go測(cè)試包,沒有其他“測(cè)試框架”也非常重要。gotestsum允許我這樣做。
另一方面,為了真正滿足您的要求(打印聲明的測(cè)試數(shù)量并驗(yàn)證該數(shù)量是否實(shí)際運(yùn)行),您需要類似TAP的東西,即Test Anything協(xié)議,它適用于任何編程語言:
1..4 <== see here
ok 1 - Input file opened
not ok 2 - First line of the input valid
ok 3 - Read the rest of the file
not ok 4 - Summarized correctly # TODO Not written yet
TAP實(shí)際上非常好,很簡(jiǎn)單。我記得有一個(gè)Go端口,tap-go,但現(xiàn)在被標(biāo)記為存檔。
- 1 回答
- 0 關(guān)注
- 136 瀏覽
添加回答
舉報(bào)