Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Abstraction Layers Test Management Summit Faciliated Session 2014


Published on

Slides for a 70 minute facilitated session at the test management summit 2014 by Alan Richardson

Published in: Software
  • Be the first to comment

Abstraction Layers Test Management Summit Faciliated Session 2014

  1. 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. 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. 3. Automation Abstractions A Test Management Summit Facilitiated Session Alan Richardson @eviltester
  4. 4. 4 Blogs and Websites ● ● ● ● ● Twitter: @eviltester Online Training Courses ● Technical Web Testing 101 ● Intro to Selenium ● Selenium 2 WebDriver API Videos Books Selenium Simplified Java For Testers Alan Richardson Independent Test Consultant & Custom Training Contact Alan
  5. 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
  6. 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. 7 Example Test Without Abstraction @Before public void startDriver(){ @Test public void canCreateAToDoWithNoAbstraction(){ driver.get(""); int originalNumberOfTodos = driver.findElements( By.cssSelector("ul#todo-list li")).size(); WebElement createTodo = driver.findElement("new-todo"));; createTodo.sendKeys("new task"); createTodo.sendKeys(Keys.ENTER); assertThat(driver.findElement("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. 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. 9 Why Abstraction? ● Change implementations ● Single Responsibility – only changes when necessary ● Makes automation readable and maintainable
  10. 10. 10 Common Automation Abstractions ● Page Objects ● Element Abstractions: select, textbox, etc. ● Domain Objects ● Gherkin (Given/When/And/Then) ● Domain Specific Languages
  11. 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. 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. 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. 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. 15 Decisions, Decisions What Design Decisions have you made? ● Page Object Design Decisions? ● Navigation Decisions? ● Tool Layers? ● What rules do you have?
  16. 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. 17 Success, Success, Success ● What worked well? ● What did you change to get it working well?
  18. 18. 18 Possibilities, Possibilities ● What have you yet to try? – Anyone with experience of that?
  19. 19. 19 End Notes Proceed no further, lest ye want to finish
  20. 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