froglogic / All / How can I run Squish from the command-line interface?

How can I run Squish from the command-line interface?

Interested in scheduling your test suite or scripts to run? Or want to execute your scripts from the command-line interface (CLI)?

While scripts can be run unmanned using 3rd-party integrations, they can also be executed using Squish’s CLI. To record or execute your tests from the CLI, you’ll need to know the following:

  1. squishserver location and IP address (if different than squishrunner)
  2. squishrunner location (default location: <SQUISH_PACKAGE>/bin)
  3. Test suite path

For the squishrunner to communicate with the squishserver, squishserver must be running. If squishserver is on a separate machine than squishrunner, a squishserverrc file must exist specifying allowed hosts, or reconnections from other locations (more information).


Example 1
Execute the following command from <SQUISH_PACKAGE>/bin:

  1. Unix: ./squishserver
  2. Windows: squishserver.exe

Notice: The default, or first available Squish port, 4322, displays.

Instruct squishrunner to run a test suite using the running squishserver by executing:

  1. Unix: ./squishrunner --host <IP_AddressOfSquishServer> --port 4322 --testsuite <PathToTestSuite>
  2. Windows: squishrunner --host <IP_AddressOfSquishServer> --port 4322 --testsuite <PathToTestSuite>

Note: The –port parameter can be omitted when default port is used.



Example 2
Wish to create something simple you can reuse, and easily modify to point to different squishrunner, squishserver and testsuite combinations? How about producing xml execute results and generating an HTML report? Try creating a shell or batch script:

2a: Simple Unix Shell Script
#!/bin/bash
SQUISH_RUNNER_PATH="<SQUISH_PACKAGE>/bin"
SQUISH_SERVER_HOST="<IP_AddressOfSquishServer>"
SQUISH_SERVER_PORT=4322
TESTSUITE="<PathToTestSuite>"
REPORTPATH="<PathToOutputReport>"
cd $SQUISH_RUNNER_PATH/
./squishrunner --host $SQUISH_SERVER_HOST --port $SQUISH_SERVER_PORT --testsuite $TESTSUITE --reportgen xml2.1,$REPORTPATH/report.xml
cd <SQUISH_PACKAGE>/examples/regressiontesting/
./squishxml2html.py --dir $REPORTPATH/HTMLReports $REPORTPATH/*.xml
open $REPORTPATH/HTMLReports/index.html

2b: Simple Windows Batch Script

NOTE: This script requires python installed to convert the report from XML to HTML. PYTHONPATH must reflect local machine python directory.

set SQUISHPATH=<SQUISH_PACKAGE>
set SQUISH_SERVER_HOST=<IP_AddressOfSquishServer>
set SQUISH_SERVER_PORT=4233
set TESTSUITE=<PathToTestSuite>
set REPORTPATH=<PathToOutputReport>
set PYTHONPATH=C:\python27\
cd %SQUISHPATH%\bin
squishrunner --host %SQUISH_SERVER_HOST% --port %SQUISH_SERVER_PORT% --testsuite %TESTSUITE% --reportgen xml2.1,%REPORTPATH%/report.xml
cd %REPORTPATH%
%PYTHONPATH%\python.exe %SQUISHPATH%\examples\regressiontesting\squishxml2html.py --dir HTMLReports *.xml
HTMLReports\index.html
pause



Example 3
Take your script to the next level. The following script, when executed from the squishrunner directory (<SQUISH_PACKAGE>/bin), determines the squishserver path, report path, and in this case the path of a sample test suite:

#!/bin/bash
clear
echo "This script runs a Test Suite and generates an HTML report"
echo "Squish Server must be running in advance"
echo "Script assumes executed from <SQUISH_DIR>"
echo "Press Ctrl+C at any time to terminate script"
read -p "Press any key to begin"
MY_PATH="`dirname \"$0\"`" # relative
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolute and normalized
if [ -z "$MY_PATH" ] ; then
# error; path is not accessible
exit 1 # fail
fi
echo "$MY_PATH"
SQUISH_RUNNER_PATH="$MY_PATH/bin"
SQUISH_SERVER_HOST="192.168.2.10"
SQUISH_SERVER_PORT=4322
TESTSUITE="$MY_PATH/examples/java/addressbook/suite_py"
REPORTPATH="$TESTSUITE/results"
cd $SQUISH_RUNNER_PATH/
./squishrunner --host $SQUISH_SERVER_HOST --port $SQUISH_SERVER_PORT --testsuite $TESTSUITE --reportgen xml2.1,$REPORTPATH/report.xml
cd $MY_PATH/examples/regressiontesting/
./squishxml2html.py --dir $REPORTPATH/HTMLReports $REPORTPATH/*.xml
open $REPORTPATH/HTMLReports/index.html

For more information, read:

Command-line Tools For Image Comparisons
Automated Batch Testing
KB: Automated, Nightly, Batch Testing
CLI Reference Guide

13 Comments

Do we execute the squish runner commands directly from Squish IDE or is there any path where we can find squishserver or squishrunner command line?

We are using Squish for web ? I am pretty munch confused what is Squish server or Squish runner? and where can we execute these Squishrunner Commands?

Eswar,

You can execute tests from the IDE manually, but if you’d like to schedule or run tests unmanned, you can use the Squish command-line interface, or one of our integrations.

More information about the Squish command-line interface, including squishrunner and squishserver can be found here: http://doc.froglogic.com/squish/latest/rg-cmdline.html#rg-cmdline

The Automated Batch Testing link (above) as well as the example above also demonstrate where and how to execute the commands.

If you need more details, please contact squish@froglogic.com for support

Hi Amanda

I have used the addAttachableAUT to specify the AUTs to attach,To verify whether this has really worked,Is there any command to see the currently attached AUTs?

Hello Tom.

The registered Mapped AUTs and Attachable AUTs are registered in “server.ini”, which by default resides in $HOME/.squish/ver1 (Unix) and %APPDATA%/froglogic/Squish/ver1 (Windows). So looking at that file you can check the registered AUTs.

You can also ask squishrunner to contact a running squishserver to get that info via “squishserver –info attachableApplications” (see “squishrunner –help” for supported options).

Please do not hesitate to contact squish@froglogic.com for technical supports requests like this.

i am unable to start the aut from command line

squishrunner –config addAUT “my application” “C:\my application””
squishrunner –testsuite “E:\MYTests\UIAutomationTests” –aut “my application”

error:
Warning: runApplication: AUT my does not exist

    Another thing:
    there is a space in my application name. Even if its in double quotes its not working

Hello shibani rout.

The commands that you have pasted above contain different types of double quotes.

Unfortunately operating systems and related software are a bit narrow minded about the types of double quotes they like to use, therefore can you please try again, but this time use “normal” double quotes (this is a normal double quote: ” and these are not normal double quotes: ” “).

Then, after registering the Mapped AUT, please double check the corresponding Mapped AUT entry in the server.ini file (which by default resides in $HOME/.squish/ver1 (Unix) and %APPDATA%/froglogic/Squish/ver1 (Windows).

If it still does not work please copy and paste the complete commands that you used and their original output, as well as the server.ini file contents here.

Thank you.

With best regards

Clemens Anhuth

squish IDE 6.3.0 is not able to find the Andriod emulator running from andriod stuidio 2.3.3 Can you please tell me what issue might be there ?

    Hello Tahir. Can you please contact our technical support regarding your technical problem? Thank you!

Is there a way to trigger or start suishserver remotely in windows/Linux before starting to execute test cases. Do you have any command line interface for it?

    Hello Arunkumar Vikram.

    Yes, there is a mechanism:

    Step 1: Set up your computer to log in automatically.
    Step 2: Make it so that a squishserver instance is being started automatically after log in.
    Step 3: Use that automatically started squishserver instance via the RemoteSystem API to execute arbitrary commands:

    https://doc.froglogic.com/squish/latest/rgs-squish.html#rgs-remotesystem

Leave a Reply

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

Copy link
Powered by Social Snap