[eggPlant Functional] Scripting through a SUT restart

The code below demonstrates the method for scripting through the restart of a Windows system; you’d do something similar for other operating systems.

-- store the current connection information to use as the argument to the connect command later
put connectionInfo() into myConnection
-- do restart here
repeat while connectionInfo().connected is "true"
	-- make sure the connection has been closed by the remote system
	wait 1
end repeat
-- now try to reconnect
repeat while connectionInfo().connected is "false"
		connect myConnection
		-- make sure the machine has really restarted
		-- the vnc server seems to spring back to life momentarily during shutdown
		if not imageFound("StartMenu")
			next repeat
		end if
		wait 5.0
	end try
end repeat

The Windows OS presented a complication that required a couple of workarounds. The VNC server was running as a service and it seemed to persist into part of the shutdown process. So the connection would be dropped initially, but a reconnect could be made briefly while the machine was shutting down. So to ensure that a successful connection had taken place after the restart, I had to add a visual confirmation that the Start menu was displayed. If it is not, I assume that I’ve reconnected during the shut down, force a disconnect, and return to the beginning of the repeat loop.

When I copied and pasted this into a script, it did not understand the word “is” next to False. (Although it did understand it next to “true”.)

When I pasted it as Plain Text, and hit Tab, everything worked. :?:

Can anyone else reproduce that?

There was a stray character in that line – I’ve removed it and you should be able to do a direct copy/paste and have it work. Thanks for mentioning that.

tried this code out, and it didn’t work.
It looks like ConnectionInfo is empty after a Connect fails, so the test for false fails.

Changed the code as follows:

repeat while connectionInfo().connected is “false”


repeat while connectionInfo().connected is not “true”

This behavior was apparently changed at some point in the 8 years since this code was originally posted. It had worked in 2009 and for some time after that. Your fix works, so I guess just go with that.