3
votes

I am running multiple test cases (within a test suite) in robot framework. If the first test case setup section fails, then I want to skip the execution of all the remaining test cases.

Please let me know if there is any way to do that?

3
I found the answer here very useful: stackoverflow.com/a/25079032/1971003 - Guy Avraham

3 Answers

3
votes

There is a command line option for this, the option is "--exitonfailure" Here if any critical test case fails, the test execution stops immediately.

2
votes

Until a SKIP status is implemented, you can use exitonfailure to stop further execution if a critical test failed, and then change the output.xml (and the tests results.html) to show those tests as "NOT_RUN" (gray color), rather than "FAIL" (red color):

enter image description here

I've already posted how to implement it here: https://stackoverflow.com/a/55745118/658497

2
votes

There is currently no way to skip some tests depending on the failure of a given test. That might be implemented in the future as it is being discussed in an issue on GitHub.

In the meantime, what you can do is have a suite that groups your tests and in the Suite Setup, do some initial checks/verification (that would be similar to the test failure you mention). If the Suite Setup fails, then the tests of the suite won't be run.