How to run multiple SUT with the same script at the same tim

Hi All,

I’ve a license with 4 connections. Now I would like to run the same script at the same time for 4 SUTs.

Please help.

Thanks

Hi, Buffalo:

You’re going to want to run these instances from the command line, probably from a shell script. But first, you may want to make your results clearer by creating four new scripts that each contain just a single line that calls the script that you want to run. You might name these based on the SUTs that you are going to run against, or you could just number them or use whatever naming scheme works for you. When you run them, they will all be executing the same code, but each one will generate its own results folder.

With that done, you should create your shell script. Open a text file and enter the commands for running each script (see pages 125-127 of the Eggplant Reference). You can specify the SUT that each script will run against in the command or you could put a Connect command with a different SUT in each of the four scripts that you created above. Assuming you decide to specify the SUT on the command line, your text file will look something like this:

/Applications/Eggplant.app/runscript ~/Documents/MySuite.suite/MyScript1.script -host 192.168.1.10 -password pword &
/Applications/Eggplant.app/runscript ~/Documents/MySuite.suite/MyScript2.script -host winSut3 -port 5902 -password mypass &
/Applications/Eggplant.app/runscript ~/Documents/MySuite.suite/MyScript3.script -host buffalo2 &
/Applications/Eggplant.app/runscript ~/Documents/MySuite.suite/MyScript4.script -host 192.168.1.84 -password omelet -port 5901 &

The ampersands (&) at the end of each line indicate that the command should be run “in the background”; this means (among other things) that the shell will not wait for one command to complete before running the next command.

Save the text file.

TIP: If you save the file with a “.command” extension and make it executable, you can run it by double clicking it in the Finder.

To run your commands, open a terminal window and run your shell script using the sh command:

sh MyShellScript.txt

This should create an instance of Eggplant for each runscript command, connect to the designated SUT, run the script code, and exit.

Note that these commands will not run at exactly the same time and there is no way to predict in exactly what order they will be run. There will also likely be some differences in the amount of time it takes for each instance of Eggplant to establish a connection to its designated SUT, and the response times for the SUTs will also produce some variability. So you will not likely see all 4 machines clicking on the same button at exactly the same time, but they should all be executing within a few seconds of each other.

Let me know if you have any trouble making this work or if there are other questions that we can help you with.

Regards,
Matt

Matt,

Thanks so much for your help. It works. However, I’d like to know if there a way to run the script from command line in visible mode instead of background mode.

Best Regards,

No, when run from the command line there can be no visible component of the interface. If you want to see all of the instances executing, you can create copies of the Eggplant executable (a script that makes this easy to do is available at http://www.redstonesoftware.com/phpbb2/viewtopic.php?t=25). Make 3 copies, open these and the original executable, and connect each one to a different SUT. You’ll still want to use the scripts suggested in the previous response to generate different result sets. Have each of your Eggplant instances run a different script.

There’s a Mac OS X shortcut that you may find useful: Hold down the Option and Command keys and click on one of the Eggplant icons in the Dock. This will show the application that you clicked on and hide all of the other applications. Doing this will make it easy to move from one instance to the next to start the scripts running or to view their progress.

My question for the above scenario is:

How can we keep track that within the same script a particular command is executed on SUT1 and the next command sent should be executed on SUT2.

In other tools, we can assign a handle/label to each connection for tracking purposes.

How that can be implemented in Eggplant?

Thanks.

To control several SUTs in sequence within a script, use the “connect” command to specify the new connection anytime you want to switch to a different SUT. You can store the connection information as a property list in a variable, which will make your script easier to read and maintain:

put (ServerID:"192.168.1.1", PortNum:5900) into SUT1
put (ServerID:"192.168.2.2", PortNum:5900, password:"preciousss") into SUT2
connect SUT1
-- do stuff with the first SUT
connect SUT2
-- now do stuff with the second SUT
-- etc.

Thanks for the repsonse but my conern is that:

connect SUT1
connect SUT2
connect SUT3

command1 sent to SUT1
command2 sent to SUT2
command3 sent to SUT1
command4 sent to SUT2
command5 sent to SUT3
command6 sent to SUT2
command7 sent to SUT1

Question:

How can I keep track that while I’m sending a command, it goes to the correct SUT. Is there any label or handler associated with each connection so that I can give that as input parameter alongwith the command so that it can be executed on the correct SUT.

Please respond.

Thanks.

The connectionInfo() function returns information about the current connection, which you could use to verify which SUT you’re connected to at any given time. However, to switch between SUTs you’ll need to insert connect commands before each command that needs to address a different SUT, because Eggplant only connects to one SUT at a time. So your script above would have to look more like this:

connect SUT1 
command1
connect SUT2 
command2
connect SUT1 
command3
connect SUT2 
command4
connect SUT3 
command5
connect SUT2 
command6
connect SUT1
command7

If you’ll be switching back and forth a lot like this, it may get rather cumbersome. You can do something more like what you suggested by writing your own commands and functions, and calling them instead of the standard Eggplant commands. For example, you could write a SUTClick command to use in place of the regular Click command:

params SUT, otherParams...

global currentSUT
if SUT is not currentSUT then
    connect SUT
    put SUT into currentSUT
end if

Click otherParams as parameters

This script expects the first parameter to be a property list identifying the desired SUT. The three dots (…) after otherParams causes all of the remaining parameters to be put into it as a list.

The script first checks whether we are already connected to the desired SUT. You could just issue a connect command, but Eggplant will close and reopen the connection unnecessarily if it’s the same, so checking first makes the script run more efficiently.

The last line of the script calls the regular Click command, passing it the remaining parameters.

Here’s an example of what your main script might look like using SUTClick commands (assuming that command1, etc. in the original script were all Click commands):

set SUT1 to (ServerID:"192.168.1.1", PortNum:5900) 
set SUT2 to (ServerID:"192.168.2.2", PortNum:5900, password:"preciousss")
set SUT3 to (ServerID:"212.48.9.2", PortNum:5901)

SUTClick SUT1, "command1image"
SUTClick SUT2, "command2image"
SUTClick SUT1, "command3image"
SUTClick SUT2, "command4image"
SUTClick SUT3, "command5image"
SUTClick SUT2, "command6image"
SUTClick SUT1, "command7image"

Of course, you’ll need to create “SUT…” versions of all the commands that you want to use in this way, but they can all be exact copies of the SUTClick script with only the final line changed to call the correct original command.

I hope this is helpful.

Hi,

Thanks for the repsonse.

But I do want to do this random connection and executing commands randomly on different SUTs.

Let me give you an example:

Scenario:

Three softphone applications:

  1. SP1 makes call to SP2. (Want to verify on both Soft phones if call is in connected state)
  2. SP1 initiates a conference call to SP3 which puts SP2 on hold. (Need to verify various states on all three soft phone applications)

So I will not be using like step by step commands like connect to SUT1 and then do something then disconnect then connect to SUT2 and then do something.

I want to have simultaneous active connections on 4 SUTs and would like to send different commands to different SUTs.

Q. How can I uniquely identify each connection?

Thanks.

Eggplant only allows a single connection at a time – it is not possible for a script to be connected simultaneously to more than one SUT. As things stand now, the solution I gave is probably the best you can do with a single license. With a reasonably fast machine and fast local network connections to the various SUTs you may find this is adequate for your needs.

If switching back and forth with a single-script solution is too slow for your tests, with an appropriate license you could run multiple scripts simultaneously (as discussed at the beginning of this topic) with each script controlling a different SUT. The trick then becomes one of synchronizing and coordinating actions between the different scripts. This requires some work, but it can be done by writing and reading files as a means to communicate and share information between the scripts.

If there is sufficient demand, we may consider expanding Eggplant in the future to allow multiple simultaneous connections. If other people have a need for this, we encourage you to let us know – the “Request Feature…” item at the bottom of the Help menu in Eggplant is a good way to do this.