0

The BDD sample below is written using Katalon Studio

Scenario Outline: Verify Price of <plan> Plan
    Given <accountType> account is currently logged in
    When User navigates to Publish Page
    Then The price of <plan> at publish page should be <price>
    When User selects <plan> plan
    Then The price of <plan> at confirm upgrade page should be <price>    

    Examples: 
      | accountType         | plan          |   price |
      | Free                | Android       |   19.79 |
      | Free                | IOS           |   19.79 |
      | Free                | Both          |   24.99 |

Is there a similar way robot framework can iterate the same scenario outline by just using Examples data? cause I've tried to convert it my solution was to use FOR loop. I've been googling this but can't seem to find a good example, and some of the blogs I've read says there's no similar way of handling it (which I can't believe)

Here's my robot framework version of it:

*** Test Cases ***
Verify Prices of All Plan
    [Setup]  Login User with Free Plan    ${email}    ${password}
    Given User Navigates to Publish Page
    Then Verify the prices of each plan
    And The prices for each confirm purchase pages should match


*** Keywords ***

Verify the price
    [Arguments]          ${whole_number_locator}    ${decimal_locator}           ${expected_price}
    ${whole_number} =    Get Text                   ${whole_number_locator}
    ${decimal} =         Get Text                   ${decimal_locator}
    ${actual_price} =    Set Variable               ${whole_number}${decimal}
    Should Be Equal      ${expected_price}          ${actual_price}
    Log                  ${actual_price}

Verify the prices of each plan
    FOR                 ${plan}          IN                 @{plans}
    Log                 ${plan.name}
    Verify the price    ${plan.whole}    ${plan.decimal}    ${plan.expected}
    END

I didn't include the variables and the step definition in Katalon Studio to avoid making this post longer.

1

The closes you can get to your Katalon example is using Templates with embedded arguments:

Verify Prices of All Plans
    [Template]    Account ${account} and ${plan} Should Have Price ${price}
    Free    Android    19.79
    Free    IOS        19.79
    Free    Both       24.99

All other logic would be inside Account ${account} and ${plan} Should Have Price ${price} keyword.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.