go的測試用例一般分兩種
單元測試:主要測試代碼可運作正确行,相當于運作一遍編寫代碼
基準測試:主要是對性能的測試
test.short : 一個快速測試的标記,在測試用例中可以使用 testing.Short() 來繞開一些測試
test.outputdir : 輸出目錄
test.coverprofile : 測試覆寫率參數,指定輸出檔案
test.run : 指定正則來運作某個 / 某些測試用例
test.memprofile : 記憶體分析參數,指定輸出檔案
test.memprofilerate : 記憶體分析參數,記憶體分析的抽樣率
test.cpuprofile : cpu 分析輸出參數,為空則不做 cpu 分析
test.blockprofile : 阻塞事件的分析參數,指定輸出檔案
test.blockprofilerate : 阻塞事件的分析參數,指定抽樣頻率
test.timeout : 逾時時間
test.cpu : 指定 cpu 數量
test.parallel : 指定運作測試用例的并行數
部落格中所涉及到的圖檔都有版權,請謹慎使用