Testing same named AUTs in Squish

We often get asked what is the best approach for testing two AUTs with same name in Squish.

Consider an example where a user wants to test two different versions of an AUT located at two different paths and both AUTs are calledfoo.exe.

The information about the registered AUTs is stored in the filesquishserver.ini found at %APPDATA%\froglogic\Squishver1\server.ini (Windows) or “$HOME/.squish/ver1/server.ini” (Unix)).

The registered entry for AUT foo version in the file squishserver.ini looks like below:
AUT/foo = “C:\applications\version1”

After registering the AUT foo for version2 in squish, the previously registered entry for foo.exe version1 will get overwritten by the entry for foo.exe version2. The registered AUT entry for foo in thesquishserver.ini will now look like below:
AUT/foo = “C:\applications\version2”

This causes only the last registered AUT to be tested, and switching between the two AUTs requires re-registering the AUTs each time which can be inconvenient.

The following approach can be taken to testing different versions of an AUT with same name:

One can write an alternative function to startApplication() which takes an absolute path to some executable. This alternative function (startExecutable() in our example below) first registers an AUT by calling squishrunner and then launches it via startApplication() :

function startExecutable(path)
{
    // Split given path into directory and filename components by looking for last backslash
    var lastSlash = path.lastIndexOf('\\');
    var directory = path.substring(0, lastSlash);
    var fileName = path.substring(lastSlash + 1);
    
    // Register AUT in squishserver by invoking squishrunner
    OS.system("\"" + OS.getenv("SQUISH_PREFIX") + "/bin/squishrunner\" --config addAUT " + fileName + " " + directory);

    // Launch AUT
    return startApplication(fileName);
}

function main()
{
    startExecutable( "C:\\applications\\version1\\foo.exe" );
    snooze(1)
    // Or: startExecutable( "C:\\applications\\version2\\foo.exe" );
}

 

0 Comments

Leave a reply

Your email address will not be published. Required fields are marked *

*