由于與測(cè)試本身無關(guān)的第 3 方錯(cuò)誤,我的測(cè)試失敗了?;旧衔冶仨毷褂玫囊恍y(cè)試服務(wù)器無法在 Windows 操作系統(tǒng)上關(guān)閉,但實(shí)際上運(yùn)行良好。我需要忽略它產(chǎn)生的錯(cuò)誤,但它們?cè)谙旅娴难舆t部分。有沒有辦法完全忽略來自前兩行的任何錯(cuò)誤?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") }}測(cè)試因此在他們的代碼中死亡
有沒有辦法在單元測(cè)試期間忽略來自第三方包的測(cè)試錯(cuò)誤?
叮當(dāng)貓咪
2022-11-08 16:30:14