Also there is another way:
import com.eviware.soapui.impl.wsdl.support.soap.SoapUtils
import com.eviware.soapui.impl.wsdl.support.soap.SoapVersion
import static com.eviware.soapui.impl.wsdl.support.soap.SoapUtils.isSoapFault
public void afterStep(TestCaseRunner runner, TestCaseRunContext context, TestStepResult stepResult) {
def content = context.httpResponse.responseContent
def soapVersion = SoapVersion.Soap11 //if 1.1, otherwise SoapVersion.Soap12
if (isSoapFault(content,soapVersion)) {
//your stuff goes here if response contains soap fault
} else {
//alternative stuff goes here
}
}