Intro. to bdd

19
Intro. to BDD (Behavior Driven Development)

Transcript of Intro. to bdd

Page 1: Intro. to bdd

Intro. to BDD(Behavior Driven Development)

Page 2: Intro. to bdd

What is BDD?“ BDD is a second-generation, outside-in, pull-based, multiple-stakeholder, multiple-scale, high-automation, agile methodology. It describes a cycle of interactions with well-defined outputs, resulting in the delivery of working, tested software that matters.”

-- DAN NORTH(CREATOR OF JBEHAVE TEST FRAMEWORK AND MANY BDD CONCEPTS)

Page 3: Intro. to bdd

What is BDD?“ BDD is a second-generation, outside-in, pull-based, multiple-stakeholder, multiple-scale, high-automation, agile methodology. It describes a cycle of interactions with well-defined outputs, resulting in the delivery of working, tested software that matters.”

-- DAN NORTH(CREATOR OF JBEHAVE TEST FRAMEWORK AND MANY BDD CONCEPTS)

Page 4: Intro. to bdd

What BDD IS NOT?TEST FRAMEWORK

AUTOMATION

CUCUMBER

“GHERKIN” SYNTAX

The only way to Test

THE AGILE WAY to TEST

Page 5: Intro. to bdd

What BDD IS NOT?TEST FRAMEWORK

AUTOMATION

CUCUMBER

“GHERKIN” SYNTAX

The only way to Test

THE AGILE WAY to TEST

Page 6: Intro. to bdd

BEHAVIOR DRIVEN DEVELOPMENTBDD is about DEVELOPMENT

Not CODING

Page 7: Intro. to bdd

THE DEVELOPMENT PROCESS1. Customer wants a feature.

2. Define the feature.

3. Build the feature.

4. Test the Feature.

5. Deliver the feature.

6. PROFIT?

Page 8: Intro. to bdd

TAUTOLOGICAL DEFINITION OF BDDBDD is

An agile process

For Describing BEHAVIORS

That DRIVES the way

Software is DEVELOPED.

Page 9: Intro. to bdd

WT?It’s a way to write requirements

That can be understood by everyone (SEE DOMAIN DRIVEN DESIGN, by ERIC EVANS - no relation)

And Executed Directly.

IT’s EXECUTABLE DOCUMENTATION.

Page 10: Intro. to bdd

BDD & TDDBEHAVIOR DRIVEN DEVELOPMENT

Came from TEST DRIVEN DEVELOPMENT. (SEE EXTREME PROGRAMMING EXPLAINED by KENT BECK - also no relation)

IT REcognizes that Communicating with Non-Programmers is IMPORTANT

But that DOCUMENTATION can become outdated

And AUTOMATED TESTS are only readable by developers.

Page 11: Intro. to bdd

WHY DO BDD(multiple choice Quiz)

A. Management says so.

B. It makes testing easier.

C. To communicate BETTER.

D.ALL of the Above.

E. NONE OF THE ABOVE.

F. D & E

Page 12: Intro. to bdd

TWO (main) STYLES OF BDD CUCUMBER

GIVEN/WHEN/THEN

MORE DETAILEDMORE ORGANIZEDMORE RIGID

DOCS INDEPENDENT OF CODE

SPEC

DESCRIBE/IT SHOULD

MORE CONCISELESS STRUCTUREMORE FREEFORM

DOCS GENERATED BY CODE

Page 13: Intro. to bdd

CUCUMBER (1

of 3)Feature: [TITLE]

As a [ROLE]I want [FEATURE]SO THAT [BENEFIT]

Focus on the reason for developing a feature.

Page 14: Intro. to bdd

CUCUMBER (2

of 3)SCENARIO: [DESCRIPTION]

GIVEN [INITIAL CONTEXT]WHEN [ACTION]THEN [EXPECTED RESULT]

Describe each scenario with preconditions, steps, and expected results.

Page 15: Intro. to bdd

CUCUMBER (3

of 3)EXAMPLES:

Provide concrete examples.

USER

PASSWORD

COMMAND MESSAGE

aaron

SECRET

Open pod bay doors

ACCESS DENIED

dave

DAISY

Open pod bay doors

I’m SORRY DAVE, I’m afraid I can’t do that

Page 16: Intro. to bdd

SPEC (RSPEC, MOCHA)DESCRIBE([FEATURE])

It([BEHAVIOR])

...implementation

Documentation & implementation live together

Page 17: Intro. to bdd

WHEN TO USE CUCUMBER / GHERKINTypically used for user stories where product owner

is involved

and should write, (or at least approve of), the SPEC.

The spec is a mechanism for communication, not a way to dictate features.

Page 18: Intro. to bdd

WHEN TO USE MOCHA/RSPECTypically used for developer oriented tests.

DOcumentation is generated from code.

Good for reporting coverage, but not so much for collaboration.

The spec is used primarily for generating DOCUMENTATION.

Page 19: Intro. to bdd

THE ENDThanks.

[email protected]

https://linkedin.com/in/aaronevans

@fijiaaron