Custom Python keyword equivalent to Robot Framework's Run Keyword And Continue On Failure

I know the keyword Run Keyword And Continue On Failure highlights failed keywords in red while allowing the process to continue, but it’s quite annoying that the report explicitly shows Run Keyword And Continue On Failure:

I’m wondering if it’s possible to achieve the same effect in a **custom Python keyword

  1. Highlight the failed keyword in red within the report, but continue execution.
  2. Expand the failed keyword section by default.

I’ve already referenced this github issues, I understand built_in.run_keyword_and_continue_on_failure won’t work

Any ideas or suggestions on how to implement this?

Have you considered using TRY/EXCEPT feature? It has more flexibility than Run Keyword And Continue On Failure and the code colour you are looking for.

Alternatively, you could use the built-in tag robot:continue-on-failure, that will keep running the test/keyword even if a step failed. Though this would be for the whole test/keyword, not for a single step.

1 Like

see also here Robot Framework User Guide

2 Likes

Appreicate ur prompt reply

my enve is
Robot Framework 6.0.2 (Python 3.10.12 on linux)

The key point is that I need the test case to be marked as Failed, seems like try-except block can’t do it :

Sorry, I forgot to mention this earlier.

Actually, your suggestion of using the robot:continue-on-failure tag solves part of my problem, but as you mentioned, this applies to the entire test rather than a specific keyword.

This is EXACTLY what I was looking for!
Thanks dude!!! :rocket:

2 Likes