I'm not quite sure what you are asking, so I have a few answers 🙂
Can you use a variable as a parameter value, yes.
Can you give a variable a default value, yes.
Can you have the test default the parameter value "if I give you a value, use that, otherwise use the default", no.
Show us what you tried that didn't work and we can help fix it. It's usually easier and quicker to get you an answer if you share specifics.
The parameter input will be URL 1, 2 or 3 (from a variable)
I can insert the var in the execution plan and all is good
but I would like the default/fallback value to be URL3
can I do this, I don't appear to have the option to input this here
Now I can see what you are trying to do.
That looks like something you should ask Support about. Seems like there ought to be a variable choice in there as well.
Here's the support link
Still waiting for TC to answer but it looks like this is not possible.
You can either
- pass in a variable to a NON OPTIONAL parameter
- test for an empty parameter and assign it a variable
Parameter default value
|Optional||Specifies whether the parameter is optional, that is, if it can be omitted when the test is called from another test. Optional parameters must have a default value.
@Marsha_R I have closed the TC ticket as they didn't understand the question
I think my solution above is the best approach
I won't bother to raise this as a feature request at this time - it took me lots of messages for them to NOT understand what you grasped in 1
You can add a new table variable to your KW and fill it with values. Then, in KW itself, give the condition "if then" where to check the value of the parameter "URL" If no url is specified, take a value from the variable as default value.
I myself often run KW tests with default parameters and there are different solutions for this. I'm just offering a one of ideas.
Thanks for the idea
The basics of it is:
- Smartbear don't understand the question
- can't be done in KW by default but this is quite easy to address but you have to 'program' a solution for this yourself and, more importantly, remember to do it everytime it is needed
It looks like there indeed was a misunderstanding from our side - my apologies for that.
As for this particular task, it looks like you have found a solution that works best for you. Just as a theoretical alternative, I can also suggest using the project variable in the keyword test directly so that the parametrization only takes place once.
As for the inability to achieve the task without using code, you can register it as a feature request here: https://community.smartbear.com/t5/TestComplete-Feature-Requests/idb-p/TestXCompleteFeatureRequests.
SmartBear Customer Care Manager - TestComplete