Ottomate is now an open source project (BSD license) on Google Code!
With Mac OS X 10.4, Apple introduced a fabulous new application for graphically configuring automated Workflows called Automator.
Automator allows Mac users to drag and drop discreet, self-contained pieces of functionality from different OS X applications called Actions into a repeatable, savable Workflow. Building an Automator Workflow is roughly akin to graphically crafting an automated script -- without writing a single line of programming code!
That's where the OttoMate Web Test Actions come in... This suite of six Automator Actions contains everything you need to graphically configure automated, repeatable user-acceptance tests for web-based applications. No Computer Science degree required!
The OttoMate Actions serve as an engine for Apple's best-of-breed web browser, Safari -- running your web application through its paces by commanding Safari to visit your site, click links and buttons, fill out and submit web forms, and assert the existence of success pages, titles, text or HTML source code. All while you watch the results live on your Mac's screen. The OttoMate Actions can even ask Safari to evaluate arbitrary JavaScript code against your webpage.
Next » The Actions
Before reading about the individual OttoMate Actions, it's important to understand one thing... All of the OttoMate Actions read or affect the webpage in the current frontmost Safari window. That means that before the OttoMate Actions "Do Their Thang", two steps must be taken:
- Safari must be running -- although it need not be the frontmost application
- Your target webpage must already be loaded into the frontmost Safari window
Automator already ships with Safari-targeted Actions that can accomplish loading your wepage into a Safari window (and much, much more). The OttoMate Actions do not attempt to duplicate this functionality.
So when creating an Automator Workflow that will include the OttoMate Actions, you'll likely want to use the Safari Get Specified URLs and Display Webpage [screenshot] that ship with Mac OS X to start your Workflow. After those Actions get your automated test rolling, then you add the OttoMate Actions (described next) to implement your specific web test functionality.
Enough already! Tell me about the OttoMate Actions!
Configure OttoMate Workflow
Use Configure OttoMate Workflow to specify Unix scripts for handling errors or assertion failures encountered during your Workflow's execution. These Unix scripts can send email, alert users, or do anything you like. This Action also allows you to specify the time delay between running each OttoMate Action.
Assert Attributes of Current Webpage
With Assert Attributes of Current Webpage, you can assert the existence or equivalence of many aspects of the current frontmost Safari webpage. Specifically:
- Assert page title equals a given string.
- Assert page has an element with a given HTML id attribute.
- Assert page contains a given string of text.
- Assert page contains a given string of HTML source code.
- Assert page has a link with a given string of text.
- Assert page has a link with a given HTML id attribute.
- Assert page has a link with a given HTML href attribute.
- Assert page has a form element with a given id and value.
- Assert page has a form element with a given name and value.
Set Form Values in Current Webpage
Use Set Form Values in Current Webpage to insert test values (valid or invalid) into the forms in your web application during the Workflow's execution. This Actions allows you to select which form elements in which to set values by specifying either HTML id or name attributes.
Click Link or Button in Current Webpage
Navigate your webpage by asking the Click Link or Button in Current Webpage to click a link or a form submission button. You can select the link or button to click via its HTML id or its text.
Do Specified JavaScript in Current Webpage
This aptly-named Action allows you to evaluate arbitrary JavaScript code against the webpage in the frontmost Safari window as a part of your automated Workflow. This arbitrary JavaScript code can both inspect features of the page or alter portions of the page -- via access to the current DOM document tree just as in normal JavaScript files or <script> blocks.
So how exactly does Do Specified JavaScript in Current Webpage fit into a Workflow? Where does this arbitrary JavaScript code come from?
Do Specified JavaScript in Current Webpage requires the preceding Action in the Workflow to provide executable JavaScript code (Text) as output. That text may come from any source the preceding Action is able to access and pass as output to the next Action... Do Specified JavaScript in Current Webpage doesn't care where the text comes from. Existing Actions that provide text output come to mind...
- TextEdit's Get Specified Text Action [screenshot]
- Finder's Get Specified Finder Items along with BBEdit's Open Files in BBEdit Action [screenshot]
- Safari's Get Specified URLs and Get Text From Webpage Actions [screenshot].
Wait for Condition in Current Webpage
Use this Action to test Ajax features. This Action is similar to Assert Attributes of Current Webpage, but allows you to wait a specified amount of time before failing if a condition is not met in the current webpage.
Next » FAQ