A framework for EP (and really any tool or programming language) should really be as organic as possible. You really should be thinking of creating your domain-specific language through eggplant handlers. I could give you my framework, but it will not really work for you, as you’ll soon see.
If you’ve not yet learned about handlers, you really need to read through Chapter 4 of “Using Eggplant” and Chapter 9 of the SenseTalk Reference.
This is gonna sound a bit complex at first, but after I show you a couple of examples, it should make sense.
The framework that we’re creating is essentially 2 parts: Images and Handlers. We have one suite of images for each platform we support (10.4, 10.5, XP and VISTA). We’ve written a set of handlers (SUT utilities) that connect to a machine, detect what OS is running on it (storing it in a global variable), logs in, and loads the correct image suite and handler scripts.
For handlers, we have several different kinds, we keep them in several scripts based on their function. We’ve written handlers that make sense within our domain. For example, we have lots of menus, so we wrote a handler called clickMenu. We have handlers to click checkboxes, buttons, open files, etc. So instead of:
click (Text: "File")
click (Text: "Open")
typeText "MyFile.mus"
typeTExt ENTER
Click (text: "File")
Click (text: "Export")
if imageFound(cb_xml)
clickFoundImageLocation()
end if
typeText "Myfile.xml"
typeText ENTER
Click (text: "File")
Click (text: "close")
Click (text: "File")
Click (text: "Exit")
if imageFound(bt_SaveChanges)
clickFoundImageLocation()
end if
Note all the duplicated code above. Wit our framework, we’d do:
openFile "myFile.mus"
exportXML "MyFile.xml
closeFile "NO" --don't save any changes
exitApplication
We arrived at this point by noticing how much duplicated code we have. We named handlers so that anyone working in our system can understand it.
So in short, you’ll have to figure out what things you do over and over, and extract those into handlers. We also created handlers to generate reports, which is much easier now with the XML support added to SensteTalk in EP4.