froglogic / Blog / Tip of the Week / Starting Your AUT Using Absolute Paths in startApplication()

Starting Your AUT Using Absolute Paths in startApplication()

To start an application in a Squish test script using startApplication(),


(where name refers to an entry in the server.ini file), one registers the AUT with its absolute path in the file server.ini, as opposed to hard-coding the path in the test script, and modifying the paths in your test script according to the actual path to the AUT on the current computer.

(For information on how to register the AUT in the Squish IDE manually please see our documentation).

However if you have ten computers, then you need to do this registration step on each of the computers.

In our support work with our customers, we often find it useful to provide the following script snippet to our customers where we specify the path of the addressbook example application directly in startApplication():

startApplication(os.getenv("SQUISH_PREFIX")+ "/examples/qt/addressbook/addressbook")

In this snippet, the function startApplication() is provided the path to the addressbook example application which is retrieved from os.getenv() by reading the environment variable “SQUISH_PREFIX.” (It contains the path to the Squish installation; Squish sets this environment variable for the AUT processes). And, it concatenates the path to the addressbook application in the examples, which is always the same in all Squish binary packages.

The advantage of this approach when sending script snippets to our customers is that they can copy and paste the script snippet into a test case without having to go through the extra step of registering the application first.

You, too, may have cases where you may need to retrieve the path from an environment variable or from a text file or some other source. In such a case, it maybe useful for you to use the above approach.

Or, if you have an application which is in the same path on all of your computers, then you can provide it directly to startApplication():


Leave a Reply

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

Copy link
Powered by Social Snap