screenplay - next generation automated acceptance testing

61
@Wakaleo @JanMolak #SerenityBDD Screenplay Next generation automated acceptance testing AUTHOR OF ‘BDD IN ACTION’ @wakaleo www.johnfergusonsmart.com

Upload: john-ferguson-smart-limited

Post on 28-Jan-2018

605 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Screenplay - Next generation automated acceptance testing

@Wakaleo @JanMolak #SerenityBDD

ScreenplayNext generation automated acceptance testing

AUTHOR OF ‘BDD IN ACTION’

@wakaleo

www.johnfergusonsmart.com

Page 2: Screenplay - Next generation automated acceptance testing

@Wakaleo @JanMolak #SerenityBDD

Sustainable test automation to deliver features that matter

Page 3: Screenplay - Next generation automated acceptance testing

@Wakaleo @JanMolak #SerenityBDD

Learn

Measure

Build

Page 4: Screenplay - Next generation automated acceptance testing

@Wakaleo @JanMolak #SerenityBDD

Requirements Discovery

Automation and Feedback

Software Craftsmanship

Learn Build

Measure

Page 5: Screenplay - Next generation automated acceptance testing

@Wakaleo @JanMolak #SerenityBDD

Requirements Discovery

Automation and Feedback

Software Craftsmanship

Learn Build

Measure

Page 6: Screenplay - Next generation automated acceptance testing

@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

Page 7: Screenplay - Next generation automated acceptance testing

@Wakaleo @JanMolak#SerenityBDD

Behaviour-Driven Development

Page 8: Screenplay - Next generation automated acceptance testing

@Wakaleo @JanMolak#SerenityBDD

Behaviour-Driven DevelopmentDomain-Driven Design

Page 9: Screenplay - Next generation automated acceptance testing

@Wakaleo @JanMolak#SerenityBDD

Domain-Driven DesignBehaviour-Driven Development

User-Centred Design

Page 10: Screenplay - Next generation automated acceptance testing

@Wakaleo @JanMolak#SerenityBDD

Building the application

Testing the application

When we are…

We model…The domain How the user interacts

with the applicationAccount

Purchase

ProductOpen an account Look for a

product

Completes a purchase

NOUNS VERBSThe key concepts are…

Page 11: Screenplay - Next generation automated acceptance testing

@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

Page 12: Screenplay - Next generation automated acceptance testing

@Wakaleo @JanMolak#SerenityBDD

Actors

Goals

Tasks

Interactions

System

have

involve

require

with the

Page 13: Screenplay - Next generation automated acceptance testing

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

Page 14: Screenplay - Next generation automated acceptance testing

@Wakaleo @JanMolak#SerenityBDD

Feature:FilterthelisttofinditemsofinterestInordertofocusonoutstandingitemsJameswouldliketofilterhistodolisttoonlyshowitemsofinterest

Scenario:ViewingActiveitemsonlyGivenJameshasalistwithWalkthedog,GetacoffeeAndhecompletesWalkthedogWhenhefiltershislisttoshowonlyActivetasksThenhistodolistshouldcontainGetacoffee

Page 15: Screenplay - Next generation automated acceptance testing

@Wakaleo @JanMolak#SerenityBDD

Feature:FilterthelisttofinditemsofinterestInordertofocusonoutstandingitemsJameswouldliketofilterhistodolisttoonlyshowitemsofinterest

Scenario:ViewingActiveitemsonly

GivenJameshasalistwithWalkthedog,GetacoffeeAndhecompletesWalkthedogWhenhefiltershislisttoshowonlyActivetasksThenhistodolistshouldcontainGetacoffee

Actor

Page 16: Screenplay - Next generation automated acceptance testing

@Wakaleo @JanMolak#SerenityBDD

Feature:Filterthelisttofinditemsofinterest

InordertofocusonoutstandingitemsJameswouldliketofilterhistodolisttoonlyshowitemsofinterest

Scenario:ViewingActiveitemsonlyGivenJameshasalistwithWalkthedog,GetacoffeeAndhecompletesWalkthedogWhenhefiltershislisttoshowonlyActivetasksThenhistodolistshouldcontainGetacoffee

Actor

Goals

Page 17: Screenplay - Next generation automated acceptance testing

@Wakaleo @JanMolak#SerenityBDD

Scenario:ViewingActiveitemsonly

GivenJameshasalistwithWalkthedog,GetacoffeeAndhecompletesWalkthedogWhenhefiltershislisttoshowonlyActivetasksThenhistodolistshouldcontainGetacoffee

Actor

Goals

Tasks

Page 18: Screenplay - Next generation automated acceptance testing

@Wakaleo @JanMolak#SerenityBDD

Scenario:ViewingActiveitemsonly

GivenJameshasalistwithWalkthedog,GetacoffeeAndhecompletesWalkthedogWhenhefiltershislisttoshowonlyActivetasksThenhistodolistshouldcontainGetacoffee

Actor

Goals

Tasks

Page 19: Screenplay - Next generation automated acceptance testing

@Wakaleo @JanMolak#SerenityBDD

Scenario:ViewingActiveitemsonly

GivenJameshasalistwithWalkthedog,GetacoffeeAndhecompletesWalkthedogWhenhefiltershislisttoshowonlyActivetasksThenhistodolistshouldcontainGetacoffee

Actor

Goals

Tasks

Page 20: Screenplay - Next generation automated acceptance testing

@Wakaleo @JanMolak#SerenityBDD

Scenario:ViewingActiveitemsonly

GivenJameshasalistwithWalkthedog,GetacoffeeAndhecompletesWalkthedogWhenhefiltershislisttoshowonlyActivetasksThenhistodolistshouldcontainGetacoffee

Actor

Goals

Tasks

Page 21: Screenplay - Next generation automated acceptance testing

@Wakaleo @JanMolak#SerenityBDD

Scenario:ViewingActiveitemsonly

GivenJameshasalistwithWalkthedog,GetacoffeeAndhecompletesWalkthedogWhenhefiltershislisttoshowonlyActivetasksThenhistodolistshouldcontainGetacoffee

Actor

Goals

Tasks

Page 22: Screenplay - Next generation automated acceptance testing

@Wakaleo @JanMolak#SerenityBDD

Scenario:ViewingActiveitemsonly

GivenJameshasalistwithWalkthedog,GetacoffeeAndhecompletesWalkthedogWhenhefiltershislisttoshowonlyActivetasksThenhistodolistshouldcontainGetacoffee

Actor

Goals

Tasks

Page 23: Screenplay - Next generation automated acceptance testing

@Wakaleo @JanMolak#SerenityBDD

Scenario:ViewingActiveitemsonly

Startwithalistcontaining:Walkthedog,GetacoffeeAndhecompletesWalkthedogWhenhefiltershislisttoshowonlyActivetasksThenhistodolistshouldcontainGetacoffee

Actor

Goals

Tasks

Page 24: Screenplay - Next generation automated acceptance testing

@Wakaleo @JanMolak#SerenityBDD

Scenario:ViewingActiveitemsonly

Startwithalistcontaining:Walkthedog,GetacoffeeAndhecompletesWalkthedogWhenhefiltershislisttoshowonlyActivetasksThenhistodolistshouldcontainGetacoffee

Actor

Goals

Tasks

Page 25: Screenplay - Next generation automated acceptance testing

@Wakaleo @JanMolak#SerenityBDD

Scenario:ViewingActiveitemsonly

Startwithalistcontaining:Walkthedog,GetacoffeeCompleteatodoitemcalled:WalkthedogWhenhefiltershislisttoshowonlyActivetasksThenhistodolistshouldcontainGetacoffee

Actor

Goals

Tasks

Page 26: Screenplay - Next generation automated acceptance testing

@Wakaleo @JanMolak#SerenityBDD

Scenario:ViewingActiveitemsonly

Startwithalistcontaining:Walkthedog,GetacoffeeCompleteatodoitemcalled:WalkthedogWhenhefiltershislisttoshowonlyActivetasksThenhistodolistshouldcontainGetacoffee

Actor

Goals

Tasks

Page 27: Screenplay - Next generation automated acceptance testing

@Wakaleo @JanMolak#SerenityBDD

Scenario:ViewingActiveitemsonly

Startwithalistcontaining:Walkthedog,GetacoffeeCompleteatodoitemcalled:WalkthedogFilterlisttoshowonlyActivetasksThenhistodolistshouldcontainGetacoffee

Actor

Goals

Tasks

Page 28: Screenplay - Next generation automated acceptance testing

@Wakaleo @JanMolak#SerenityBDD

Scenario:ViewingActiveitemsonly

Startwithalistcontaining:Walkthedog,GetacoffeeCompleteatodoitemcalled:WalkthedogFilterlisttoshowonlyActivetasksThenhistodolistshouldcontainGetacoffee

Actor

Goals

Tasks

Page 29: Screenplay - Next generation automated acceptance testing

@Wakaleo @JanMolak#SerenityBDD

Scenario:ViewingActiveitemsonly

Startwithalistcontaining:Walkthedog,GetacoffeeCompleteatodoitemcalled:WalkthedogFilterlisttoshowonlyActivetasksExpecttosee:Getacoffee

Actor

Goals

Tasks

Page 30: Screenplay - Next generation automated acceptance testing

@Wakaleo @JanMolak#SerenityBDD

Scenario:ViewingActiveitemsonly

Startwithalistcontaining:Walkthedog,GetacoffeeCompleteatodoitemcalled:WalkthedogFilterlisttoshowonlyActivetasksExpecttosee:Getacoffee

Actor

Goals

Tasks

Page 31: Screenplay - Next generation automated acceptance testing

@Wakaleo @JanMolak#SerenityBDD

Scenario:ViewingActiveitemsonly

Startwithalistcontaining:Walkthedog,GetacoffeeOpenbrowseron‘todomvc.com/examples/angularjs/'ResizebrowserwindowtomaximumAddatodoitemcalled‘Walkthedog’Addatodoitemcalled‘Getacoffee’...

Actor

Goals

Tasks

Page 32: Screenplay - Next generation automated acceptance testing

@Wakaleo @JanMolak#SerenityBDD

ToviewActiveitemsonly,Jamesattemptsto:

Startwithalistcontaining:Walkthedog,GetacoffeeOpenbrowseron‘todomvc.com/examples/angularjs/'ResizebrowserwindowtomaximumAddatodoitemcalled‘Walkthedog’Addatodoitemcalled‘Getacoffee’Enterthevalue‘Getacoffee’HittheEnterkey...

Actor

Goals

Tasks

Interactions

Page 33: Screenplay - Next generation automated acceptance testing

Software Craftsmanship

Automation and Feedback

@Wakaleo @JanMolak #SerenityBDD

Requirements Discovery

Learn Build

Measure

Page 34: Screenplay - Next generation automated acceptance testing

@Wakaleo @JanMolak#SerenityBDD

40-70%maintenance overhead for poorly-written test suites

Page 35: Screenplay - Next generation automated acceptance testing

@Wakaleo @JanMolak#SerenityBDD

Serenity BDD and the Screenplay Pattern

Page 36: Screenplay - Next generation automated acceptance testing

@Wakaleo @JanMolak#SerenityBDD

Complete the requirements circle

Serenity BDD and the Screenplay Pattern

Page 37: Screenplay - Next generation automated acceptance testing

@Wakaleo @JanMolak#SerenityBDD

Serenity BDD and the Screenplay Pattern

User-centric

Page 38: Screenplay - Next generation automated acceptance testing

@Wakaleo @JanMolak#SerenityBDD

Serenity BDD and the Screenplay Pattern

Reusable business DSL…in code

Page 39: Screenplay - Next generation automated acceptance testing

@Wakaleo @JanMolak#SerenityBDD

Serenity BDD and the Screenplay Pattern

Designed to scale

Page 40: Screenplay - Next generation automated acceptance testing

@Wakaleo @JanMolak #SerenityBDD

Serenity BDD and the Screenplay Pattern in action

Page 41: Screenplay - Next generation automated acceptance testing

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

Page 42: Screenplay - Next generation automated acceptance testing

@Wakaleo @JanMolak#SerenityBDD

Actorjames=Actor.named(“James”);actor

Page 43: Screenplay - Next generation automated acceptance testing

@Wakaleo @JanMolak#SerenityBDD

@ManagedWebDriverhisBrowser;…james.can(BrowseTheWeb.with(hisBrowser));

an actor has

abilities

Page 44: Screenplay - Next generation automated acceptance testing

@Wakaleo @JanMolak#SerenityBDD

james.attemptsTo(AddATodoItem.called("Buysomemilk"));

an actor performs

tasks

Page 45: Screenplay - Next generation automated acceptance testing

@Wakaleo @JanMolak#SerenityBDD

@Given(“^.*hasatodolistcontaining(.*)$")publicvoidhas_a_list_with(List<String>items){

james.attemptsTo(Start.withATodoListContaining(items));}

an actor performs

tasks

Page 46: Screenplay - Next generation automated acceptance testing

@Wakaleo @JanMolak#SerenityBDD

publicclassStartimplementsTask{@Step("{0}startswith#items")public<TextendsActor>voidperformAs(Tactor){actor.attemptsTo(Open.browserOn().the(applicationHomePage),AddTodoItems.called(items)));}//...}

tasks can use

other tasks

Page 47: Screenplay - Next generation automated acceptance testing

@Wakaleo @JanMolak#SerenityBDD

publicclassAddATodoItemimplementsTask{@Step("{0}addsatodoitemcalled:#thingToDo")publicvoidperformAs(ActortheActor){theActor.attemptsTo(Enter.theValue(thingToDo).into(TodoList.WHAT_NEEDS_TO_BE_DONE).thenHit(RETURN));}//...}

tasks use

inter-actions

Page 48: Screenplay - Next generation automated acceptance testing

@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

Page 49: Screenplay - Next generation automated acceptance testing

Automation and Feedback

@Wakaleo @JanMolak #SerenityBDD

Requirements Discovery

Software Craftsmanship

Learn Build

Measure

Page 50: Screenplay - Next generation automated acceptance testing

@Wakaleo @JanMolak#SerenityBDD

Levels of communication

-

+

Page 51: Screenplay - Next generation automated acceptance testing

@Wakaleo @JanMolak#SerenityBDD

10,000 ftRelease Readiness

-

+

Page 52: Screenplay - Next generation automated acceptance testing

@Wakaleo @JanMolak#SerenityBDD

1000 ftCapabilities and Features

-

+

Page 53: Screenplay - Next generation automated acceptance testing

@Wakaleo @JanMolak#SerenityBDD

100 ftScenarios and Steps

-

+

Page 54: Screenplay - Next generation automated acceptance testing

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

Page 55: Screenplay - Next generation automated acceptance testing

@Wakaleo @JanMolak#SerenityBDD

Release Readiness -

+

Page 56: Screenplay - Next generation automated acceptance testing

-

+

@Wakaleo @JanMolak#SerenityBDD

Release Readiness Capabilities

Page 57: Screenplay - Next generation automated acceptance testing

-

+

@Wakaleo @JanMolak#SerenityBDD

Release Readiness Capabilities Features

Page 58: Screenplay - Next generation automated acceptance testing

-

+

@Wakaleo @JanMolak#SerenityBDD

Release Readiness Capabilities Features Scenarios

Page 59: Screenplay - Next generation automated acceptance testing

@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” - InfoQJohn Ferguson Smart, Antony Marcano, Andy Palmer, Jan Molak bit.ly/screenplay-introduction

Want to know more?

Page 60: Screenplay - Next generation automated acceptance testing

@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

Page 61: Screenplay - Next generation automated acceptance testing

@Wakaleo @JanMolak#SerenityBDD

Questions?AUTHOR OF ‘BDD IN ACTION’

@wakaleo

www.johnfergusonsmart.com