Search code examples
robotframework

Robotframework Change testcase name with variable


Is there any possible to change testcase name with variable like below?

(I don't want to change name from python side)

*** Variables ***
${country}  US

*** Test Cases ***
test_${country}

Solution

  • As far as I know, it isn't possible to use a variable inside a test case name. It follows the same logic as normal Python functions, so normally, it isn't possible.

    Instead, you can use the variable in the setup or in the test case directly to modify it's behaviour.

    If you want to generate test cases based on a variable, you can write a (python) script that can generate the needed file/test cases with the corresponding values. Or, even better, use an Model-Based Testing tool to produce them.