2

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..

4 Answers 4

4

You can use variables for this. for example

robot --variable HOST:10.0.0.2:1234 /testfolder/

variable ${HOST} will have value 10.0.0.2:1234 in this testrun

Sign up to request clarification or add additional context in comments.

1 Comment

Yep it worked, 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 details > test case name and max no of params in that test suite > test case params. and based on max no of params and param tag, i'm
1

I think you can use Arguments using Robot framework. Keywords can accept zero or more arguments, and some arguments may have default values. It is best way to supply parameters to your testcase/keyword based on input required. More documentation can be found at - http://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#using-arguments

Comments

1

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

Comments

0

I found the following solution close to pytest parametrize option. You can put entire test case in a FOR loop, which will use list values as a parameter to pass into test case for each new run. Example code below:

*** Test Cases ***
Test Case
FOR    ${parameter}    IN    @{parameters}
    Log    ${parameter}
END

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.