I’d like to know whether it is possible to show Eggplant GUI while I’m running the est script from command line. Reason is because I want to see the progess of the test script run, rather than checking the final result at the end of the run.
I have added this line “Show RemoteWindow” as the first line in my script, and I ran my test script with this command: /runscript /. I observed that all the test steps were executed in the background and Eggplant GUI was not launched. I’m not sure whether “Show RemoteWindow” is the right way to go for…Can anyone please advice? Thanks!
There’s a better way to approach this, using a previously-undocumented feature of Eggplant. The way this works is that instead of using the “runscript” command to run Eggplant in command line mode, you will launch the full GUI version of Eggplant.
When you launch Eggplant from the command line in GUI mode this way, there are a different set of parameters that you can pass to the application. The -RunOnLaunch parameter lets you tell Eggplant to run a script automatically when it starts up. The -QuitAfterRun option tells Eggplant to quit after it finishes running the script. By using both of these options you can achieve similar functionality to using the runscript command, but with Eggplant running from the command line in full GUI mode.
So, instead of this (assuming Eggplant is installed in /Applications):
you could write:
/Applications/Eggplant.app/Contents/MacOS/Eggplant -RunOnLaunch /path/to/my.suite/Scripts/myScript.script -QuitAfterRun yes
There are a couple of other options that may be useful. The -ReopenDocuments and -RestoreConnection options can be used to override Eggplant’s usual startup behavior (as set on the General Preferences pane) as to whether it will reopen previously open documents and/or connections. Just follow each of those options with “yes” or “no” (you may want to specify “no” for both of these when running in this way).
NOTE: The -RunOnLaunch and -QuitAfterRun options are available only in Eggplant FT, not Eggplant SE.
Yes, using this command does help to resolve my problem: /Applications/Eggplant.app/Contents/MacOS/Eggplant -RunOnLaunch /path/to/my.suite/Scripts/myScript.script -QuitAfterRun yes.
On the other hand, I notice that if there’s an image unable to detect in the run, Eggplant will not be able to close the pop-up dialog. It will stay there until I manually close it.
If I run Eggplant script using /Applications/Eggplant.app/runscript /path/to/my.suite/Scripts/myScript.script, Eggplant GUI will not stay there at the end of the run even though it encounters the same image-not-found failure.
So, my question is: Can we instruct Eggplant to close any unexpected pop-up dialog by using additional option in /Applications/Eggplant.app/Contents/MacOS/Eggplant -RunOnLaunch /path/to/my.suite/Scripts/myScript.script -QuitAfterRun yes?
Your wish is our command – you can use this argument to prevent alert dialogues from script failures.
How can I cache return code when running Eggplant from command-line? What does this code mean?
When running in the traditional command-line mode (runscript) Eggplant will return the number of successful executions as the return code of the process.
However when using the GUI mode (launched from CLI) as described here you won’t get that return value. To determine if your scripts were successful you’ll need to either look in the logs or have your scripts post some type notification (email, URL, write a file) as they exit.