Search code examples
robotframework

How to Parameterize test cases in robot framework?


I need to provide multiple inputs to a testcase using robot framework. I had done similarly in pytest with parameterization, is there any similar way to do in robot framework as well..


Solution

  • Approach that i made: As i'm calling my robot call only once for a suite and in test suite each indivdual test case may have different no and different variables. I made a json file to have: test suite name > test case name > test case params max no of params in that test suite . I'm adding a common tag as param1 param2 for test cases based on no of params for each tc and iterate the call for the robot test suite with above tags and variable as ${params} with tag name. So that only those test cases will be picked. Param details i'm reading the json file in the test case based on the variable passed ${params}.

    eg,.

    robot  --variable  params:param1 -i param1
    robot  --variable  params:param2 -i param2
    TestCase[xxx]: Sample Test Case
        [Documentation]  Sample Test Case
        [Tags]  Sanity  param1  param2  param3