Slideshare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our User Agreement and Privacy Policy.

Slideshare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our Privacy Policy and User Agreement for details.

3.
“I must create a system. or be
enslav'd by another Mans; I
will not reason & compare:
my business is to create”
William Blake, 1820
Jerusalem: The Emanation of the Giant Albion
3
http://www.blakearchive.org/exist/blake/archive/object.xq?objectid=jerusalem.e.illbk.10&java=no

33.
33
Sometimes it is possible to over
think this stuff
● Don't let thinking about this slow you down
● Conduct experiments
● Refactor
● Rethink if
– you are maintaining too much
– your abstraction layer stops you doing stuff
– you are 'working around' your abstraction layers

37.
Element Abstraction Pros and Cons
37
● May have to create a custom page factory
● Can help 'restrict' code i.e. check or uncheck,
rather than click, enforces 'semantics'
● If you create them...
– allow return WebElement
● so that I can go beyond the abstraction layer if I need to.
Not required if it is just a WebElement wrapper.
https://xp-dev.com/svn/AutomationAbstractions

40.
40
Gherkin as an abstraction layer
Feature: We can create and edit To Do lists in ToDoMvc
We want to amend todos in ToDoMVC because that is
the set of exercises on the abstraction tutorial
Scenario: Create a ToDo Item
Given a user opens a blank ToDoMVC page
When the user creates a todo "new task"
Then they see 1 todo item on the page
● Implement steps using highest appropriate
abstraction layer
● CucumberJVM as 'DSL implementor'
● 'Expressibility' vs 'Step Re-use'
● See todomvc.feature and ToDoMvcSteps

41.
41
My modeling biases
● Driver
– Inject so instantiate any page or component as
required/desired at any time
● Explicit Synchronisation
– To make sure that the desired object is available
and ready for use (as defined by synchronisation)
● Navigation
– Implicit (via taking action e.g. click)
– Explicit Navigation Object, not in page object
● Open/jump (via driver.get)
● To (state model from current, to desired)

43.
43
My modeling biases
● I tend not to....
– abstract WebElements
– Use inheritence to create a model of the app
● e.g. MyAppPage extends GenericAppPage
– Use 3rd party abstractions on top of WebDriver

45.
45
Decisions
● The 'limits' and overlap of Abstraction Layers
● Build it now, or 'refactor to' later
● How much change is anticipated?
– To which layer? GUI, Business domain, Workflow?
● Who is working with the automation code?
– Skill levels? Support needed?
● How/When with the automation execute?

47.
47
Homework
● Using the code at
https://xp-dev.com/svn/AutomationAbstractions/
– Compare the different implementations under 'main'
● com.seleniumsimplified.todomvc.page
– Investigate how the Page Objects delegate to each
other, and the Domain Objects use Page Objects
– Examine the 'test' usage of the Page Objects and
Domain Objects
– Examine the different navigation approaches