Competing and/or Complementary Patterns of Script Design

For a (long) while the phrase Page Object has been floating around the periphery of knowledge, but it wasn’t until today that I actually looked it up and actually figured out what it is. And now that I have that knowledge, it seems to me that there are (at least) 3 different patterns for creating a (Selenium) script.

  1. Feature Flow – These are the classic type of scripts where you automate a flow through an application in a long series of steps.

    selenium.type(“Search”, “monkey”)“sButton”)

    For additional maintainability and reuse, you will evolve things to include helper methods/fixtures. I would guess that the vast majority of scripts are of this type.
  2. Page Object – If Feature Flow is ‘functional’ programming, then Page Objects are OO. The webdriver project (which is what is going to power Selenium coming version 2.0) has what appears to be the definitive reference on Page Objects. Essentially, each Page is an Object.

    myPage = searchPage()‘monkey’)

    with all the implementation details are tucked into the search method code.
  3. DSL – This method is an abstraction layer on top of the implementation details which typically makes the script more consumable by non-technical persons, but also to hide lots of details from technical persons that they don’t want to worry about either.

    go_to search_page
    search_for monkey

What I realized is that they are not really exclusive. You can use bot Feature Flows and Page Objects as the underlying logic for a DSL. And in fact, the implementation details that are encapsulated in the Page Object methods will look like Feature Flow code.

There has got to be other patterns also out there that I haven’t heard of. But what are they?

Post a Comment

Your email is never published nor shared. Required fields are marked *