Automation on Windows

Last edited on

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:

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) in cmd.exe ("Command Prompt"):

powershell "exit [System.Diagnostics.Process]::GetCurrentProcess().SessionId"
tscon %errorlevel% /dest:console

Note #1: tscon.exe is only available in some Windows editions, and typically not in Windows Home.

Note #2: A batch file with the above commands, but which also interactively requests elevation (in case it is required) can be downloaded here (plain text version here ).

Also see:

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 .