Ce diaporama a bien été signalé.
Nous utilisons votre profil LinkedIn et vos données d’activité pour vous proposer des publicités personnalisées et pertinentes. Vous pouvez changer vos préférences de publicités à tout moment.

Screenplay - Next generation automated acceptance testing

1 202 vues

Publié le

Learn how to write robust and articulate tests using the Screenplay Pattern, an innovative approach to writing BDD-style automated acceptance tests that are easier to understand, easier to extend and easier to maintain.

Publié dans : Technologie
  • Identifiez-vous pour voir les commentaires

Screenplay - Next generation automated acceptance testing

  1. 1. @Wakaleo @JanMolak#SerenityBDD Screenplay
 Next generation automated acceptance testing AUTHOR OF ‘BDD IN ACTION’ @wakaleo www.johnfergusonsmart.com
  2. 2. @Wakaleo @JanMolak#SerenityBDD Sustainable test automation to deliver features that matter
  3. 3. @Wakaleo @JanMolak#SerenityBDD Learn Measure Build
  4. 4. @Wakaleo @JanMolak#SerenityBDD Requirements Discovery Automation and Feedback Software Craftsmanship Learn Build Measure
  5. 5. @Wakaleo @JanMolak#SerenityBDD Requirements Discovery Automation and Feedback Software Craftsmanship Learn Build Measure
  6. 6. @Wakaleo @JanMolak#SerenityBDD source: - 44% - “Out of Control - Why Control Systems Go Wrong and How to Prevent Failure” - 56% - “An Information Systems Manifesto” - 80% - “Requirements: A quick and inexpensive way to improve testing” 44-80%of all defects are caused by unclear, ambiguous or incorrect requirements
  7. 7. @Wakaleo @JanMolak#SerenityBDD Behaviour-Driven Development
  8. 8. @Wakaleo @JanMolak#SerenityBDD Behaviour-Driven Development Domain-Driven Design
  9. 9. @Wakaleo @JanMolak#SerenityBDD Domain-Driven Design Behaviour-Driven Development User-Centred Design
  10. 10. @Wakaleo @JanMolak#SerenityBDD Building the application Testing the application When we are… We model… The domain How the user interacts with the application Account Purchase Product Open an account Look for a product Completes a purchase NOUNS VERBS The key concepts are…
  11. 11. @Wakaleo @JanMolak#SerenityBDD #Devoxx HOW Enter the value ‘Get a coffee’
 
 Click on TAB WHAT Record a todo item WHY Keep a list of things I need to do
  12. 12. @Wakaleo @JanMolak#SerenityBDD Actors Goals Tasks Interactions System have involve require with the
  13. 13. Focus on outstanding items @Wakaleo @JanMolak#SerenityBDD Actor Goals Tasks Interactions Press “Enter” Type “Walk the dog” Record things I need to do Mark as complete Record an item Filter the list
  14. 14. @Wakaleo @JanMolak#SerenityBDD Feature: Filter the list to find items of interest
 
 In order to focus on outstanding items
 James would like to filter his todo list 
 to only show items of interest Scenario: Viewing Active items only
 
 Given James has a list with Walk the dog, Get a coffee
 And he completes Walk the dog
 When he filters his list to show only Active tasks
 Then his todo list should contain Get a coffee
  15. 15. @Wakaleo @JanMolak#SerenityBDD Feature: Filter the list to find items of interest
 
 In order to focus on outstanding items James would like to filter his todo list to only show items of interest Scenario: Viewing Active items only Given James has a list with Walk the dog, Get a coffee And he completes Walk the dog
 When he filters his list to show only Active tasks
 Then his todo list should contain Get a coffee Actor
  16. 16. @Wakaleo @JanMolak#SerenityBDD Feature: Filter the list to find items of interest
 In order to focus on outstanding items James would like to filter his todo list 
 to only show items of interest Scenario: Viewing Active items only 
 Given James has a list with Walk the dog, Get a coffee
 And he completes Walk the dog
 When he filters his list to show only Active tasks
 Then his todo list should contain Get a coffee Actor Goals
  17. 17. @Wakaleo @JanMolak#SerenityBDD Scenario: Viewing Active items only
 Given James has a list with Walk the dog, Get a coffee And he completes Walk the dog
 When he filters his list to show only Active tasks
 Then his todo list should contain Get a coffee Actor Goals Tasks
  18. 18. @Wakaleo @JanMolak#SerenityBDD Scenario: Viewing Active items only
 Given James has a list with Walk the dog, Get a coffee And he completes Walk the dog When he filters his list to show only Active tasks
 Then his todo list should contain Get a coffee Actor Goals Tasks
  19. 19. @Wakaleo @JanMolak#SerenityBDD Scenario: Viewing Active items only
 Given James has a list with Walk the dog, Get a coffee And he completes Walk the dog When he filters his list to show only Active tasks Then his todo list should contain Get a coffee Actor Goals Tasks
  20. 20. @Wakaleo @JanMolak#SerenityBDD Scenario: Viewing Active items only
 Given James has a list with Walk the dog, Get a coffee And he completes Walk the dog When he filters his list to show only Active tasks Then his todo list should contain Get a coffee Actor Goals Tasks
  21. 21. @Wakaleo @JanMolak#SerenityBDD Scenario: Viewing Active items only
 Given James has a list with Walk the dog, Get a coffee And he completes Walk the dog When he filters his list to show only Active tasks Then his todo list should contain Get a coffee Actor Goals Tasks
  22. 22. @Wakaleo @JanMolak#SerenityBDD Scenario: Viewing Active items only
 Given James has a list with Walk the dog, Get a coffee And he completes Walk the dog
 When he filters his list to show only Active tasks
 Then his todo list should contain Get a coffee Actor Goals Tasks
  23. 23. @Wakaleo @JanMolak#SerenityBDD Scenario: Viewing Active items only
 Start with a list containing: Walk the dog, Get a coffee And he completes Walk the dog When he filters his list to show only Active tasks Then his todo list should contain Get a coffee Actor Goals Tasks
  24. 24. @Wakaleo @JanMolak#SerenityBDD Scenario: Viewing Active items only
 Start with a list containing: Walk the dog, Get a coffee And he completes Walk the dog When he filters his list to show only Active tasks
 Then his todo list should contain Get a coffee Actor Goals Tasks
  25. 25. @Wakaleo @JanMolak#SerenityBDD Scenario: Viewing Active items only
 Start with a list containing: Walk the dog, Get a coffee Complete a todo item called: Walk the dog When he filters his list to show only Active tasks
 Then his todo list should contain Get a coffee Actor Goals Tasks
  26. 26. @Wakaleo @JanMolak#SerenityBDD Scenario: Viewing Active items only
 Start with a list containing: Walk the dog, Get a coffee Complete a todo item called: Walk the dog When he filters his list to show only Active tasks Then his todo list should contain Get a coffee Actor Goals Tasks
  27. 27. @Wakaleo @JanMolak#SerenityBDD Scenario: Viewing Active items only
 Start with a list containing: Walk the dog, Get a coffee Complete a todo item called: Walk the dog Filter list to show only Active tasks Then his todo list should contain Get a coffee Actor Goals Tasks
  28. 28. @Wakaleo @JanMolak#SerenityBDD Scenario: Viewing Active items only
 Start with a list containing: Walk the dog, Get a coffee Complete a todo item called: Walk the dog Filter list to show only Active tasks Then his todo list should contain Get a coffee Actor Goals Tasks
  29. 29. @Wakaleo @JanMolak#SerenityBDD Scenario: Viewing Active items only
 Start with a list containing: Walk the dog, Get a coffee Complete a todo item called: Walk the dog Filter list to show only Active tasks Expect to see: Get a coffee Actor Goals Tasks
  30. 30. @Wakaleo @JanMolak#SerenityBDD Scenario: Viewing Active items only
 Start with a list containing: Walk the dog, Get a coffee Complete a todo item called: Walk the dog Filter list to show only Active tasks Expect to see: Get a coffee Actor Goals Tasks
  31. 31. @Wakaleo @JanMolak#SerenityBDD Scenario: Viewing Active items only
 Start with a list containing: Walk the dog, Get a coffee Open browser on ‘todomvc.com/examples/angularjs/' Resize browser window to maximum Add a todo item called ‘Walk the dog’ Add a todo item called ‘Get a coffee’ ... Actor Goals Tasks
  32. 32. @Wakaleo @JanMolak#SerenityBDD To view Active items only, James attempts to:
 Start with a list containing: Walk the dog, Get a coffee Open browser on ‘todomvc.com/examples/angularjs/' Resize browser window to maximum Add a todo item called ‘Walk the dog’ Add a todo item called ‘Get a coffee’ Enter the value ‘Get a coffee’ Hit the Enter key ... Actor Goals Tasks Interactions
  33. 33. Software Craftsmanship Automation and Feedback @Wakaleo @JanMolak#SerenityBDD Requirements Discovery Learn Build Measure
  34. 34. @Wakaleo @JanMolak#SerenityBDD 40-70%maintenance overhead for poorly-written test suites
  35. 35. @Wakaleo @JanMolak#SerenityBDD Serenity BDD and the Screenplay Pattern
  36. 36. @Wakaleo @JanMolak#SerenityBDD Complete the requirements circle Serenity BDD and the Screenplay Pattern
  37. 37. @Wakaleo @JanMolak#SerenityBDD Serenity BDD and the Screenplay Pattern User-centric
  38. 38. @Wakaleo @JanMolak#SerenityBDD Serenity BDD and the Screenplay Pattern Reusable business DSL…in code
  39. 39. @Wakaleo @JanMolak#SerenityBDD Serenity BDD and the Screenplay Pattern Designed to scale
  40. 40. @Wakaleo @JanMolak#SerenityBDD Serenity BDD and the Screenplay Pattern in action
  41. 41. Focus on outstanding items @Wakaleo @JanMolak#SerenityBDD Actor Goals Tasks Interactions Press “Enter” Type “Walk the dog” Mark as complete Record an item Filter the list Record things I need to do
  42. 42. @Wakaleo @JanMolak#SerenityBDD Actor james = Actor.named(“James”); actor
  43. 43. @Wakaleo @JanMolak#SerenityBDD @Managed WebDriver hisBrowser; … 
 james.can(BrowseTheWeb.with(hisBrowser)); an actor has abilities
  44. 44. @Wakaleo @JanMolak#SerenityBDD james.attemptsTo(
 AddATodoItem.called("Buy some milk")
 ); an actor performs tasks
  45. 45. @Wakaleo @JanMolak#SerenityBDD @Given(“^.* has a todo list containing (.*)$")
 public void has_a_list_with(List<String> items) { james.attemptsTo( Start.withATodoListContaining(items) );
 } an actor performs tasks
  46. 46. @Wakaleo @JanMolak#SerenityBDD public class Start implements Task {
 
 @Step("{0} starts with #items")
 public <T extends Actor> void performAs(T actor) {
 actor.attemptsTo( Open.browserOn().the(applicationHomePage),
 AddTodoItems.called(items)) );
 } // ... } tasks can use other tasks
  47. 47. @Wakaleo @JanMolak#SerenityBDD public class AddATodoItem implements Task {
 
 @Step("{0} adds a todo item called: #thingToDo")
 public void performAs(Actor theActor) {
 theActor.attemptsTo(
 Enter.theValue(thingToDo)
 .into(TodoList.WHAT_NEEDS_TO_BE_DONE)
 .thenHit(RETURN)
 );
 } // ... 
 } tasks use inter- actions
  48. 48. @Wakaleo @JanMolak#SerenityBDD public class TodoList { public static Target WHAT_NEEDS_TO_BE_DONE = Target.the("'What needs to be done?' field") .locatedBy(“#new-todo"); public static Target ITEMS = Target.the("List of todo items") .locatedBy(".view label"); public static Target ITEMS_LEFT = Target.the("Count of items left") .locatedBy("#todo-count strong”); public static Target FILTER = Target.the("filter") .locatedBy("//*[@id='filters']//a[.='{0}']"); } Page Objects are much simpler
  49. 49. Automation and Feedback @Wakaleo @JanMolak#SerenityBDD Requirements Discovery Software Craftsmanship Learn Build Measure
  50. 50. @Wakaleo @JanMolak#SerenityBDD Levels of communication - +
  51. 51. @Wakaleo @JanMolak#SerenityBDD 10,000 ft
 Release Readiness - +
  52. 52. @Wakaleo @JanMolak#SerenityBDD 1000 ft
 Capabilities and Features - +
  53. 53. @Wakaleo @JanMolak#SerenityBDD 100 ft
 Scenarios and Steps - +
  54. 54. Focus on outstanding items @Wakaleo @JanMolak#SerenityBDD Actor Goals Capabilities Features Keeping the list up to date Mark as complete Record an item Remove an item Focus on important tasks Scenarios Complete a todo item
  55. 55. @Wakaleo @JanMolak#SerenityBDD Release Readiness - +
  56. 56. - + @Wakaleo @JanMolak#SerenityBDD Release Readiness Capabilities
  57. 57. - + @Wakaleo @JanMolak#SerenityBDD Release Readiness Capabilities Features
  58. 58. - + @Wakaleo @JanMolak#SerenityBDD Release Readiness Capabilities Features Scenarios
  59. 59. @Wakaleo @JanMolak#SerenityBDD ‣ “Page Objects Refactored: SOLID Steps to the Screenplay/ Journey Pattern” - DZone 
 Antony Marcano, Andy Palmer, Jan Molak, John Ferguson Smart 
 bit.ly/screenplay-page-objects ‣ “Beyond Page Objects: Next Generation Test Automation with Serenity and the Screenplay Pattern” - InfoQ
 John Ferguson Smart, Antony Marcano, Andy Palmer, Jan Molak bit.ly/screenplay-introduction Want to know more?
  60. 60. @Wakaleo @JanMolak#SerenityBDD Want to know more? Learn about Serenity:
 serenity-bdd.info Learn more about BDD and Serenity, and how we can help:
 http://johnfergusonsmart.com See the project in action:
 bit.ly/screenplay-jvm-demo
  61. 61. @Wakaleo @JanMolak#SerenityBDD Questions? AUTHOR OF ‘BDD IN ACTION’ @wakaleo www.johnfergusonsmart.com

×