question

erlane avatar image
erlane asked erlane commented

Is it possible to reopen a session using only the session ID?

TL;DR:

1. Can you get the device from the session ID (i.e. "S1" to "device:DUT")?

2. How can I check if a session is closed and reopen it without using OnSessionNotOpen?

I have inherited a large base of iTest test cases. We are having problems with the devices they are testing crashing. I need a way to reopen sessions to these devices using nothing more than the existing session ID. This is because they seem to crash in one of the testcase's library calls and I only have access to the session ID (i.e. "s1").

Furthermore, I need a way to check if a session is open and if not reopen it. Unfortunately due to the design of the system I have it is not feasible to do this on a OnSessionNotOpen event.

Any help would be greatly appreciated.

iTestsessionsession id substitution
2 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.

amichaels avatar image amichaels ♦ commented ·

Can you describe the limitation that prevents you from using the "OnSessionNotOpen" event?

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

The reboot time of the remote device is non-deterministic. Our architecture is more suited to retry connections as needed rather than detour as a reaction every time a session is closed. if the OnSessionNotOpen event was triggered each time an attempt was made on the session that would be different, but it is not. The event is only triggered once for a given connection.

Theoretically I could set a global variable if the OnSessionNotOpen were thrown and check it later, although that isn't the most ideal nor efficient of solutions. (Plus it would require countless code changes so I wanted to be sure there wasn't another way before made the time investment)

0 Likes 0 ·
JeffJ avatar image
JeffJ answered erlane commented

You are correct. If the session didn't open, the information is not available via the session name.

One idea here is using a "ping" from the host executing the iTest test case or from another device in the topology. Once you issue the reboot, you can close the session, ping the device 4 or 5 times and repeat that until you get a successful ping. Then you can reopen the device and take off from there.

You could put that in a separate procedure and call that from the event as well. This really depends on how your test cases have been architected and if the reboot is intentional or a result of a device failure.

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.

erlane avatar image erlane commented ·

So to clarify, the solution is to react immediately when a session closes or to ping all devices at set intervals. iTest has no method of "remembering" which sessions were open?

0 Likes 0 ·
amichaels avatar image
amichaels answered

Hi! I don't think there's a way to do what you describe. The only way that iTest knows that a session is closed is by trying to communicate with it, and receiving an error. Typically, we would use the OnSessionNotOpen event as you noted.

Someone can correct me if I'm wrong, but I don't think we can re-open a session based on the ID in the "Session" column of the test case editor.

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.