Automation on Windows

Skip to end of metadata
Go to start of metadata

Table Of Contents

Overview

There are several situations in which test scripts will hang and time out on Windows.

All of these revolve around the availability (or lack thereof) of a "screen" to draw/paint the application on. The basic problem is that if the GUI of the application cannot be drawn, then its objects do not have coordinates on the screen, and so Squish cannot find out where to perform a mouse click, for example.

One symptom for these test script execution problems is the following error message in the log:

The AUT '' did not respond to network communication. Maybe it's stuck in an endless loop?

Solutions

There is only one solution unfortunately, and it consists of meeting all of the following requirements:

  • Only have one logged in user on Windows.
  • Run test scripts as the currently logged in user on Windows.
  • squishserver is not running as a Windows service, and it is not being started from a Windows service. (That is, start it yourself in cmd.exe for example.)
  • The screen saver is disabled. (Enabled and active screen saver causes test scripts to hang and time out.)
  • Desktop is not locked. (After locking the desktop test scripts hang and time out.)
  • Power save mode is disabled (no turning off the screen, no suspend to ram or suspend to disk).
  • No logins via Remote Desktop (RDP) are made. (Using RDP only works as long as the RDP client is logged in and its window is not minimized. After disconnecting or minimizing the RDP client the test scripts will hang and time out.)

It is possible and suggested to use a virtual computer (VMware, Virtual Box, etc.) for this, because (in contrast to a real computer with a logged in user) access to its mouse and keyboard is secured.


Suggestions for Windows setups

The following suggestions aim to avoid several problems when setting up a Windows computer for executing test scripts.

Suggestion #1 - Automatically log in a user on Windows

To avoid manually logging on to the Windows computer an automatic login should be configured.

Aside of other ways to configure this, this can be achieved by using Windows' AutoLogon feature. See Autologon for Windows.

Suggestion #2 - Automatically start applications via "startup"

To automatically start applications after log in Windows provides the "startup" folder. In here one can start Jenkins, squishserver, Bamboo, etc. anything one wants basically. It works simply by placing a shortcut (not a copy!) of the desired .exe, .bat, etc. into this folder.

For more information see How to Make a Program Run at Startup on Any Computer.

Suggestion #3 - Alternative to Remote Desktop (RDP)

Since RDP is known to cause test script execution problems (connecting and disconnecting or minimizing the RDP client window causes test scripts to hang and time out), VNC is a general alternative to Remote Desktop (RDP) for remote control and can be used as an alternative to Remote Desktop.

Unlocking the Console when using RDP

In case an RDP connection has been made, the console of the computer can be brought into the state prior to the RDP connection by executing these commands (administrator rights typically required):

Windows XP:

Windows 7 and higher:

(Also see Remote Desktop Connection Without Locking Remote Computer Session on Disconnect and RDP disconnect and NOT lock session?.)

Suggestion #4 - Disabling RDP optimization when minimized

There is an optimization setting in RDP which applies when the RDP client is minimized. Because a connected but minimized RDP client window also causes test scripts to hang and time out, disabling the optimization setting can be desirable.

To configure this for the current user only:

  1. Run the regedit.exe tool
  2. Find the registry key HKEY_CURRENT_USER\Software\Microsoft\Terminal Server Client.
  3. Create a DWORD value with the name RemoteDesktop_SuppressWhenMinimized and set its value to 2.
  4. Now find the registry key HKEY_CURRENT_USER\Software\Wow6432Node\Microsoft\Terminal Server Client.
  5. Create a DWORD value with the name RemoteDesktop_SuppressWhenMinimized and set its value to 2.

To configure this for all users:

  1. Run the regedit.exe tool
  2. Find the registry key HKEY_LOCAL_MACHINE\Software\Microsoft\Terminal Server Client.
  3. Create a DWORD value with the name RemoteDesktop_SuppressWhenMinimized and set its value to 2.
  4. Find the registry key HKEY_LOCAL_MACHINE\Software\Wow6432Node\Microsoft\Terminal Server Client.
  5. Create a DWORD value with the name RemoteDesktop_SuppressWhenMinimized and set its value to 2.

Suggestion #5 - Disabling Mouse Cursor Animation

Animating the mouse cursor when replaying tests via RDP connections is known to cause problems. We recommend disabling mouse cursor animation in the server settings:

1. In the IDE, open the server settings dialog by selecting Edit -> Server Settings in the menu bar
2. Select the 'Playback' section in the list at the left.
3. Ensure that the checkbox labelled 'Animate Mouse Cursor' is not checked.

Further information

The above information applies to starting Squish from Windows services, too. Continuous integration tools like Hudson, Jenkins, and others are often set up as Windows services, so the above applies to these installations too.

Also see Animations causing screenshot verification point failures.

Related information

Labels:
screensaver screensaver Delete
lock lock Delete
screen_lock screen_lock Delete
rdp rdp Delete
windows_service windows_service Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.