Search code examples
pythonpython-2.7robotframeworkkeyword-argument

How to pass default mutable arguments in robot framework?


I need to pass default mutable arguments in robot framework.In python generally we will initialize the argument to None to achieve the task but i am not sure how to pass the same functionality in robot framework.PFB the scenario:

Number of users involved
[Arguments]  ${user1}  ${user2} ..... .... ....  .....  ..... ${userN}

In above scenario i need to give default mutable arguments say it till N.The scenario requires that i will define all the arguments in 1st step so that i will not change every time whenever i am using keyword for 2 users, 3 users, 4 users or N users in the respective test case.

PF how we will call that keyword:

 Number of users involved  ABC XYZ  --> 1st scenario
 Number of users involved  ABC XYZ GFH ABC ......  --> 2nd scenario

My questions are as below: 1) How to pass default mutable arguments in robot framework if its possible?


Solution

  • You could try to use variable number of arguments http://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#variable-number-of-arguments

    Number of users involved
        [Arguments]    @{users}
        :FOR    ${user}    IN    @{users}
        \    Log    ${user}