由于與測試本身無關的第 3 方錯誤,我的測試失敗了?;旧衔冶仨毷褂玫囊恍y試服務器無法在 Windows 操作系統上關閉,但實際上運行良好。我需要忽略它產生的錯誤,但它們在下面的延遲部分。有沒有辦法完全忽略來自前兩行的任何錯誤?func TestDoSomething(t *testing.T) { testServer := setupTestNomad(t) //contains 3rd party test server creation defer testServer.Stop() //actually fails here in the 3rd party struct due to 3rd party code itself data := DoSomething() if data == nil { //data is not null and all is fine here t.Errorf("Failed, data null") }}測試因此在他們的代碼中死亡
- 2 回答
- 0 關注
- 112 瀏覽
添加回答
舉報
0/150
提交
取消