Beyond Content and back into Structure
I’m working with a client right now whose site is primarily a content delivery mechanism and whose revenue source is advertisement around that content. In Automating Content-Based Systems I talked about how it is important to ignore the HTML structure of the page (there are four un-ordered list items in this section of the page), instead checking that the content of the page is correct (the four un-ordered list items in this section of the page are the correct four un-ordered list items in this section).
But now I’m starting to come round full circle and thinking that the structure is perhaps just as important as the content. From a script design perspective. Don’t worry, I’m not completely contradicting myself on this as content is still the thing that matters from an oracle perspective.
One pattern I realize I had not explicitly noticed before is that ‘content’ apps tend to have a number of reusable modules. (And those modules can be in turn consumed into larger modules, etc.). When designing your automation you need to understand what these modules are — and which content oracles apply to each. The automation will then take the form of:
- For each page…
- …check that it has the correct modules…
- …in ish the right spot…
- …with the right content.
Once you realize this, a whole bunch of duplicate code can be wiped out by using your Runner’s data-driven capabilities to iterate over a series of URLs and check their content. Or if you are even luckier you checking a module on a single page might be enough to validate it application wide for still less code and even less time to execute. (You just need to ensure that the modules are configured correctly on all pages a different way then; perhaps by just interrogating the database.)
Unless you are using tags to dynamically create suites. Then you still need to create a method per page you care about even if it is going to be 98% identical to all the other methods. I still haven’t figured out how to force the various Runners to jump through that particular flaming hoop (that also has swords sticking through it).