In SVT, the rules for variables were that of TCL. Is that true in iTest? For example, in SVT, you could set _foo {bah}, and then reference
^{e:$foo}. What about iTest?
In SVT, the rules for variables were that of TCL. Is that true in iTest? For example, in SVT, you could set _foo {bah}, and then reference
^{e:$foo}. What about iTest?
iTest still supports Tcl integration if you prefer to use that. In iTest, the equivalent to ^{e:$foo} is now [tclexpr {$foo}]. And the equivalent of ^{t:set foo bar} is [tcl {set foo bar}].
However iTest now has its own data model and procedural context independent of Tcl. This make a lot of new things possible while also simplifying the syntax for a lot of common cases. The syntax for accessing the iTest commands and data model is identical to Tcl. (But it is important to understand that iTest's data model and commands are not Tcl.)
In most string properties in iTest, you can use field substitution like you can in FanfareSVT, but now you use Tcl's syntax for these substitutions rather than the proprietary syntax used in FanfareSVT. So where you used to say, for example,
Session: s1
Action: command
Command: show interface $portNumber
where in FanfareSVT, you would have used
Command: show interface ^{e:$portNumber}
And if you want to fetch a parameter, for example, in iTest, you now say,
Command: show interface [param port_number]
where in FanfareSVT you would have said
Command: show interface ^{p:port_number}
One of the ways in which this improves things is that the syntax in FanfareSVT becomes complex or ambiguous where you get into nested substitutions. And combining that with expression logic made it almost impossible to decode in FanfareSVT. With iTest, it becomes simpler. For example, you might want to perform some more complex logic in the substitution like:
Command: show interface [expr [param $port_param_name] + $i * 2]
O, be some other name! What's in a name? that which we call a rose
By any other name would smell as sweet;
So _foo would, were it not underscore started.
Hmm. According to http://www.w3schools.com/XML/xml_elements.asp:
So, _foo would be ruled out by the second rule.
iTest has its own concept of variables and uses tcl syntax to set them. So you can still set a variable by doing:
set foo 1
But to access these, you do not have to do ^{e:$foo}. You simply type $foo where you want to use the variable.
Note that you can still use a tcl interpreter to store your variable by using "scriptEval" action. Then there are two ways to get the variable to and from tcl intepreter to iTest: using scriptGet and scriptSet actions. See iTest help for more details on these. You can also use command called [tcl ...] to execute any tcl command and get its results as a field substitution.
No one has followed this question yet.