Open files on SUT?

Hi Community,

I’m new and have a problem; maybe wrong understanding.

I write following code:


put "~/Desktop/" into pdfPool
put the files of pdfPool into fileList
repeat with each item of fileList
	put pdfPool & it into pdffile
	if pdffile ends with ".pdf" then
		open pdffile with "Preview"
	end if 
end repeat

If I execute this code, all is good (on my machine). But I will open files on the SUT machine and when I change

put "~/Desktop/" into pdfPool

to

put "~/Desktop/pdfPool" into pdfPool

it doesn’t work because this folder exists only on the SUT machine.

Is my understanding wrong and how I can solve my problem?

I can navigate over the file open dialog but my pdf files are created automatically and the name isn’t unique to capture it.

Regards,
Rene

Rene,

Nothing in SenseTalk is designed to directly affect the SUT. The commands described in the Eggplant Reference manual however, can interact directly with the SUT but from the user interface only. However, you can use the file system commands to operate on files on the SUT if you first mount the SUT’s file system on the Eggplant machine.

If the remote filesystem is mounted on the local machine (using “Connect to Server…” from the Go menu in the Finder) then the remote files will be available to the script just like local files. In this case, you would need to replace “~/Desktop/” with the path to the mounted file system.

If you need to, you can even mount the SUT’s file system dynamically from within a script by using the “shell” command to run the Unix mount command. There are actually two steps required: 1) create a directory (usually in /Volumes) to provide a mount point and 2) execute the mount command with the appropriate options. This code creates a mount point, mounts a local Mac OS X server on my machine, and then unmounts it:

make directory “/Volumes/serverMount”
shell “mount_afp afp://username:password@SUTmachine/SUTVolume /Volumes/serverMount”
if the result is not equal to 0 then
logError “Could not mount server”
exit all
end if

– Perform SUT File System Operations Here

shell “umount /Volumes/serverMount”
if the result is not equal to 0 then
LogWarning “Server was not unmounted”
end if

Note that the “umount” command (and no, it’s not “unmount”) removes the directory you created for the mount point, as does any other method of unmounting the volume, so you’ll need to recreate the directory each time you need to run the mount command (you might want to make that a function or helper script).

Thanks for answer but I have some questions to understand Eggplant/SenseTalk/SUT and so on. :oops:

First:
If I mount the SUT machine in my Eggplant machine and then I open a file e.g. with "open pdffile with “Preview”. (pdffile is a PDF file on the mounted file system [SUT]) then it will be opens on my machine and not on SUT to testing with programs.

Second:
I have problems with interactions; second situation.
On my SUT I have a folder structure, e.g
Folder
Program
Version 1.0
Version 1.1
Version 1.3
Version 5.0

How can I open the last folder? I can’t capture any picture because the last folder name generates automatically.

I will use Eggplant to testing my programs.
On the first step I will test the installer (folder structure problem in second case). Then I will test my plugin with any test files (problem in first case). These cases are preparatory work before I can test the dialogs from my program with pictures/screenshots.

I hope any people known my problem respectively my understanding problem. :oops:

Thanks,
Rene

If I mount the SUT machine in my Eggplant machine and then I open a file e.g. with "open pdffile with “Preview”. (pdffile is a PDF file on the mounted file system [SUT]) then it will be opens on my machine and not on SUT to testing with programs.

Yes, you are correct. Opening a mounted file within Eggplant would open the file with Preview on the same machine that Eggplant is running on: not your test machine.

How can I open the last folder? I can’t capture any picture because the last folder name generates automatically.

Provided that each image for the folder in question looks identical, you could do an everyimageLocation(“folder”) to get a list of coordinates for each folder. Since Eggplant will search the remote screen from top left to bottom right, the last set of coordinates in the list will correspond to the location of the last folder that was created.

For example:

// folderImage is just an image of the folder with the name of the
// folder omitted
put everyimagelocation(“folderImage”) into coordinates

// provided that the contents of the directory that Eggplant will be looking
// at is in a column view open the very last folder
DoubleClick last item of coordinates

Instead of mounting the file on the Eggplant machine you could feasiblly use this same method to open a PDF on the test machine thereby allowing you to use Eggplant’s image search capability to verify the contents of the PDF file.

THANKS, I understand my problem (slowly). :slight_smile:

Your example code is that what I need and this helps me. Now I can testing something. :wink:

Regards,
Rene