Riccardo79
Riccardo79

Reputation: 1056

Run keyword And Continue On Failure - get check status

I need to get the status of a check (PASS/FAIL) without changing the overall status of a test

Test 1
  ${passed}  Run keyword And Continue On Failure    Should Be Equal  1  2
  Log  ${passed}
  ${passed}  Run keyword And Continue On Failure    Should Be Equal  1  1
  Log  ${passed}

${passed} is always None. What is the right way?


This is at the moment my working solution :(

  ${passed}  ${value}    Run keyword And Ignore Error    Should Be Equal    1  2
  Run Keyword If  "${passed}"=="FAIL"  Run keyword And Continue On Failure  FAIL

Rr

Upvotes: 0

Views: 22586

Answers (1)

Jan Svoboda
Jan Svoboda

Reputation: 131

This is because Run keyword And Continue On Failure does not return any value. It was never meant to.

For this purpose use Run Keyword And Return Status

This keyword returns Boolean True if the keyword that is executed succeeds and False if it fails.

${passed} =   Run Keyword And Return Status   Should be Equal   1   2
Run Keyword Unless   ${passed}   Log   The previous step FAILED! 

But even with just the Run keyword And Continue On Failure should have the failure of the encapsulated keyword in the log.

Upvotes: 4

Related Questions