The concept of Behavior-Driven Development

Post on 01-Nov-2014

2.514 views 2 download

Tags:

description

The concept of Behavior-Driven Development

Transcript of The concept of Behavior-Driven Development

BEHAVIOR-DRIVEN DEVELOPMENTTHE CONCEPT OF

Fabian Kiss

UnitTesting

UnitTesting

test-first

UnitTesting

test-first

TDD

UnitTesting

test-first

TDD

BDD

BDD

?

“TDD done right”

BDD IS NOT ABOUT TOOLS

(ALTHOUGH THERE ARE TOOLS FOR BDD)

BDD

practices

BDD

maybe you already practice it(without being aware of it)

practices

BDD

maybe you already practice it(without being aware of it)

practices

BDD

practices

awareness

SYNTACTIC CONVENTIONS

method names are complete sentences

public class CustomerLookupTest extends TestCase { testFindsCustomerById() { ... } testFailsForDuplicateCustomers() { ... } ...}

“should” instead of “test”

testShouldFailForMissingSurnametestShouldFailForMissingTitle

...

http://dannorth.net/introducing-bdd/

WHAT TO TEST?

WHAT TO TEST? UNITS

CODE COVERAGE ...

Pict

ure

by P

eter

JBel

lis, l

icen

sed

unde

r the

CC

BY 2

.0

… A FALSE SENSEOF SECURITY

Pict

ure

by S

alim

Virj

i, lic

ense

d un

der t

he C

C BY

-SA

2.0

WHAT TO TEST? UNITSWHAT TO TEST?

WHAT TO TEST? UNITSWHAT TO TEST? BEHAVIOR

BEHAVIOR

constituted by scenarios (descriptions of them)

BEHAVIOR

constituted by scenarios (descriptions of them)

acceptance criteria

User story As a ... I want … So that ...

extract

BEHAVIOR

constituted by scenarios (descriptions of them)

acceptance criteria

User story As a ... I want … So that ...

extract

describe in DSL executable→

BEHAVIOR

constituted by scenarios (descriptions of them)

acceptance criteria

User story As a ... I want … So that ...

extract

describe in DSL executable→

Gherkin:Given a preconditionWhen an event occurredThen an outcome is achieved

BEHAVIOR

constituted by scenarios (descriptions of them)

acceptance criteria

User story As a ... I want … So that ...

extract

describe in DSL executable→

Gherkin:Given a preconditionWhen an event occurredThen an outcome is achieved

tool

execute