creating static image lists to be used in all scripts

I have over 500 scripts that test diffrent aspects of a GUI platform. From release to release those image formats change and new captures must be added to reflect changes in the GUI. I am looking for ideas to combat this.

I would like to create a script that has all the image lists used in my testing. In that way I can update the script that has the list and all my scripts would be updated.

for example:
MyScript1.script {
set imageList = ImageLib.getImageList("myImageList")

if AnyImageFound(imageList) then
click FoundImageName()
end if
}

ImageLib.script {

function getImageList listName
if listName = "myImageList" then
return "image1"&&&"image2"&&&"image3"
end if
end getImageList

}

any sugestions?

Comments

  • One strategy is to create a suite of images only, name it something like "Version_5_Images.suite", and then load that suite either via setting it as a helper in Eggplant's UI (so all scripts can use) or doing "opensuite" (if you want to localize usage to a particular script).

    Barry
  • The strategy that Barry mentions is the one we use, and it works quite well. We have several subsets of the same app and we keep the images in a suite and load that suite when we need it.
  • JonathanOSXJonathanOSX ForumAdmin admin
    If you have a list of image names ("image1", "image2", "image3") you can't pass that directly to Eggplant commands that expect a collection of individual parameters, like the ClickAny command.

    The solution is to use the "as parameters" syntax to convert the list to a set of parameters, so your code might look like this
    set imageList to ("image1", "image2", "image3",...)
    ClickAny imageList as parameters
    

    This isn't an answer to your overall strategy but a technique that you can use to handle lists as they relate to Eggplant commands.
  • Jim--

    Is something like this even easier? If order doesn't really matter, you'd not even need to edit a script when you add images to your new images. You could even separate things even more finely if you wanted.

    Just drop all your images into a suite, then run a script that builds a list:
    to handle getImageList
         
         //ask for a suite/folder
         answer folder "What suite would you like to process?"
         put it & "/images" into folderPath
    
         put the files of folderPath into fileList
         
         //build the list and filter out unwanted files
         repeat with each item theFile in fileList
             if theFile ends with ".tiff" then --remove *.imageinfo files
                insert theFile into imageList
             end if
         end repeat
         return imageList
    end getImageList
    
    

    NOTE: I haven't tried this code yet. It does compile :wink:

    Hope this helps.
  • the as parameters works great!

    thanks for the input
Sign In or Register to comment.