Skip to content
mmerrell edited this page Apr 20, 2012 · 1 revision

Overview

The Page Generation process is generally going to be the same for any project--parse, build, generate--but the details for each project are going to differ wildly. This code is meant to start a "conversation" between you and your application developers, in the hopes that, even if you can't use what we've produced here, the developers can get a glimpse into what is possible.

This process worked extremely well where it was initially developed. What we seek to accomplish through the TastyMonster platform is to provide a common language and set of patterns so that any project can accomplish the same goals.

The page generation happens in 3 phases:

  1. Gathering Page Information
  2. Building the Model
  3. Generating the Files

The PageGenerator class manages each of these phases, either operating on default behavior, or by allowing you to implement your own version of the various phases. Undoubtedly, most of the parsing won't work out of the box, but if you don't mind our imposing our WebElement/WebDriver and Page Object patterns on you, the file generation phase should work pretty well.

Phase 1: Parsing

You implement your version of the process that gets a list of files to be parsed--this phase merely calls that implementation, validates that the files are accessible, and builds them into a List

Phase 2: Building the Model

The Parsing phase iter ates over each file gathered in Phase 1. The file is handed to a ParserFactory, which analyzes the file and returns the appropriate parser (this is where you might need to implement your own parsing behaviors).

If everything checks out and is "parse-able", a Model is built--a set of PageInfo objects gathered into a hierarchy that is meant to represent the current state of your presentation layer. This metadata will then be handed to Phase 3

Phase 3: Generating the Files

Using Velocity as the generation engine, the Generation process iterates over the PageInfo objects and uses a combination of techniques to produce a 1:1 WebDriver Page for each page in the PageInfo set