How to stop test execution if first testcase FAIls?

please kindly advise how to stop text excecution when testcase 1 fails and Robot should stop proceeding to testcase 2

https://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#stopping-when-first-test-case-fails

If option --exitonfailure (-X) is used, test execution stops immediately if any test fails. The remaining tests are marked as failed without actually executing them.

1 Like

Hey Brandon,

Thanks for your quick respond :slight_smile: please kindly advise,how do you use --exitonfailure (-X) in your automation script?like this?

Click Element        //*[contains(@id, 'OkButton_label')]
Sleep                   3s

–exitonfailure (-X)

Hi Sam,

No you use the command line options when you run robot, if you are currently doing this:

robot sams_tests.robot

Then you would change that to

robot -X sams_tests.robot

or

robot –-exitonfailure sams_tests.robot

Dave.

2 Likes