mercredi 25 novembre 2015

Robot Framework Multiple Statements in If Condition

I am new to Robot Framework and am trying to figure out how to have multiple statements associated with an If condition.

The basic pre-code counts entries in an array WORDS, and assigns the value to length.

${length}=    Get length    ${WORDS}

Next I want to do a simple check for the size of the array (should have 10 items).

${status}=    Set Variable If   ${length} == 10    TRUE    FALSE

Now I want to log the result and pass or fail the test case.

Run Keyword If    $status == "TRUE"
...  Log    ${status}
...  ELSE
...  Log    ${status}

Run Keyword If     $status != "TRUE"
...  FAIL   Values do not match

I want to combine the ELSE + logging the status + failing the test case, but can not seem to figure it out. In C programming, I would simply brace the statements between { } and be ok.

In Robot Framework, I have tried 'Run keywords' but with no luck.

...   ELSE   Run keywords 
...     Log    ${status}      
...     FAIL   Values Do Not Match       

I hope there is a way to accomplish this. Appreciate any input.

Thanks,

Dan.

Aucun commentaire:

Enregistrer un commentaire