# Keyword: stop on failure

**URL:** <https://forum.robotframework.org/t/keyword-stop-on-failure/3178>\
**Category:** Robot Framework\
**Created:** [31 January 2022 15:44 UTC](https://forum.robotframework.org/t/keyword-stop-on-failure/3178 "2022-01-31T15:44:37Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![valentijnpeters](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/valentijnpeters/32/828_2.png) [@valentijnpeters](https://forum.robotframework.org/u/valentijnpeters)\
**Post date:** [31 January 2022 15:44 UTC](https://forum.robotframework.org/t/keyword-stop-on-failure/3178/1 "2022-01-31T15:44:37Z")

</div>

Is it possible to create a keyword ‘stop on failure’?

---

<div class="post-metadata">

**Author:** ![damies13](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/damies13/32/623_2.png) [@damies13](https://forum.robotframework.org/u/damies13)\
**Post date:** [31 January 2022 22:59 UTC](https://forum.robotframework.org/t/keyword-stop-on-failure/3178/2 "2022-01-31T22:59:41Z")

</div>

Hi @valentijnpeters

Is [this (stopping-when-first-test-case-fails)](http://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#stopping-when-first-test-case-fails) what you are after?

Dave.

---

<div class="post-metadata">

**Author:** ![valentijnpeters](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/valentijnpeters/32/828_2.png) [@valentijnpeters](https://forum.robotframework.org/u/valentijnpeters)\
**Post date:** [1 February 2022 19:02 UTC](https://forum.robotframework.org/t/keyword-stop-on-failure/3178/3 "2022-02-01T19:02:34Z")

</div>

Well yes and no. Because this is in the command and I want it from within the testcase.

_-vanaf Samsung mobiel-_

---

<div class="post-metadata">

**Author:** ![janipalsamaki](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/janipalsamaki/32/154_2.png) [@janipalsamaki](https://forum.robotframework.org/u/janipalsamaki)\
**Post date:** [2 February 2022 07:49 UTC](https://forum.robotframework.org/t/keyword-stop-on-failure/3178/4 "2022-02-02T07:49:19Z")

</div>

[Fatal Error](https://robotframework.org/robotframework/latest/libraries/BuiltIn.html#Fatal%20Error) might work?

---

<div class="post-metadata">

**Author:** ![robinmackaij](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/robinmackaij/32/126_2.png) [@robinmackaij](https://forum.robotframework.org/u/robinmackaij)\
**Post date:** [2 February 2022 17:59 UTC](https://forum.robotframework.org/t/keyword-stop-on-failure/3178/5 "2022-02-02T17:59:50Z")

</div>

What problem are you trying to solve?

What do you need to stop, at what moment, when what failed?

---

<div class="post-metadata">

**Author:** ![valentijnpeters](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/valentijnpeters/32/828_2.png) [@valentijnpeters](https://forum.robotframework.org/u/valentijnpeters)\
**Post date:** [3 February 2022 18:33 UTC](https://forum.robotframework.org/t/keyword-stop-on-failure/3178/6 "2022-02-03T18:33:39Z")

</div>

Okay let’s say I have 100 scripts.

I want to run them on a Docker but I know 50% will fail.  
I would like to skip all the tests after the first fail.  
(at that moment I’m in a sort of “repair modus” by means of Docker runs) that is the background/context.

by the way: We workedaround it an another manner by now (0% urgency)

---

<div class="post-metadata">

**Author:** ![robinmackaij](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/robinmackaij/32/126_2.png) [@robinmackaij](https://forum.robotframework.org/u/robinmackaij)\
**Post date:** [11 February 2022 08:14 UTC](https://forum.robotframework.org/t/keyword-stop-on-failure/3178/7 "2022-02-11T08:14:07Z")

</div>

If you want to completely stop a run after the first failure, the command line option `--exitonfailure` (or `-X`) is probably what you’re looking for.

Depending on the type of issue, `--exitonerror` could also be useful:  
[Robot Framework User Guide](https://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#stopping-on-parsing-or-execution-error)
