Tests changing location

We have an automated system which checks out automation into some job-centric location (changes with each run of the test) and runs the tests, the results of which are reported under the job number.

This poses a problem for Eggplant tests as far as helpers are concerned. Eggplant has hard-coded paths to helpers.

The ideal solution would be to have helpers use relative paths. This does not seem possible through the standard Eggplant means. I have successfully whacked the helperSuites strings in the SuiteInfo file using relative paths. “Relative path” in Eggplant seems a little capricious. I was able to find a relative path that worked for a simple test case, but I am worried that the idea of relative doesn’t always mean the same thing in Eggplant. That is, the answer to “Relative to what?” seems to change during an Eggplant run.

The other solution we can come up with is to have the automation whack the hard-coded helperSuites strings with the appropriate path for where the automation has decided to put things during a run. Our trouble here is that the automation is checking things out onto a linux file system on a separate machine. There seems to be at least two ways to mount this external file system on the Mac: 1) bsd’s mount command, 2) Finder.

I am afraid this is one of those posts that will be ignored because it seems just too weird or complex to answer. :slight_smile: But I would appreciate any pointers or hints.

My questions are:

  1. Can we tell Eggplant to use relative paths to helpers within Eggplant itself?
    1a) What does ‘relative’ mean in Eggplant? Are all helperSuites during a run relative to the same location (like where the original script launched from? or what?)
  2. How is it best to mount an external linux file system so that I can hackishly change the SuiteInfo helperSuites strings myself. The bsd mount solution sets a path like: /data/mydir/123456, which is great. But using the Finder to map a network drive sets a path like: /Volumes/SOFTWARE;SC-NAS-1/mydir/123456, which is weird.

Thanks!
-edj

  1. Can we tell Eggplant to use relative paths to helpers within Eggplant itself?

For Helpers included in the Helper Tab of a Suite it is not possible to make them relative at this time. However you can dynamically add Helpers during script execution by using the command

openSuite(HELPER_PATH)

This is fully documented in the Eggplant Reference manual and might allow you to overcome this situation of having a changing work environment for your scripts.

1a) What’s it relative to?

At the beggining of each script run the current working directory is set to your Default Suite Directory as specified in the Generel setting under Eggplant Preferences.

This can be changed by doing a “set the directory to ____” command.

Everytime Eggplant goes to call a script in a helper it will resolve it by referencing “the directory”.

Some quick tests suggest that this will work for modifying the Suite Info file in this way but we haven’t fully testing Eggplant in that scenario.

  1. Best way to mount

Well the Finder is just doing a mount command itself - you should see it using a ps command. But for a situation such as this I think you are best off crafting your own mount command, it will be much easier to add the command directly to any scripts if you decide to go that route in the future and it will be much more portable between versions of Mac OS X.

Hopefully that get’s you going for now, let us know if you have any additional questions.

openSuite() and set directory to look promising. We’ll go down that path and see where it leads.
Thanks for your help!
-edj