screenplay - next generation automated acceptance testing

Post on 28-Jan-2018

606 Views

Category:

Technology

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

@Wakaleo @JanMolak #SerenityBDD

ScreenplayNext generation automated acceptance testing

AUTHOR OF ‘BDD IN ACTION’

@wakaleo

www.johnfergusonsmart.com

@Wakaleo @JanMolak #SerenityBDD

Sustainable test automation to deliver features that matter

@Wakaleo @JanMolak #SerenityBDD

Learn

Measure

Build

@Wakaleo @JanMolak #SerenityBDD

Requirements Discovery

Automation and Feedback

Software Craftsmanship

Learn Build

Measure

@Wakaleo @JanMolak #SerenityBDD

Requirements Discovery

Automation and Feedback

Software Craftsmanship

Learn Build

Measure

@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

@Wakaleo @JanMolak#SerenityBDD

Behaviour-Driven Development

@Wakaleo @JanMolak#SerenityBDD

Behaviour-Driven DevelopmentDomain-Driven Design

@Wakaleo @JanMolak#SerenityBDD

Domain-Driven DesignBehaviour-Driven Development

User-Centred Design

@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…

@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

@Wakaleo @JanMolak#SerenityBDD

Actors

Goals

Tasks

Interactions

System

have

involve

require

with the

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

@Wakaleo @JanMolak#SerenityBDD

Feature:FilterthelisttofinditemsofinterestInordertofocusonoutstandingitemsJameswouldliketofilterhistodolisttoonlyshowitemsofinterest

Scenario:ViewingActiveitemsonlyGivenJameshasalistwithWalkthedog,GetacoffeeAndhecompletesWalkthedogWhenhefiltershislisttoshowonlyActivetasksThenhistodolistshouldcontainGetacoffee

@Wakaleo @JanMolak#SerenityBDD

Feature:FilterthelisttofinditemsofinterestInordertofocusonoutstandingitemsJameswouldliketofilterhistodolisttoonlyshowitemsofinterest

Scenario:ViewingActiveitemsonly

GivenJameshasalistwithWalkthedog,GetacoffeeAndhecompletesWalkthedogWhenhefiltershislisttoshowonlyActivetasksThenhistodolistshouldcontainGetacoffee

Actor

@Wakaleo @JanMolak#SerenityBDD

Feature:Filterthelisttofinditemsofinterest

InordertofocusonoutstandingitemsJameswouldliketofilterhistodolisttoonlyshowitemsofinterest

Scenario:ViewingActiveitemsonlyGivenJameshasalistwithWalkthedog,GetacoffeeAndhecompletesWalkthedogWhenhefiltershislisttoshowonlyActivetasksThenhistodolistshouldcontainGetacoffee

Actor

Goals

@Wakaleo @JanMolak#SerenityBDD

Scenario:ViewingActiveitemsonly

GivenJameshasalistwithWalkthedog,GetacoffeeAndhecompletesWalkthedogWhenhefiltershislisttoshowonlyActivetasksThenhistodolistshouldcontainGetacoffee

Actor

Goals

Tasks

@Wakaleo @JanMolak#SerenityBDD

Scenario:ViewingActiveitemsonly

GivenJameshasalistwithWalkthedog,GetacoffeeAndhecompletesWalkthedogWhenhefiltershislisttoshowonlyActivetasksThenhistodolistshouldcontainGetacoffee

Actor

Goals

Tasks

@Wakaleo @JanMolak#SerenityBDD

Scenario:ViewingActiveitemsonly

GivenJameshasalistwithWalkthedog,GetacoffeeAndhecompletesWalkthedogWhenhefiltershislisttoshowonlyActivetasksThenhistodolistshouldcontainGetacoffee

Actor

Goals

Tasks

@Wakaleo @JanMolak#SerenityBDD

Scenario:ViewingActiveitemsonly

GivenJameshasalistwithWalkthedog,GetacoffeeAndhecompletesWalkthedogWhenhefiltershislisttoshowonlyActivetasksThenhistodolistshouldcontainGetacoffee

Actor

Goals

Tasks

@Wakaleo @JanMolak#SerenityBDD

Scenario:ViewingActiveitemsonly

GivenJameshasalistwithWalkthedog,GetacoffeeAndhecompletesWalkthedogWhenhefiltershislisttoshowonlyActivetasksThenhistodolistshouldcontainGetacoffee

Actor

Goals

Tasks

@Wakaleo @JanMolak#SerenityBDD

Scenario:ViewingActiveitemsonly

GivenJameshasalistwithWalkthedog,GetacoffeeAndhecompletesWalkthedogWhenhefiltershislisttoshowonlyActivetasksThenhistodolistshouldcontainGetacoffee

Actor

Goals

Tasks

@Wakaleo @JanMolak#SerenityBDD

Scenario:ViewingActiveitemsonly

Startwithalistcontaining:Walkthedog,GetacoffeeAndhecompletesWalkthedogWhenhefiltershislisttoshowonlyActivetasksThenhistodolistshouldcontainGetacoffee

Actor

Goals

Tasks

@Wakaleo @JanMolak#SerenityBDD

Scenario:ViewingActiveitemsonly

Startwithalistcontaining:Walkthedog,GetacoffeeAndhecompletesWalkthedogWhenhefiltershislisttoshowonlyActivetasksThenhistodolistshouldcontainGetacoffee

Actor

Goals

Tasks

@Wakaleo @JanMolak#SerenityBDD

Scenario:ViewingActiveitemsonly

Startwithalistcontaining:Walkthedog,GetacoffeeCompleteatodoitemcalled:WalkthedogWhenhefiltershislisttoshowonlyActivetasksThenhistodolistshouldcontainGetacoffee

Actor

Goals

Tasks

@Wakaleo @JanMolak#SerenityBDD

Scenario:ViewingActiveitemsonly

Startwithalistcontaining:Walkthedog,GetacoffeeCompleteatodoitemcalled:WalkthedogWhenhefiltershislisttoshowonlyActivetasksThenhistodolistshouldcontainGetacoffee

Actor

Goals

Tasks

@Wakaleo @JanMolak#SerenityBDD

Scenario:ViewingActiveitemsonly

Startwithalistcontaining:Walkthedog,GetacoffeeCompleteatodoitemcalled:WalkthedogFilterlisttoshowonlyActivetasksThenhistodolistshouldcontainGetacoffee

Actor

Goals

Tasks

@Wakaleo @JanMolak#SerenityBDD

Scenario:ViewingActiveitemsonly

Startwithalistcontaining:Walkthedog,GetacoffeeCompleteatodoitemcalled:WalkthedogFilterlisttoshowonlyActivetasksThenhistodolistshouldcontainGetacoffee

Actor

Goals

Tasks

@Wakaleo @JanMolak#SerenityBDD

Scenario:ViewingActiveitemsonly

Startwithalistcontaining:Walkthedog,GetacoffeeCompleteatodoitemcalled:WalkthedogFilterlisttoshowonlyActivetasksExpecttosee:Getacoffee

Actor

Goals

Tasks

@Wakaleo @JanMolak#SerenityBDD

Scenario:ViewingActiveitemsonly

Startwithalistcontaining:Walkthedog,GetacoffeeCompleteatodoitemcalled:WalkthedogFilterlisttoshowonlyActivetasksExpecttosee:Getacoffee

Actor

Goals

Tasks

@Wakaleo @JanMolak#SerenityBDD

Scenario:ViewingActiveitemsonly

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

Actor

Goals

Tasks

@Wakaleo @JanMolak#SerenityBDD

ToviewActiveitemsonly,Jamesattemptsto:

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

Actor

Goals

Tasks

Interactions

Software Craftsmanship

Automation and Feedback

@Wakaleo @JanMolak #SerenityBDD

Requirements Discovery

Learn Build

Measure

@Wakaleo @JanMolak#SerenityBDD

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

@Wakaleo @JanMolak#SerenityBDD

Serenity BDD and the Screenplay Pattern

@Wakaleo @JanMolak#SerenityBDD

Complete the requirements circle

Serenity BDD and the Screenplay Pattern

@Wakaleo @JanMolak#SerenityBDD

Serenity BDD and the Screenplay Pattern

User-centric

@Wakaleo @JanMolak#SerenityBDD

Serenity BDD and the Screenplay Pattern

Reusable business DSL…in code

@Wakaleo @JanMolak#SerenityBDD

Serenity BDD and the Screenplay Pattern

Designed to scale

@Wakaleo @JanMolak #SerenityBDD

Serenity BDD and the Screenplay Pattern in action

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

@Wakaleo @JanMolak#SerenityBDD

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

@Wakaleo @JanMolak#SerenityBDD

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

an actor has

abilities

@Wakaleo @JanMolak#SerenityBDD

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

an actor performs

tasks

@Wakaleo @JanMolak#SerenityBDD

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

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

an actor performs

tasks

@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

@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

@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

Automation and Feedback

@Wakaleo @JanMolak #SerenityBDD

Requirements Discovery

Software Craftsmanship

Learn Build

Measure

@Wakaleo @JanMolak#SerenityBDD

Levels of communication

-

+

@Wakaleo @JanMolak#SerenityBDD

10,000 ftRelease Readiness

-

+

@Wakaleo @JanMolak#SerenityBDD

1000 ftCapabilities and Features

-

+

@Wakaleo @JanMolak#SerenityBDD

100 ftScenarios and Steps

-

+

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

@Wakaleo @JanMolak#SerenityBDD

Release Readiness -

+

-

+

@Wakaleo @JanMolak#SerenityBDD

Release Readiness Capabilities

-

+

@Wakaleo @JanMolak#SerenityBDD

Release Readiness Capabilities Features

-

+

@Wakaleo @JanMolak#SerenityBDD

Release Readiness Capabilities Features Scenarios

@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?

@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

@Wakaleo @JanMolak#SerenityBDD

Questions?AUTHOR OF ‘BDD IN ACTION’

@wakaleo

www.johnfergusonsmart.com

top related