Reputation: 150
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}
Upvotes: 0
Views: 1299
Reputation: 96
Yes this is supported.
example:-
*** Test Cases ***
Test title ${name}
[Tags] DEBUG
Log Welcome ${name}
output:-
robot --variable name:sample eg.robot
Upvotes: 1
Reputation: 334
Yes, you can. The way you have shown it should work. Are you facing any issue with that? If yes, pls provide the detailed error.
Upvotes: 1
Reputation: 775
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.
Upvotes: 0