question

bondo avatar image
bondo asked bondo answered

anyone know a way to switch between the built-in TCL and external TCL on the fly for file operations. I need to use "file normalize" and "file pathToURI" from the evalu action..

iTesttcl script
10 |950

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

mbarfield avatar image
mbarfield answered bondo commented

I believe the way you tackle this problem is using scriptSet/scriptGet. That's how I pass variable between the iTest and TCL shells. This is the gateway command that passes information between these two interfaces. This is how I would tackle this problem.

If you set a = 1 in iTest a = 2 in tcl shell you will get 1 and 2 respectively if you do a puts in either shell.

Wrap your work into a QuickCall and you should be good. I think John had it figured out with the scriptSet but may have had some garbage in the path.

Also, if you want to clean up the output from a stored response use this command [response varName]. I use that method all the time because I can tell it's a variable from a stored response.

Example testcase:

passdatabetweenitestantclshells.fftc


1 comment
10 |950

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

bondo avatar image bondo commented ·

yes that works. now the scriptSet and scriptGet go to the TCL 8.4 and not JACL

0 Likes 0 ·
bondo avatar image
bondo answered

The problem I have with all this is that there is no way to control or predict if TCL or JACL will be used even when I have the preferences set to use TCL.

10 |950

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

bondo avatar image
bondo answered amichaels commented

only problem is that every type of iTest step does not support directing what TCL interpreter to use. I can't force the "eval" command to use the JACL or TCL 8.4 or TCL 8.5 interpreters.

1 comment
10 |950

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

amichaels avatar image amichaels ♦ commented ·

You're correct. Basically, do all your calculations in the iTest interpreter context and when you want to send data, use the ScriptSet action. Or, pass in your data using ScriptSet and then do your processing in the tclsh session.

0 Likes 0 ·
bondo avatar image
bondo answered

@amichaels I don't understand why JACL is still running. The uriToPath should not be working at all with TCL 8.4. We can do a webex now it you lilke.

10 |950

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

amichaels avatar image
amichaels answered

Hmmm... I still can't replicate the situation you're seeing, where you have what appears to be the full structured data of the response. I've run this on multiple machines, different versions of iTest and even different platforms. At this point, barring a webex, I'd take @gretztx's recommendation and strip out the first item of the list in the response.

10 |950

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

bondo avatar image
bondo answered

this is the session profile

tclsh.ffsp


tclsh.ffsp (523 B)
10 |950

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

bondo avatar image
bondo answered

one problem is that I have TCL 8.4 selected in my preferences, JACL is still running.


10 |950

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

gretztx avatar image
gretztx answered amichaels commented
  1. @bondo, a quick and dirty "fix" would be to add this line right after the uriToPath command
  2. eval set path [lindex $path 0]
6 comments
10 |950

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

bondo avatar image bondo commented ·

@gretztx

That worked! I'm still looking at that and I don't understand how it works. I would have never thought of using lindex command to escape backslashes.

0 Likes 0 ·
amichaels avatar image amichaels ♦ commented ·

The lindex command isn't escaping the backslashes. It's removing all the other list items from the response so that you only have 1 instance of the path.

0 Likes 0 ·
bondo avatar image bondo commented ·

@amichaels

Oh, that makes sense. I still do not understand why I get all that extra stuff that you do not.

0 Likes 0 ·
amichaels avatar image amichaels ♦ bondo commented ·

Well, I'd be happy to hop on a webex to check it out on your environment if you're interested. That is bizarre.

0 Likes 0 ·
bondo avatar image bondo commented ·

Andy got a chance to view my bizarre iTest behaviours.

0 Likes 0 ·
amichaels avatar image amichaels ♦ bondo commented ·

Yes, that machine is acting weird. Can you run that testcase on another VM? I'm betting it will work. As mentioned in our conversation, this is best followed up with support. I'm guessing they'll recommend a re-install of iTest 5.1, but I'll leave it to them. Good luck!

0 Likes 0 ·
amichaels avatar image
amichaels answered bondo commented

Also, are you using iTest 5.1?

1 comment
10 |950

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

bondo avatar image bondo commented ·

@amichaels

yes 5.1

0 Likes 0 ·
amichaels avatar image
amichaels answered

What are your Tcl interpreter Prefs?


tclsh-prefs-1.png (23.0 KiB)
tclsh-prefs-2.png (23.9 KiB)
10 |950

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.