As shown in below robot file, I have three testcases. I want to stop the test execution, if TESTCASE1 fails. TESTCASE2 should be executed only if TESTCASE1 passes.
There are multiple ways to get the job done, each appropriate for different situations.
The command line option --exitonfailure
aborts the test run after any testcase fails, unless it is marked noncritical.
You might only want to abort if exactly TESTCASE1
fails. The Fatal Error keyword exist just for this purpose:
TESTCASE1
${passed}= Run Keyword And Return Status boot device
Run Keyword If not ${passed} Fatal Error
If this seems clunky to you, you can throw fatal errors directly from Python/Java.
These tools will get the job done, and are appropriate in some cases. Although in the asker's case, I observe:
boot device
.To me that is not a testcase. That is a setup. If you need a setup to run once before a suite of testcases, you should specify it as a Suite Setup
.
***Settings***
Suite Setup boot device