3
如果斷言在SoapUI
中失敗,我想返回自定義錯誤消息。如果在SoapUI中斷言失敗,返回錯誤響應
我寫了斷言。即使斷言失敗,我總是會得到正確的迴應。
我想下面的腳本:
def assertionList = []
def idNotNull = (id!=null) ? "(id is not null" : assertionList.add("(id is null")
if(!assertionList.isEmpty())
{
return "exceptionResponse"
}
assert assertionList.isEmpty() : assertionList.toString()
但在執行斷言之前,這將返回。因此斷言雖然會失敗,但通過。
有沒有一種方法可以實現這個目標?