DosDontsSlides icon indicating copy to clipboard operation
DosDontsSlides copied to clipboard

New topic: "Try: Document dynamically created variables in variable table"

Open pekkaklarck opened this issue 10 years ago • 0 comments

This is related to topic "AVOID: Variable assignment on test case level", and alternatively that example could be enhanced. Below is one possible example related to this adapted from http://code.google.com/p/robotframework/wiki/HowToWriteGoodTestCases#Passing_and_returning_values


*** Variables ***
${USER}               John Doe
${WITHDRAW STATUS}    # Set by Withdraw From Account keyword to indicate did withdraw succeed.

*** Test Cases ***
Withdraw From Account
    Withdraw From Account    $50
    Withdraw Should Have Succeeded

*** Keywords ***
Withdraw From Account
    [Arguments]    ${amount}
    ${status} =    Withdraw From User Account    ${USER}    ${amount}
    Set Test Variable    ${WITHDRAW STATUS}    ${status}

Withdraw Should Have Succeeded
    Should Be Equal    ${WITHDRAW STATUS}    SUCCESS

pekkaklarck avatar Sep 02 '14 12:09 pekkaklarck