I need to increase ${success_num}
test case variable in For Loop:
But it is always 0, even after I add 1 to it. It's like it's been reset after each iteration. How can I increase its value?
*** Test Cases ***
...
...
Set Test Variable ${success_num} ${0}
App For Port ${actual_app}
...
...
*** Keywords ***
App For Port [Arguments] ${app}
: FOR ${port_num} IN 1 2
\ ${PorF} ${message} Run Keyword And Ignore Error applicationcontrol.Launch application ${app} ${port_num}
\ Continue For Loop If '${PorF}'=='FALSE'
\ ${status} Run Keyword And Return Status Check launching status ${app} ${port_num}
\ Continue For Loop If '${status}'=='False'
\ Run Keyword If '${status}'=='True' Add Success
\ Exit For Loop
Add Success
${success_num} Set Variable ${success_num+1}
You don't have to call a keyword to increase success_num:
App For Port [Arguments] ${app}
: FOR ${port_num} IN 1 2
\ ${PorF} ${message} Run Keyword And Ignore Error applicationcontrol.Launch application ${app} ${port_num}
\ Continue For Loop If '${PorF}'=='FALSE'
\ ${status} Run Keyword And Return Status Check launching status ${app} ${port_num}
\ Continue For Loop If '${status}'=='False'
\ ${success_num} = Run Keyword If ${status} Set Variable ${success_num}+1 ELSE Set Variable ${success_num}
\ ${temp} = Run Keyword If ${status} Evaluate ${success_num}+1 ELSE Evaluate ${success_num}
\ Set Test Variable ${success_num} ${temp}
\ Exit For Loop
Change the keyword Add Success
to:
Add Success
${temp} Evaluate ${success_num} + 1
Set Test Variable ${success_num} ${temp}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With