ROBOT_CONTINUE_ON_FAILURE = true doesn't prevent fatal error

533 views
Skip to first unread message

pominnz

unread,
Nov 18, 2012, 9:21:56 PM11/18/12
to robotframe...@googlegroups.com
I have written a test library in Java, and it throws exceptions when things go wrong. Sometimes I want these exceptions to be caught by Robot framework, and for the testing to carry on.

According to the documentation, I should be able to use 'Run Keyword And Expect Error'. It states in the documentation that from v2.5 it no longer catches fatal exceptions.

To get around this, the documentation also states that I can add "public static final boolean ROBOT_CONTINUE_ON_FAILURE = true;" to the exception in my library, and the test will no longer result in a fatal error.

This doesn't appear to work. The test still fails with a Fatal Error.

I'm using Robot Framework v2.7.1

Cheers
Paul

Kevin O.

unread,
Nov 19, 2012, 10:06:47 AM11/19/12
to robotframe...@googlegroups.com
From what I understand, a regular exception is not a fatal error. You have to explicitly throw a user exception that has a ROBOT_EXIT_ON_FAILURE field to cause a fatal error.
You don't have both ROBOT_EXIT_ON_FAILURE and ROBOT_CONTINUE_ON_FAILURE in your user exception, do you?
I would run it with a debug log level and post the stack trace and source code to the continuable user exception you are throwing that is causing the test to fail when it should not. Then maybe we can get to the bottom of it.
Also, for the scenario you are talking about Run Keyword And Expect error seems inappropriate. Run Keyword And Ignore Error would seem more appropriate(if you can't get the ROBOT_CONTINUE_ON_FAILURE bit to work).

Kevin

pominnz

unread,
Nov 22, 2012, 3:24:59 PM11/22/12
to robotframe...@googlegroups.com
Hi Kevin

Thanks for your reply. My code is throwing a Runtime Exception, and I've only got ROBOT_CONTINUE_ON_FAILURE set to true set, but Robot Framework still reports it as a fatal error. I'm not setting both variables.

I've found some other code that I've written in the past which used the ROBOT_EXIT_ON_FAILURE variable, so I've tried this and set it to false, and it appears to behave as expected. The test carries on.

I need to use the Run Keyword And Expect Error keyword because I only want the test to carry on if the expected exception is thrown, not just if any exception is thrown. The Run Keyword And Ignore Error keyword ignores all exceptions.

Something I have noticed is that when I add "public static final boolean ROBOT_CONTINUE_ON_FAILURE = true;" to my code, inteliJ doesn't highlight the variable as being used, but if I use the ROBOT_EXIT_ON_FAILURE variable it is highlighted as being used.

It looks like the ROBOT_CONTINUE_ON_FAILURE variable doesn't actually get used anywhere.

Cheers
Paul

pominnz

unread,
Nov 22, 2012, 3:32:13 PM11/22/12
to robotframe...@googlegroups.com
Ok.... My bad. I've discovered what the problem was.

I wasn't declaring the variable as static.

It's working now :-)

Cheers
Paul
Reply all
Reply to author
Forward
0 new messages