question

Kudo avatar image
Kudo asked Kudo commented

can't loop the session open because of session name.

Hello,

I want to loop the session open like this:

eval set i 1

open:device1, session name:s$i

for {i = 1} {i <= 10} {i++}{

telnet [param xxxx] -b [param xxxx]

}

However, it doesn't work because session name do not accept a variable.

In test cases, when I set a variable, case editor said me [x], but the variable was expanded correctly in execution mode. Though, the parameter had not expanded in this case...

So, I'd like to ask you guys how can I do the session opening loop.

please help

Regards,

Kudo

iTestsession profilehowto
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.

Kudo avatar image Kudo commented ·

sorry, that was typo. correct:

proc {

for {i = 1} {i <= 10} {i++}{

open:device1

action:command, session:s$i

telnet [param xxxx] -b [param xxxx]

}

}

in addition, i have to keep open sessions.

0 Likes 0 ·

1 Answer

·
JeffJ avatar image
JeffJ answered Kudo commented

When you make the session name a variable, iTest cannot determine the name of the session to associate the session type. In this case, you must specify the default type manually. To do that, highlight all the steps that use the variable session, open the step properties and set the "Advanced -> Default Session" to a default session (usually a base session profile).

A cleaner way to do this is to put the steps in the "for" loop in a procedure and pass the loop count to the procedure. Then all you need to do is set the default session type in the General metadata for the procedure. This will also provide you with the ability to do this in parallel much easier if you want to hit all the sessions simultaneously.

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.

Kudo avatar image Kudo commented ·

Dear JeffJ,

Thanks for the help, my problem is solved.

thank you very much!

Kudo

0 Likes 0 ·

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.