Handling differences between implicit AUT start and startApplication()

Last edited on

Overview

The test suite settings allow to specify that the application should be started automatically, and which parameters should be passed to the application.

Without automatic start setting the test script must contain either attachToApplication() or startApplication() function calls to start or attach to an application.

However, when using startApplication() the application gets started without the parameters specified in the test suite settings.

Fortunately such additional parameters can be specified with startApplication():

def main():
    startApplication("addressbook testdata.dat")
test.py

Problem: Redundancy of parameters across test scripts

When there are 10 test scripts and each of them passes the same parameters to the application, then a change of this parameter would require to change all 10 test scripts.

To avoid this redundancy shared scripts can be used to declare one or more functions which perform the startApplication() call with the desired parameters.

Example:

source(findFile("scripts", "shared_functions.py"))

def main():
    start_addressbook_with_testdata()
test.py
def start_addressbook_with_testdata():
    startApplication("addressbook testdata.dat")
shared_functions.py

Problem: Using parameters specified in test suite settings

You may also be using the parameters specified in the test suite settings. In that case you might want to read those parameters from the file suite.conf in the test suite settings.

For this you should use the respective file I/O functionality of the scripting language that you use.

squishInfo.testCase (for retrieving the path to the current test case; use squishInfo.testCase + "/../suite.conf" to refer to the file suite.conf of the current test suite)