How to parameterize the "Variable Condition" field in the "TestFlowLogic" of "Execution Options" tab
I want to parameterize the Variable Condition field present inside Scenario >> Execution Options >> Test Flow Logic >> Variable Condition. I want to take the value from "Environments" or "Data Sources". The traditional way of specifying "${some_variablename}" is NOT working
Answers
-
The "Variable Condition" field does not currently support parameterization. However there is another way to do this. Instead of parameterizing the variable condition, you could instead set the variable condition to the value "true", and then in an Extension Tool at the beginning of your test scenario you could set the value of the variable based on an environment variable. When you want the test to run you set the variable to "true", and when you don't want the test to run you set the variable to "false". Here is example Groovy code you can put into an Extension Tool that will do this:
import com.parasoft.api.*; public void setVariables(Object input, ScriptingContext context) { String envVarValue = context.getEnvironmentVariableValue("shouldRun"); context.setValue("shouldRunVar", envVarValue) }
0 -
You can do that by using the same name for the datasource variable and the variable used in the condition
1