Obtaining values from images

The app which I want to be tested with Eggplant is a backup client. What I want to verify is that the backed up folder has the same size and the same number of files like the original folder has. In the Client’s UI there are displayed the size and also the number of files, so I want to compare these values with the values obtained from XRay (for example). Could you give me a hint?


There are a couple of different ways you might go about this. The most common approach that we recommend for verifying values on the SUT is to script Eggplant to select the value and copy it, then use the RemoteClipboard() function to access the copied value within your script.

If that approach won’t work because the data can’t be selected and copied (although many things can be, even in places where you might not expect it) you could use generated text images. This is more work than the clipboard approach, but it can work provided you know the answer you expect to see. Generate a text image of the expected answer, and look for that image in the expected location (set the searchRectangle to a slightly larger area around that location). If the generated text image is found, you’ll know you got the answer you were looking for.

For your specific situation, an even better approach may be to mount the two file systems locally on your Eggplant machine, and use SenseTalk’s file system access functions to compare them. Keep in mind that these functions (described in the “Working with Files and File Systems” chapter of the SenseTalk Reference manual) work only on the local machine (not the SUT), but can also work with any locally-mounted file systems on the network.

Using the Files() and Folders() functions will give you lists of the files and folders in a folder. You can ask for the “number of items in” each of these lists, and you can also access information about each file including its size.

I hope that one of these approaches will work for you.