How to stop automating iOS app in tools from script

I am using uiautomation tools for my application. Is there any way that I can stop the script if any test fails.

+3


source to share