13
BDD Behavior Driven Development

Tech breakfast at Lab49

Embed Size (px)

Citation preview

Page 1: Tech breakfast at Lab49

BDDBehavior Driven Development

Page 2: Tech breakfast at Lab49

How traditional projects fail

• Delivering Late or Over Budget

• Delivering the Wrong Thing

• Unstable in Production

• Costly to Maintain

Page 3: Tech breakfast at Lab49

Agile

• Individuals and interactions over processes and tools

• Working software over comprehensive documentation

• Customer collaboration over contract negotiation

• Responding to change over following a plan

Page 4: Tech breakfast at Lab49

Cost of going agile

• Outcome-Based Planning

• Streaming Requirements

• Evolving Design

• Changing Existing Code

• Frequent Code Integration

• Continual Regression Testing

• Frequent Production Releases

Page 5: Tech breakfast at Lab49

Three principles of BDD

• Enough is enough - Up-front planning, analysis, and design all have a diminishing return. We shouldn’t do less than we need to get started, but any more than that is wasted effort.

• Deliver stakeholder value - If you are doing something that isn’t either delivering value or increasing your ability to deliver value, stop doing it, and do something else instead.

• It’s all behavior - Whether at the code level, the application level, or beyond, we can use the same thinking and the same linguistic constructs to describe behavior at any level of granularity.

Page 6: Tech breakfast at Lab49

TDD vs BDD

• TDD tests what an object is…

• BDD tests what an object does…

Page 7: Tech breakfast at Lab49

Code Exercise

• Build a Set implementation n java with the following APIs-

• empty()

• size()

• add()

• contains()

• remove()

• Dynamic expansion

Page 8: Tech breakfast at Lab49

Specification Code

Test Runner

Eclipse perspective

Page 9: Tech breakfast at Lab49

empty( ) specification

Name of the test

Pre conditions

Expectation

Page 10: Tech breakfast at Lab49

empty( ) implementation

Just enough to pass test case!!!!

Page 11: Tech breakfast at Lab49

More specifications

Page 12: Tech breakfast at Lab49

Moreimplementation

Page 13: Tech breakfast at Lab49

BDDLifecycle