Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

If-Condition with multiple actions in Robot Framework

I want to use If-Condition with multiple actions in Robot Framework

${x}    Set Variable    5   
Run Keyword If  ${x} == 5       
... ${Test1} =  Set Variable    MyName
... ${Test2} =  Set Variable    MyLastName
... Else        
... ${Test1} =  Set Variable    MyAddress
... ${Test2} =  Set Variable    MyTelephone

But it is not working Error show FAIL : Variable '${Test1}' not found. Could you please tell me about using IF-Condition with multiple actions

like image 388
Bell Aimsaard Avatar asked Mar 16 '26 07:03

Bell Aimsaard


2 Answers

You can use "Run Keywords" keyword to perform multiple actions in IF condition

Kindly go through below link:

IF ELSE in robot framework with variables assignment

like image 135
Rakesh Avatar answered Mar 18 '26 05:03

Rakesh


You have to either cover both actions with one custom keyword and then call Run Keyword If or call the keyword Set Variable If twice or write such logic into python (jython...) library.

like image 21
Jan Kovařík Avatar answered Mar 18 '26 04:03

Jan Kovařík



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!