Eggplant scripts execution from command line

Hi All,

Does Eggplant provide the facility to run scripts from Command Line???

I want to run scripts from command line. Can anyone help me with sample code :?:

Pages 104 and 105 in the Eggplant Reference Manual, available online within the Eggplant Purple application package, or from the Redstone Software Documents page…

http://www.redstonesoftware.com/Download/Eggplant

http://www.redstonesoftware.com/docs/manuals/index.html

describe in detail the ‘runscript’ command which comes with Eggplant Purple.

  1. Type the full path of the Eggplant application, followed by /runscript and a space.
  2. Type the full path of a script to run.
  3. For each additional script or suite, insert a space, then type the full path to the script or suite.

Example:

/Applications/Eggplant.app/runscript /path/to/aSuite.suit /path/to/script.script /path/to/script2.script

Eggplant saves the resutls of each script run in the Results folder for that script’s suite. Then, after all scripts and suites have finished running, Eggplant reports the number of successful scripts and suites back to the command line. (A suite is successful if every script in it is successful).

NOTE: for more details about the Eggplant Purple CLI ‘runscript’ command, please download the aforementioned manuals which include hundreds of Sensetalk and Eggplant examples.

Thanks Todd.

I tried the execution from CL as per your reply and manual reference, and could successfully perform the same. :lol:

Currently i’m planning to write a script which can take input for suite/script to be executed with parameter like number of time to repeat and after completion ofexecution, open the results log file.

Can you help me in this regard with a sample code to perform the above.

You will want to use the -params function to pass parameters to your script. One such example of this has just been added to the FAQ
http://www.redstonesoftware.com/phpBB2/viewtopic.php?p=1931#1931.

You can either use the -repeat argument to repeat ALL of your scripts or pass an argument that you can use internally in your script for a repeat loop.

As far as opening the result file. It’s a little unclear what you would want to open it in. When Eggplant is run from the CLI it’s user interface is not launched and so the CLI Eggplant isn’t going to be able to actually open the results. You could output the filename by using something like

write logfile of the last item of scriptResults()

and then open it in a text editor.

Hi,

Is it necessary that the scripts/suite that we want to execute be in the machine that we run from?

Currently i have following setup:

Machine 1: SUT / runs VNC server
Machine 2: used for developing scripts/saving scripts
Machine 3: want to run scripts for command line here

should scripts in Machine 3 also?

thx in advance.

-veena

Absolutely not. But do keep in mind that it’s sharing resources (specifically Images and other scripts) from within the suite so I would recommend that if it’s network mounted that it be a fast local network mount.

Thx. But i’m still kinda confused.

Should the system where my suites are should be mounted on the machine where i want to execute scripts from command line?

Can i just rlogin or ssh to the system and execute the scripts?

-veena

You can absolutely rlogin or SSH to a system to execute scripts but then they will be executing FROM that remote system. So it needs to be a Mac, with a licensed copy of Eggplant, VNC connections will come from that machine, etc.

Here is an example using your setup where the Eggplant process would be running on machine #2.

machine3% ssh machine2 "/Applications/Eggplant.app/runscript ~/mysuite.suite"

The alternative is to make the suites on machine #2 accessible (via shared file system or network mount) and then actually run them on machine #3. Something like this:

machine3% /Applications/Eggplant.app/runscript /Volumes/machine2/Users/me/mysuite.suite

Hi Jonathan,

I tried method 2 i.e mount the appropriate volume and execute the following on cli in a terminal window on machine 3:

/Applications/Eggplant.app/runscript /Volumes/user/Documents/mysuite.suite

Result:
without host/port details :
Connection failed - error resolving host is displayed with status of the scripts in the suite as failed.

With Host/Port details:
Following appears in the sequence below-
Connection is established - Screen size 1440 * 900
/Volumes/user/Documents.mysuite.suite - StartUp.script
Trying to connect to vnchost
Connection Failed: Error resolving host vnchost

Note: Scripts in the schedule tab already have the connection information.

Please advise.

-Veena

It sounds to me like a DNS configuration issue on machine 3.

First I would look in System Preferences->Network-> to make sure that the TCP/IP settings for your network are the same as they are on the other machines you run from.

Specifically that the DNS Servers and SearchDomains values match.

If that doesn’t solve it then you can specify a full IP address, or possibly just use a full domain name (ie vnchost.mycompany.com)

Thx Johnathan.

Giving ip address instead of name in the schedule tab did the trick.
Now, although I was successful in executing a simple suite, when i try to execute scripts in a suite which has a helper suite (to store all the images) then it is not able to find the images.

Is there anything to be done if we have a helper suite to run from cli?

Helper suite refers to path : /Users/myUser/Documents/mysuite

on the machine that I have the scripts saved.

please advise.

-Veena

Unfortunately at this time the Helper Suites are absolute references so you will need to make sure that the helper suite can be found at the exact same location on Machine #3 that it is referred to on the original machine. Sometimes that is easiest to do by making appropriate links.

Let us know if that doesn’t solve your problem.

Yes that helped. Thanks!

I guess we need to do the same for any external data/output files that we might have.

-Veena