kimon
kimon

Reputation: 2505

Alternative to PASS or FAIL in robotframework?

Sometimes a test fails because of infrastructure failures, for example a network outage that does not indicate a regression. Is there any alternative in robotframework to PASS / FAIL? Something like ERROR?

Upvotes: 1

Views: 2111

Answers (1)

Laurent Bristiel
Laurent Bristiel

Reputation: 6935

Robot Framework offers only PASS or FAIL, nothing like ERROR. I can see 2 strategies though to handle those intermittent problems (that most of us are facing).

1) use the "wait until keywords succeeds" keyword. For example, if you have to do a GET via REST on a remote server that could be unreachable for some network reason, then instead of

Get  MyURL

you could do

wait until keywords succeeds  Get  http://example.com

and even better option would be to create a custom keyword for that

*** keywords ***
Get_until_succeeds
[Arguments]  ${url}
  wait until keywords succeeds  Get  ${url}

So then you just have to call:

Get_until_succeeds  http://example.com

2) use the "--rerunfailed" option or Robot Framework that allows you to re-run the tests that failed. The way to use it is to first launch your suite the usual way:

pybot tests

And then give the output.xml of the previous execution as input of another round:

pybot --rerunfailed output.xml tests

(you can then merge the 2 reports and get a single nice report)

Upvotes: 4

Related Questions