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.

of

Serenity and the Journey Pattern Slide 1 Serenity and the Journey Pattern Slide 2 Serenity and the Journey Pattern Slide 3 Serenity and the Journey Pattern Slide 4 Serenity and the Journey Pattern Slide 5 Serenity and the Journey Pattern Slide 6 Serenity and the Journey Pattern Slide 7 Serenity and the Journey Pattern Slide 8 Serenity and the Journey Pattern Slide 9 Serenity and the Journey Pattern Slide 10 Serenity and the Journey Pattern Slide 11 Serenity and the Journey Pattern Slide 12 Serenity and the Journey Pattern Slide 13 Serenity and the Journey Pattern Slide 14 Serenity and the Journey Pattern Slide 15 Serenity and the Journey Pattern Slide 16 Serenity and the Journey Pattern Slide 17 Serenity and the Journey Pattern Slide 18 Serenity and the Journey Pattern Slide 19 Serenity and the Journey Pattern Slide 20 Serenity and the Journey Pattern Slide 21 Serenity and the Journey Pattern Slide 22 Serenity and the Journey Pattern Slide 23 Serenity and the Journey Pattern Slide 24 Serenity and the Journey Pattern Slide 25 Serenity and the Journey Pattern Slide 26 Serenity and the Journey Pattern Slide 27 Serenity and the Journey Pattern Slide 28 Serenity and the Journey Pattern Slide 29 Serenity and the Journey Pattern Slide 30 Serenity and the Journey Pattern Slide 31 Serenity and the Journey Pattern Slide 32 Serenity and the Journey Pattern Slide 33 Serenity and the Journey Pattern Slide 34 Serenity and the Journey Pattern Slide 35 Serenity and the Journey Pattern Slide 36 Serenity and the Journey Pattern Slide 37 Serenity and the Journey Pattern Slide 38 Serenity and the Journey Pattern Slide 39 Serenity and the Journey Pattern Slide 40 Serenity and the Journey Pattern Slide 41 Serenity and the Journey Pattern Slide 42 Serenity and the Journey Pattern Slide 43 Serenity and the Journey Pattern Slide 44 Serenity and the Journey Pattern Slide 45 Serenity and the Journey Pattern Slide 46 Serenity and the Journey Pattern Slide 47 Serenity and the Journey Pattern Slide 48 Serenity and the Journey Pattern Slide 49 Serenity and the Journey Pattern Slide 50 Serenity and the Journey Pattern Slide 51 Serenity and the Journey Pattern Slide 52 Serenity and the Journey Pattern Slide 53 Serenity and the Journey Pattern Slide 54 Serenity and the Journey Pattern Slide 55 Serenity and the Journey Pattern Slide 56 Serenity and the Journey Pattern Slide 57 Serenity and the Journey Pattern Slide 58 Serenity and the Journey Pattern Slide 59 Serenity and the Journey Pattern Slide 60 Serenity and the Journey Pattern Slide 61 Serenity and the Journey Pattern Slide 62 Serenity and the Journey Pattern Slide 63 Serenity and the Journey Pattern Slide 64 Serenity and the Journey Pattern Slide 65 Serenity and the Journey Pattern Slide 66 Serenity and the Journey Pattern Slide 67 Serenity and the Journey Pattern Slide 68 Serenity and the Journey Pattern Slide 69 Serenity and the Journey Pattern Slide 70 Serenity and the Journey Pattern Slide 71 Serenity and the Journey Pattern Slide 72 Serenity and the Journey Pattern Slide 73 Serenity and the Journey Pattern Slide 74 Serenity and the Journey Pattern Slide 75 Serenity and the Journey Pattern Slide 76 Serenity and the Journey Pattern Slide 77 Serenity and the Journey Pattern Slide 78 Serenity and the Journey Pattern Slide 79 Serenity and the Journey Pattern Slide 80 Serenity and the Journey Pattern Slide 81 Serenity and the Journey Pattern Slide 82 Serenity and the Journey Pattern Slide 83 Serenity and the Journey Pattern Slide 84 Serenity and the Journey Pattern Slide 85 Serenity and the Journey Pattern Slide 86
Upcoming SlideShare
A journey beyond the page object pattern
Next
Download to read offline and view in fullscreen.

12 Likes

Share

Download to read offline

Serenity and the Journey Pattern

Download to read offline

Every test tells a story, but some tell a better story than others. Every test illustrates a specific path through the system to achieve a specific goal, but some paths are clearer than others. Valuable tests are the ones that tell a compelling story.

Come on a journey of discovery to learn how to write such tests, and witness a demonstration of these principles in action, with live coding of Serenity BDD automated tests.

Related Books

Free with a 30 day trial from Scribd

See all

Related Audiobooks

Free with a 30 day trial from Scribd

See all

Serenity and the Journey Pattern

  1. 1. @wakaleo The evolution of automated testing practices Take me on a journey @wakaleo
  2. 2. @wakaleo John Ferguson Smart Introductions “I help teams of smart people 
 learn to work together more efficiently, 
 to deliver better software faster”
  3. 3. @wakaleo Test Automation Do it well, or don’t do it at all
  4. 4. @wakaleo How much are your tests worth? Weekly cost vs weekly savings $0 $20,000 $40,000 $60,000 $80,000 $100,000 $120,000 $140,000 $160,000 $180,000 1/09/2015 1/10/2015 1/11/2015 1/12/2015 Test0suite0cost0vs0savings0(per0week) Cost0saved0par0week Test0suite0cost0per0week
  5. 5. @wakaleo How much are your tests worth? Weekly cost vs weekly savings $0 $20,000 $40,000 $60,000 $80,000 $100,000 $120,000 $140,000 $160,000 $180,000 1/09/2015 1/10/2015 1/11/2015 1/12/2015 Test0suite0cost0vs0savings0(per0week) Cost0saved0par0week Test0suite0cost0per0week Team cost is constant
  6. 6. @wakaleo How much are your tests worth? Weekly cost vs weekly savings $0 $20,000 $40,000 $60,000 $80,000 $100,000 $120,000 $140,000 $160,000 $180,000 1/09/2015 1/10/2015 1/11/2015 1/12/2015 Test0suite0cost0vs0savings0(per0week) Cost0saved0par0week Test0suite0cost0per0week Team cost is constant Time saved increases with the number of executed
  7. 7. @wakaleo How much are your tests worth? $0 $200,000 $400,000 $600,000 $800,000 $1,000,000 $1,200,000 1/09/2015 1/10/2015 1/11/2015 1/12/2015 What0is0your0test0suite0worth? Test0suite0ROI Test0suite0cost Cumulated cost vs cumulated savings
  8. 8. @wakaleo How much are your tests worth? $0 $200,000 $400,000 $600,000 $800,000 $1,000,000 $1,200,000 1/09/2015 1/10/2015 1/11/2015 1/12/2015 What0is0your0test0suite0worth? Test0suite0ROI Test0suite0cost Cumulated cost vs cumulated savings Cumulated value should increase faster than cumulated cost
  9. 9. @wakaleo Now factor in high maintenance 40-60% Typical maintenance overhead for poorly-written test suites
  10. 10. @wakaleo Now factor in high maintenance Number of tests Maintenanceoverhead
  11. 11. @wakaleo Now factor in high maintenance Number of tests Maintenanceoverhead
  12. 12. @wakaleo $0 $50,000 $100,000 $150,000 $200,000 $250,000 $300,000 $350,000 $400,000 $450,000 $500,000 1/09/2015 1/10/2015 1/11/2015 1/12/2015 1/01/2016 What0is0your0test0suite0worth? Test0suite0cost Test0suite0ROI Now factor in high maintenance High-maintenance costs reduce the number of tests a team can write
  13. 13. @wakaleo $0 $50,000 $100,000 $150,000 $200,000 $250,000 $300,000 $350,000 $400,000 $450,000 $500,000 1/09/2015 1/10/2015 1/11/2015 1/12/2015 1/01/2016 What0is0your0test0suite0worth? Test0suite0cost Test0suite0ROI Now factor in high maintenance High-maintenance costs reduce the number of tests a team can write High maintenance costs can cause your test suite to lose value
  14. 14. @wakaleo Narrative Coding Style Open-Closed Principle Single Responsibility Principle Separation of Concerns Software Engineering Principles can help you write more maintainable tests
  15. 15. @wakaleo Narrative Coding Style Open-Closed Principle Single Responsibility Principle Separation of Concerns Software Engineering Principles can help you write more maintainable tests
  16. 16. @wakaleo Narrative Coding Style Open-Closed Principle Single Responsibility Principle Separation of Concerns Software Engineering Principles can help you write more maintainable tests
  17. 17. @wakaleo Narrative Coding Style Open-Closed Principle Single Responsibility Principle Separation of Concerns Software Engineering Principles can help you write more maintainable tests
  18. 18. @wakaleo Narrative Coding Style Open-Closed Principle Single Responsibility Principle Separation of Concerns Software Engineering Principles can help you write more maintainable tests
  19. 19. @wakaleo Separation of Concerns - Layers Goals Tasks Actions
  20. 20. @wakaleo Separation of Concerns - Layers Goals Tasks Actions What are you trying to achieve?
  21. 21. @wakaleo Separation of Concerns - Layers Goals Tasks Actions What are you trying to achieve? What do you need to do to achieve this goal?
  22. 22. @wakaleo Separation of Concerns - Layers Goals Tasks Actions What are you trying to achieve? What do you need to do to achieve this goal? What interactions with the system do you need for each task?
  23. 23. @wakaleo Separation of Concerns - Layers Scenario: Add a new todo entry on the todo home page
 Given I am on the Todo application home page
 When I enter 'Buy some milk' into the New Todo field
 And I press ENTER
 Then the todo list box should contain 'Buy some milk'
  24. 24. @wakaleo Separation of Concerns - Layers Scenario: Record a new todo action for future use
 Given I need to buy some milk
 When I add the todo action 'Buy some milk'
 Then 'Buy some milk' should be recorded in my todo list
  25. 25. @wakaleo Feature documentationDetailed feedbackHigh level feedback Communication and documentation
  26. 26. @wakaleo Feature documentationDetailed feedbackHigh level feedback Communication and documentation
  27. 27. @wakaleo Serenity BDD “Because life is too short to h a v e t o m a i n t a i n u g l y automated test suites”
  28. 28. @wakaleo Living documentation Strong Selenium WebDriver support JUnit, Cucumber or JBehave A layered approach Serenity BDD
  29. 29. @wakaleo The Serenity layered architecture Goals Tasks Interactions
  30. 30. @wakaleo The Serenity layered architecture Goals Tasks Interactions Tests or scenarios
  31. 31. @wakaleo The Serenity layered architecture Goals Tasks Interactions Tests or scenarios “Steps”
  32. 32. @wakaleo The Serenity layered architecture Goals Tasks Interactions Tests or scenarios “Steps” Page Objects or other technical components
  33. 33. @wakaleo The Serenity layered architecture Feature: Add new todos
 James needs to be able to jot down actions he needs to do as he thinks of them
 
 Scenario: Record a new todo action for future use
 Given James needs to buy some milk
 When James adds the todo action 'Buy some milk'
 Then 'Buy some milk' should be recorded in his todo list
  34. 34. @wakaleo The Serenity layered architecture Feature: Add new todos
 James needs to be able to jot down actions he needs to do as he thinks of them
 
 Scenario: Record a new todo action for future use
 Given James needs to buy some milk
 When James adds the todo action 'Buy some milk'
 Then 'Buy some milk' should be recorded in his todo list A goal
  35. 35. @wakaleo The Serenity layered architecture Feature: Add new todos
 James needs to be able to jot down actions he needs to do as he thinks of them
 
 Scenario: Record a new todo action for future use
 Given James needs to buy some milk
 When James adds the todo action 'Buy some milk'
 Then 'Buy some milk' should be recorded in his todo list A goal A task
  36. 36. @wakaleo The Serenity layered architecture Feature: Add new todos
 James needs to be able to jot down actions he needs to do as he thinks of them
 
 Scenario: Record a new todo action for future use
 Given James needs to buy some milk
 When James adds the todo action 'Buy some milk'
 Then 'Buy some milk' should be recorded in his todo list A goal A task @Steps ATodoUser james;
 
 @When(“^(?:.*) (?:adds|has added) the todo action '(.*)'$")
 public void i_add_the_todo_action(String actionName) {
 james.adds_an_action_called(actionName);
 }
  37. 37. @wakaleo The Serenity layered architecture Feature: Add new todos
 James needs to be able to jot down actions he needs to do as he thinks of them
 
 Scenario: Record a new todo action for future use
 Given James needs to buy some milk
 When James adds the todo action 'Buy some milk'
 Then 'Buy some milk' should be recorded in his todo list A goal A task @Steps ATodoUser james;
 
 @When(“^(?:.*) (?:adds|has added) the todo action '(.*)'$")
 public void i_add_the_todo_action(String actionName) {
 james.adds_an_action_called(actionName);
 } The task definition
  38. 38. @wakaleo The Serenity layered architecture Feature: Add new todos
 James needs to be able to jot down actions he needs to do as he thinks of them
 
 Scenario: Record a new todo action for future use
 Given James needs to buy some milk
 When James adds the todo action 'Buy some milk'
 Then 'Buy some milk' should be recorded in his todo list A goal A task @Steps ATodoUser james;
 
 @When(“^(?:.*) (?:adds|has added) the todo action '(.*)'$")
 public void i_add_the_todo_action(String actionName) {
 james.adds_an_action_called(actionName);
 } The task definition TodoPage onTheTodoHomePage;
 
 @Step
 public void adds_an_action_called(String actionName) {
 onTheTodoHomePage.addAnActionCalled(actionName);
 }
  39. 39. @wakaleo The Serenity layered architecture Feature: Add new todos
 James needs to be able to jot down actions he needs to do as he thinks of them
 
 Scenario: Record a new todo action for future use
 Given James needs to buy some milk
 When James adds the todo action 'Buy some milk'
 Then 'Buy some milk' should be recorded in his todo list A goal A task @Steps ATodoUser james;
 
 @When(“^(?:.*) (?:adds|has added) the todo action '(.*)'$")
 public void i_add_the_todo_action(String actionName) {
 james.adds_an_action_called(actionName);
 } The task definition TodoPage onTheTodoHomePage;
 
 @Step
 public void adds_an_action_called(String actionName) {
 onTheTodoHomePage.addAnActionCalled(actionName);
 } An interaction
  40. 40. @wakaleo Serenity for Living Documentation Feature: Add new todos
 I need to be able to jot down actions I need to do as fast as I think of them
 
 Scenario: Record a new todo action for future use
 Given I need to buy some milk
 When I add the todo action 'Buy some milk'
 Then 'Buy some milk' should be recorded in my todo list
  41. 41. @wakaleo Serenity for Living Documentation Feature: Add new todos
 I need to be able to jot down actions I need to do as fast as I think of them
 
 Scenario: Record a new todo action for future use
 Given I need to buy some milk
 When I add the todo action 'Buy some milk'
 Then 'Buy some milk' should be recorded in my todo list
  42. 42. @wakaleo Coding demo
  43. 43. @wakaleo Hard to apply to Single Page Apps Need modifications to extend Multiple Responsibilities Bloat Page Objects considered harmful
  44. 44. @wakaleo Introducing the Journey Pattern
  45. 45. @wakaleo Highly readable style Encourages reuse and maintainable code Small, reusable interaction components User-centric The Journey Pattern
  46. 46. @wakaleo Origins of the Journey Pattern in Serenity Antony Marcano 2007 * * Based on actual events
  47. 47. @wakaleo Origins of the Journey Pattern in Serenity Antony Marcano “Page Objects kinda suck. Why not try this pattern instead?” Agile Alliance Functional Test Tools Workshop 2007 2007 * * Based on actual events
  48. 48. @wakaleo Origins of the Journey Pattern in Serenity Antony Marcano 2007 2009 Andy Palmer
  49. 49. @wakaleo Origins of the Journey Pattern in Serenity Antony Marcano 2007 2009 More people should know about this pattern Andy Palmer
  50. 50. @wakaleo Origins of the Journey Pattern in Serenity Antony Marcano 2007 2009 More people should know about this pattern JNarrate Andy Palmer Let’s write a reference implementation!
  51. 51. @wakaleo Origins of the Journey Pattern in Serenity Antony Marcano 2007 2009 “Coronation Street rocks 2012 Andy Palmer
  52. 52. @wakaleo Origins of the Journey Pattern in Serenity Antony Marcano 2007 2009 “Coronation Street rocks 2012 Andy Palmer Eureka! “Soap Opera Personas”
  53. 53. @wakaleo Andy Palmer Origins of the Journey Pattern in Serenity Antony Marcano 2007 2009 2012 Jan Molak
  54. 54. @wakaleo Andy Palmer Origins of the Journey Pattern in Serenity Antony Marcano 2007 2009 2012 Jan Molak You should call this “The Journey Pattern”
  55. 55. @wakaleo Andy Palmer Origins of the Journey Pattern in Serenity Antony Marcano 2007 2009 2012 Jan Molak You should call this “The Journey Pattern” Damn!
  56. 56. @wakaleo Andy Palmer Origins of the Journey Pattern in Serenity Antony Marcano 2007 2009 2012 Jan Molak You should call this “The Journey Pattern” Damn! Why didn’t we think of that!
  57. 57. @wakaleo Andy Palmer Origins of the Journey Pattern in Serenity Antony Marcano 2007 2009 2012 Jan Molak 2015 John Smart
  58. 58. @wakaleo Andy Palmer Origins of the Journey Pattern in Serenity Antony Marcano 2007 2009 2012 Jan Molak 2015 John Smart Serenity is cool
  59. 59. @wakaleo Andy Palmer Origins of the Journey Pattern in Serenity Antony Marcano 2007 2009 2012 Jan Molak 2015 John Smart Serenity is cool But it needs the Journey Pattern
  60. 60. @wakaleo Andy Palmer Origins of the Journey Pattern in Serenity Antony Marcano 2007 2009 2012 Jan Molak 2015 John Smart Serenity is cool So let’s make it happen! But it needs the Journey Pattern
  61. 61. @wakaleo The Journey Pattern - A User-Centric model Actors have goals
  62. 62. @wakaleo The Journey Pattern - A User-Centric model Actors have goals Meet James
  63. 63. @wakaleo The Journey Pattern - A User-Centric model Actors have goals I’d like to be able to recall all the things I need to do Meet James
  64. 64. @wakaleo The Journey Pattern - A User-Centric model Actors have abilities
  65. 65. @wakaleo The Journey Pattern - A User-Centric model Actors have abilities I can browse the web with my browser
  66. 66. @wakaleo The Journey Pattern - A User-Centric model Actors have abilities I can browse the web with my browser I can also query REST services
  67. 67. @wakaleo I’d like to be able to recall all the things I need to do The Journey Pattern - A User-Centric model Actors perform tasks
  68. 68. @wakaleo I’d like to be able to recall all the things I need to do The Journey Pattern - A User-Centric model Actors perform tasks I’ll add ‘Buy some milk’ to my todo list
  69. 69. @wakaleo I’d like to be able to recall all the things I need to do The Journey Pattern - A User-Centric model Actors may interact with the system to perform these tasks I’ll add ‘Buy some milk’ to my todo list
  70. 70. @wakaleo I’d like to be able to recall all the things I need to do The Journey Pattern - A User-Centric model Actors may interact with the system to perform these tasks I’ll add ‘Buy some milk’ to my todo list
  71. 71. @wakaleo I’d like to be able to recall all the things I need to do The Journey Pattern - A User-Centric model Actors may interact with the system to perform these tasks I’ll add ‘Buy some milk’ to my todo list Type ‘Buy the milk’
  72. 72. @wakaleo I’d like to be able to recall all the things I need to do The Journey Pattern - A User-Centric model Actors may interact with the system to perform these tasks I’ll add ‘Buy some milk’ to my todo list Type ‘Buy the milk’
  73. 73. @wakaleo I’d like to be able to recall all the things I need to do The Journey Pattern - A User-Centric model Actors may interact with the system to perform these tasks I’ll add ‘Buy some milk’ to my todo list Type ‘Buy the milk’ Press ‘ENTER’
  74. 74. @wakaleo I’d like to be able to recall all the things I need to do The Journey Pattern - A User-Centric model Actors may interact with the system to perform these tasks I’ll add ‘Buy some milk’ to my todo list Type ‘Buy the milk’ Press ‘ENTER’
  75. 75. @wakaleo The Journey Pattern in Serenity Actors have goals I’d like to be able to recall all the things I need to do
  76. 76. @wakaleo The Journey Pattern in Serenity Actors have goals Feature: Add new todos
 James would like to be able to recall all the things he needs to do
 
 Scenario: Record a new todo action for future use
 Given James needs to buy some milk
 When James adds the todo action 'Buy some milk'
 Then 'Buy some milk' should be recorded in his todo list I’d like to be able to recall all the things I need to do
  77. 77. @wakaleo A User-Centric model Actors have abilities I can browse the web with my browser Actor james = Actor.named(“James"); @Managed
 WebDriver hisBrowser; … james.can(BrowseTheWeb.with(hisBrowser));
  78. 78. @wakaleo A User-Centric model Actors perform tasks @Steps
 AddItem addATodoItem; … james.attemptsTo(addATodoItem.called("Buy some milk"));
  79. 79. @wakaleo A User-Centric model Actors perform tasks I’ll add ‘Buy some milk’ to my todo list @Steps
 AddItem addATodoItem; … james.attemptsTo(addATodoItem.called("Buy some milk"));
  80. 80. @wakaleo A User-Centric model Actors perform tasks @Steps
 AddItem addATodoItem; … james.attemptsTo(addATodoItem.called("Buy some milk")); actor.attemptsTo(
 Enter.theValue(thingToDo).into(ToDoList.NEW_TODO_FIELD),
 Hit.the(RETURN).keyIn(ToDoList.NEW_TODO_FIELD)
 );
  81. 81. @wakaleo A User-Centric model Actors perform tasks I’ll add ‘Buy some milk’ to my todo list @Steps
 AddItem addATodoItem; … james.attemptsTo(addATodoItem.called("Buy some milk")); actor.attemptsTo(
 Enter.theValue(thingToDo).into(ToDoList.NEW_TODO_FIELD),
 Hit.the(RETURN).keyIn(ToDoList.NEW_TODO_FIELD)
 );
  82. 82. @wakaleo A User-Centric model Actors perform tasks I’ll add ‘Buy some milk’ to my todo list @Steps
 AddItem addATodoItem; … james.attemptsTo(addATodoItem.called("Buy some milk")); actor.attemptsTo(
 Enter.theValue(thingToDo).into(ToDoList.NEW_TODO_FIELD),
 Hit.the(RETURN).keyIn(ToDoList.NEW_TODO_FIELD)
 ); Type ‘Buy the milk’
  83. 83. @wakaleo A User-Centric model Actors perform tasks I’ll add ‘Buy some milk’ to my todo list @Steps
 AddItem addATodoItem; … james.attemptsTo(addATodoItem.called("Buy some milk")); actor.attemptsTo(
 Enter.theValue(thingToDo).into(ToDoList.NEW_TODO_FIELD),
 Hit.the(RETURN).keyIn(ToDoList.NEW_TODO_FIELD)
 ); Type ‘Buy the milk’ Press ‘ENTER’
  84. 84. @wakaleo Coding demo
  85. 85. @wakaleo References • http://www.serenity-bdd.info • https://github.com/serenity-bdd/serenity-journey-demo • http://bit.ly/rg-journey
  86. 86. @wakaleo Questions? John Ferguson Smart john.smart@wakaleo.com wakaleo http://www.wakaleo.com http://www.serenity-bdd.info
  • amitrajpurkar

    Jan. 30, 2018
  • kolodzig

    Jan. 11, 2018
  • IliaKuznetsov1

    Nov. 21, 2016
  • guibertjulien

    Jul. 11, 2016
  • IoannisPapadakis1

    Apr. 13, 2016
  • lcarausu

    Feb. 4, 2016
  • danielgalassi

    Dec. 4, 2015
  • wahidsadik

    Oct. 25, 2015
  • MadhuRJ2

    Oct. 7, 2015
  • DermitzakisYiannis

    Oct. 5, 2015
  • powerirs

    Oct. 2, 2015
  • AndriesMesken

    Oct. 2, 2015

Every test tells a story, but some tell a better story than others. Every test illustrates a specific path through the system to achieve a specific goal, but some paths are clearer than others. Valuable tests are the ones that tell a compelling story. Come on a journey of discovery to learn how to write such tests, and witness a demonstration of these principles in action, with live coding of Serenity BDD automated tests.

Views

Total views

5,330

On Slideshare

0

From embeds

0

Number of embeds

86

Actions

Downloads

71

Shares

0

Comments

0

Likes

12

×