question

takabanana avatar image
takabanana asked ericnute edited

Programatically checking to see if a session is open?

Is there a way to programatically check to see if a session is open?

I've got an issue where the session (i.e. SSH) gets closed by the host sometimes - and I need to be able to check for that and re-open the connection to continue what I am doing.

Thanks.

 

iTestsession
10 |950

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

1 Answer

·
JeffJ avatar image
JeffJ answered JeffJ posted

I would recommend changing the global event to take care of this.  When a session closes, you're going to get an "OnSessionNotOpen".  The actions taken by this even are predefined but you can change them.  You can change them for the step, testcase or session.  In your case, I'd suggest the testcase.

 

To find these, click on the "Global Events" tab at the bottom of the test case editor view.  Then in the search box, type "OnSessionNotOpen".  If you click on the event in the tree, you'll see the actions defined by default for that event.  Uncheck the "Inherit" box and you'll be able to change these actions.

 

In your case, you'll most likely want to add a CallProcedure action to a procedure that will reopen the session.  You may also want to consider a "RepeatStep" action to rerun the step after reopening it.

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.