Article - Executing external applications

Skip to end of metadata
Go to start of metadata

Table of Contents

Executing external applications

The RemoteSystem Object API provided by Squish can be used in test scripts to execute external applications, access files and directories, etc. locally as well as remotely.

Executing external applications asynchronously, non-blocking, in the background

Commands for executing external applications are typically executing the desired application synchronously, which means that Squish test script execution will not proceed beyond that command until the external application has exited again.

This default behaviour allows for easy synchronization with the external application, but may not always be desired.

To start an application with, say, OS.system() in the background, there are different approaches that can be used on Windows and Unix.

On Windows:

On Unix:

(The use of start and the & character are the "standard" ways to start applications asynchronously on Windows and Unix respectively.)

Using functionality built into the scripting languages

All of the following mechanisms are being provided by the respective the scripting languages and the external process is always being always on the computer where the Squish IDE or squishrunner are being executed.

JavaScript

Since squishrunner is executing the test scripts, the following mechanism will execute external applications on the same computer where squishrunner is being executed.

The Squish JavaScript interpreter provides the OS.capture() and OS.system() functions.

test.js

Perl

Since squishrunner is executing the test scripts, the following mechanism will execute external applications on the same computer where squishrunner is being executed.

Perl provides the system() function.

Python

Since squishrunner is executing the test scripts, the following mechanism will execute external applications on the same computer where squishrunner is being executed.

Python provides the os.system() function, and also the subprocess module.

test.py

Ruby

Since squishrunner is executing the test scripts, the following mechanism will execute external applications on the same computer where squishrunner is being executed.

Ruby provides multiple mechanisms (5 ways to run commands from Ruby), and the simplest is the one based on backticks:

Tcl

Since squishrunner is executing the test scripts, the following mechanism will execute external applications on the same computer where squishrunner is being executed.

Tcl provides the exec and open functions.

Labels:
None
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.