The Top App Development Trends Shaping the Industry in 2024-25 .pdf
Abstraction Layers Test Management Summit Faciliated Session 2014
1. 1
Automation Abstractions
Do you suffer from brittle automation? Are your tests slowing down
as they age? Do you find your tests hard to read? If so, you, and
your team, might be suffering from IAA.
Inadequate Automation Abstraction (IAA) afflicts many teams.
An obsession with a single layer of abstraction? Beliefs such as
"Everything goes in a feature file", or "Everything is a Page
Object". Do you suffer from excessive 'given when and then'?
IAA takes many forms. Together we will explore the common
manifestations we've seen. And the steps we took to help teams
break their dependence on inadequate abstraction.
Some of you may even be in the grip of IAA now. Don't worry. We
can help you too.
We will adopt a spirit of openness and inclusion. We attach no
shame to IAA. We will help you work through it. Alternative
possibilities are open to you. All of our trained facilitators are ex-
IAA sufferers; they understand, and they can help.
2. 2
Automation Abstractions: The plan
10:00 – 11:15 (75 mins)
● I have code and slides I can show
● You could sit and listen to me talk for 75 minutes
OR
(and this is really what the summit is all about)
● You let me talk for 15 mins to set the scene with a whistle stop
tour of automation abstractions
● Then we have a “facilitated discussion” for 60 mins
– Your: Experiences, Approaches, Lessons
Learned, Biases, Opinions
3. Automation Abstractions
A Test Management Summit Facilitiated Session
Alan Richardson
@eviltester
alan@compendiumdev.co.uk
www.SeleniumSimplified.com
www.EvilTester.com
www.CompendiumDev.co.uk
www.JavaForTesters.com
4. 4
Blogs and Websites
● CompendiumDev.co.uk
● SeleniumSimplified.com
● EvilTester.com
● JavaForTesters.com
● Twitter: @eviltester
Online Training Courses
● Technical Web Testing 101
Unow.be/at/techwebtest101
● Intro to Selenium
Unow.be/at/startwebdriver
● Selenium 2 WebDriver API
Unow.be/at/webdriverapi
Videos
youtube.com/user/EviltesterVideos
Books
Selenium Simplified
Unow.be/rc/selsimp
Java For Testers
leanpub.com/javaForTesters
Alan Richardson
uk.linkedin.com/in/eviltester
Independent Test Consultant
& Custom Training
Contact Alan
http://compendiumdev.co.uk/contact
5. “I must create a system. or be
enslav'd by another Mans; I
will not reason & compare:
my business is to create”
5
William Blake,
Jerusalem: The Emanation of the Giant Albion
http://www.blakearchive.org/exist/blake/archive/object.xq?objectid=jerusalem.e.illbk.10&java=no
6. 6
Abstraction
● Modelling
● Separation of concerns
● Logical vs Physical
● Functional vs Structural
● Interfaces vs Implementations
● Data / Entities / Persistence
● Functionality / Task Flow
● Goals / Strategies
● Layers – GUI, DB, HTTP
● Etc.
7. 7
Example Test Without Abstraction
@Before
public void startDriver(){
@Test
public void canCreateAToDoWithNoAbstraction(){
driver.get("http://todomvc.com/architecture-examples/backbone/");
int originalNumberOfTodos = driver.findElements(
By.cssSelector("ul#todo-list li")).size();
WebElement createTodo = driver.findElement(By.id("new-todo"));
createTodo.click();
createTodo.sendKeys("new task");
createTodo.sendKeys(Keys.ENTER);
assertThat(driver.findElement(
By.id("filters")).isDisplayed(), is(true));
int newToDos = driver.findElements(
By.cssSelector("ul#todo-list li")).size();
assertThat(newToDos, greaterThan(originalNumberOfTodos));
}
driver = new FirefoxDriver();
}
@After
public void stopDriver(){
driver.close();
driver.quit();
}
8. 8
Example Test With Abstraction
@Before
public void startDriver(){
@Test
public void canCreateAToDoWithAbstraction(){
TodoMVCUser user = new TodoMVCUser(driver, new TodoMVCSite());
user.opensApplication().and().createNewToDo("new task");
ApplicationPageFunctional page =
new ApplicationPageFunctional(driver, new TodoMVCSite());
assertThat(page.getCountOfTodoDoItems(), is(1));
assertThat(page.isFooterVisible(), is(true));
}
driver = new FirefoxDriver();
}
@After
public void stopDriver(){
driver.close();
driver.quit();
}
9. 9
Why Abstraction?
● Change implementations
● Single Responsibility – only changes when
necessary
● Makes automation readable and maintainable
10. 10
Common Automation Abstractions
● Page Objects
● Element Abstractions: select, textbox, etc.
● Domain Objects
● Gherkin (Given/When/And/Then)
● Domain Specific Languages
11. 11
Abstraction != Implementation
● Abstraction != Tool / Framework /
Implementation
● Gherkin != Cucumber
● Page Object != Page Factory
● DSL != Keyword Driven
If we want to get good at abstraction then we
need to model, split apart, and make the
relationships clear
12. 12
Throwing it open to the floor
The following slides are to aid discussion only,
and may not be needed – that depends on you.
13. 13
Common Automation Abstractions
● Page Objects
● Element Abstractions: select, textbox, etc.
● Domain Objects
● Gherkin (Given/When/And/Then)
● Domain Specific Languages
● Any More?
– Create a List to discuss
– Any public examples?
– Any examples in the room that can be shared?
14. 14
Problems, Problems, Problems
What problems have you seen?
● Can you respond to change?
● Is your framework hard to learn?
● Who hates it?
● Do you suffer from intermittent execution?
● Who maintains it?
● Automation Technical Debt?
15. 15
Decisions, Decisions
What Design Decisions have you made?
● Page Object Design Decisions?
● Navigation Decisions?
● Tool Layers?
● What rules do you have?
16. 16
Biases and Mandates
What Mandates have your decisions led to?
● All automation must use Given/When/Then?
● Execution layer is Gherkin? No xUnit?
● Page Objects must never return other Page
Objects?
● Never pass Domain Objects into Page Objects?
● Never add an assert to the abstraction layer
● Never use implicit waits
17. 17
Success, Success, Success
● What worked well?
● What did you change to get it working well?
19. 19
End Notes
Proceed no further, lest ye want to finish
20. 20
“To the creative mind there is
no right or wrong. Every
action is an experiment, and
every experiment yields its
fruit in knowledge.”
The Illuminatus Trilogy
Robert Anton Wilson