I would like to return a custom error message if an assertion fails in SoapUI.
I have written assertions. I always get OK response even though the assertion fails.
I tried below script:
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()
But this will return before assert is executed. Hence assertion is passed though it should fail.
Is there a way that I can achieve this?