Reputation: 151
I know how can we use run keyword if specific condition is met but i want to run a keyword if testcasename matches.
run keyword if testcase=abc.robot
does anyone know how can we achieve that.
Upvotes: 1
Views: 4313
Reputation: 1582
Run Keyword If '${TEST_NAME}'=='<your_test_name>' <Keyword> <args>
Upvotes: 0
Reputation: 385830
Robot framework provides several automatic variables -- variables that are set automatically by the framework. One such variable is ${TEST_NAME}
.
In the following example, only the log statement in the second test will run:
*** Test Cases ***
Example 1
run keyword if "${TEST_NAME}" == "Example 2"
... log this is example 2?
Example 2
run keyword if '${TEST_NAME}' == "Example 2"
... log this is example 2!
Upvotes: 2