Executing test scripts via Windows Tasks (Scheduler)

Last edited on

Overview

Test scripts can be executed via Windows tasks, but the following requirements must be met. How to set up a task in Windows is explained in many places on the internet, so this article does not cover that part. (A decent article explaining setting up tasks is How to Automatically Run Programs and Set Reminders With the Windows Task Scheduler, and here is Microsoft's take on it: Schedule a task.)

General requirements

(Also see Automation on Windows for more details.)

Requirements for Windows XP

Run only if logged on

The task setting “Run only if logged on” must be enabled:

Set HOMEDRIVE and HOMEPATH environment variables

The batch file starting squishrunner/squishserver must explicitly set the environment variables HOMEDRIVE and HOMEPATH correctly.

Example - Explicitly setting HOMEDRIVE and HOMEPATH:

set HOMEDRIVE=C:
set HOMEPATH=\Documents and Settings\MyUser

...
test.bat

Example - Setting HOMEDRIVE and HOMEPATH based on USERPROFILE (avoid hardcoding a specific path):

set HOMEDRIVE=%USERPROFILE:~0,2%
set HOMEPATH=%USERPROFILE:~2%

...
test.bat

Without these environment variables the following error appears in the output of squishserver:


  • This is an UNLICENSED version of Squish. Please install your *

  • license key provided by froglogic. For assistance, please *

  • contact squish@froglogic.com *


Requirements for Windows 7

Run only if logged on

The task setting “Run only if user is logged on” must be enabled: