67
BDD in open-source projects Is it really beneficial? FABIAN KISS

BDD in open source projects - Is it really beneficial?

Embed Size (px)

DESCRIPTION

You can easily use tools such as Behat and phpspec for practicing BDD in PHP. Regardless of the specific BDD tools, the question of how to do BDD “properly” arises. According to Dan North, initiator of the BDD philosophy, it should be be practiced as a “mutliple-stakeholder, agile methodology”. However, most open-source projects are not developed with an explicit agile methodology. Also, there are hardly any stakeholder roles that are clearly distinguishable from each other - often contributor and user are actually one and the same. So, in the case of open-source projects, you can question the benefit of BDD.

Citation preview

Page 1: BDD in open source projects - Is it really beneficial?

BDD in open-source projectsIs it really beneficial?

FABIAN KISS

Page 2: BDD in open source projects - Is it really beneficial?

I AM

Fabian Kiss@head_revision

Passionate Behat user, contributor, and blogger

headrevision

Page 3: BDD in open source projects - Is it really beneficial?

I WORK AT

Page 4: BDD in open source projects - Is it really beneficial?

WE ARE HERE@ymc_ch

www.ymc.ch

Page 5: BDD in open source projects - Is it really beneficial?

I WILL

Question BDD!

Page 6: BDD in open source projects - Is it really beneficial?

I WILL

Question BDD!

Dan North: « BDD is a [...] multiple-stakeholder, agile methodology »

Page 7: BDD in open source projects - Is it really beneficial?

I WILL

BDD is beneficial in agile customer projects.

Dan North: « BDD is a [...] multiple-stakeholder, agile methodology »

Question BDD!

Page 8: BDD in open source projects - Is it really beneficial?

I WILL

BDD is beneficial in agile customer projects.

Dan North: « BDD is a [...] multiple-stakeholder, agile methodology »

Question BDD!

customer pays→ explicit customer→ agile process

Page 9: BDD in open source projects - Is it really beneficial?

I WILL

BDD is beneficial in agile customer projects.

Dan North: « BDD is a [...] multiple-stakeholder, agile methodology »

Question BDD!

open-source projects

customer pays→ explicit customer→ agile process

developers work for free→ no explicit customer→ emergent process

Page 10: BDD in open source projects - Is it really beneficial?

I WILL

BDD is beneficial in agile customer projects. customer pays→ explicit customer→ agile process

Dan North: « BDD is a [...] multiple-stakeholder, agile methodology »

developers work for free→ no explicit customer→ emergent process

Question BDD!

Is it beneficial in as well?open-source projects

Page 11: BDD in open source projects - Is it really beneficial?
Page 12: BDD in open source projects - Is it really beneficial?

PRIME EXAMPLE

Page 13: BDD in open source projects - Is it really beneficial?

USES

PRIME EXAMPLE

BOTH TOOLS

Page 14: BDD in open source projects - Is it really beneficial?
Page 15: BDD in open source projects - Is it really beneficial?

TOOLSBDD IS NOT ABOUT

Page 16: BDD in open source projects - Is it really beneficial?

TOOLSBDD IS NOT ABOUT

METHODOLOGYBDD IS ABOUT

Page 17: BDD in open source projects - Is it really beneficial?

TOOL

Page 18: BDD in open source projects - Is it really beneficial?

TOOL

METHOD SpecBDD StoryBDD

Page 19: BDD in open source projects - Is it really beneficial?

TOOL

SYNTAX

METHOD SpecBDD StoryBDD

Code, Functions/Methods as specifications

Page 20: BDD in open source projects - Is it really beneficial?

TOOL

SYNTAX

METHOD SpecBDD StoryBDD

function it_greets_with_hello_world(){ $this->greet()->shouldReturn( 'Hello World' );}

Page 21: BDD in open source projects - Is it really beneficial?

TOOL

SYNTAX

METHOD SpecBDD StoryBDD

Plain text, one or more scenarios for (fictitious) user story, described as prose in given-when-then scheme (Gherkin syntax)

function it_greets_with_hello_world(){ $this->greet()->shouldReturn( 'Hello World' );}

Page 22: BDD in open source projects - Is it really beneficial?

TOOL

SYNTAXfunction it_greets_with_hello_world(){ $this->greet()->shouldReturn( 'Hello World' );}

Scenario: A successful scenario Given a precondition When an event occurred Then an outcome is achieved

METHOD SpecBDD StoryBDD

Page 23: BDD in open source projects - Is it really beneficial?

TOOL

NOTION

SYNTAXfunction it_greets_with_hello_world(){ $this->greet()->shouldReturn( 'Hello World' );}

Scenario: A successful scenario Given a precondition When an event occurred Then an outcome is achieved

Dan North 2003:

names of test methods describe intended behavior

METHOD SpecBDD StoryBDD

Page 24: BDD in open source projects - Is it really beneficial?

TOOL

NOTION

SYNTAX

“TDD done right”

function it_greets_with_hello_world(){ $this->greet()->shouldReturn( 'Hello World' );}

Scenario: A successful scenario Given a precondition When an event occurred Then an outcome is achieved

METHOD SpecBDD StoryBDD

Page 25: BDD in open source projects - Is it really beneficial?

Should you use SpecBDD as substitute for xUnit?

QUESTION #1

Page 26: BDD in open source projects - Is it really beneficial?

Should you use SpecBDD as substitute for xUnit?

phpspec PHPUnit

QUESTION #1

Page 27: BDD in open source projects - Is it really beneficial?

no problem in principalPROJECT

CUSTOMER

Should you use SpecBDD as substitute for xUnit?

phpspec PHPUnit

QUESTION #1

Page 28: BDD in open source projects - Is it really beneficial?

no problem in principalPROJECT

CUSTOMER

PROJECTOPEN-SOURCE community developers unfamiliar with the code might be irritated

Should you use SpecBDD as substitute for xUnit?

phpspec PHPUnit

QUESTION #1

Page 29: BDD in open source projects - Is it really beneficial?

no problem in principalPROJECT

CUSTOMER

PROJECTOPEN-SOURCE community developers unfamiliar with the code might be irritated

“Where are the unit tests?”“How to unit test with that?”

Should you use SpecBDD as substitute for xUnit?

phpspec PHPUnit

QUESTION #1

Page 30: BDD in open source projects - Is it really beneficial?

no problem in principalPROJECT

CUSTOMER

PROJECTOPEN-SOURCE community developers unfamiliar with the code might be irritated

“Where are the unit tests?”“How to unit test with that?”

Should you use SpecBDD as substitute for xUnit?

phpspec PHPUnit

QUESTION #1

Page 31: BDD in open source projects - Is it really beneficial?

TOOL

NOTION

SYNTAX

“TDD done right”

function it_greets_with_hello_world(){ $this->greet()->shouldReturn( 'Hello World' );}

Scenario: A successful scenario Given a precondition When an event occurred Then an outcome is achieved

?

METHOD SpecBDD StoryBDD

Page 32: BDD in open source projects - Is it really beneficial?

TOOL

NOTION

SYNTAX

“TDD done right”

function it_greets_with_hello_world(){ $this->greet()->shouldReturn( 'Hello World' );}

Scenario: A successful scenario Given a precondition When an event occurred Then an outcome is achieved

Dan North 2011:

« BDD is about understanding the customer's need [...] (and being able to prove that with an evolving suite of acceptance tests) »

METHOD SpecBDD StoryBDD

Page 33: BDD in open source projects - Is it really beneficial?

TOOL

NOTION

SYNTAX

“TDD done right”

function it_greets_with_hello_world(){ $this->greet()->shouldReturn( 'Hello World' );}

Scenario: A successful scenario Given a precondition When an event occurred Then an outcome is achieved

understanding customer’s need + evolving suite of acceptance tests

METHOD SpecBDD StoryBDD

Page 34: BDD in open source projects - Is it really beneficial?

STORYBDD IN DETAIL

Page 35: BDD in open source projects - Is it really beneficial?

STORYBDD IN DETAIL

implementing something correctly && implementing the right thing

Page 36: BDD in open source projects - Is it really beneficial?

STORYBDD IN DETAIL

implementing something correctly && implementing the right thing

acceptance tests are secondary to the understanding

Page 37: BDD in open source projects - Is it really beneficial?

STORYBDD IN DETAIL

implementing something correctly && implementing the right thing

acceptance tests are secondary to the understanding

customer explicitly asks for their production && co-produces them

Page 38: BDD in open source projects - Is it really beneficial?

STORYBDD IN DETAIL

implementing something correctly && implementing the right thing

acceptance tests are secondary to the understanding

customer explicitly asks for their production && co-produces them

Page 39: BDD in open source projects - Is it really beneficial?

Who decides what the right thing is?

QUESTION #2

Page 40: BDD in open source projects - Is it really beneficial?

customer, thus no problemPROJECT

CUSTOMER

Who decides what the right thing is?

QUESTION #2

Page 41: BDD in open source projects - Is it really beneficial?

customer, thus no problemPROJECT

CUSTOMER

PROJECTOPEN-SOURCE developer, thus potential problem

Who decides what the right thing is?

QUESTION #2

Page 42: BDD in open source projects - Is it really beneficial?

customer, thus no problemPROJECT

CUSTOMER

PROJECTOPEN-SOURCE developer, thus potential problem

customer === (other) developers (i.e. bundle level) → no problemelsewise (i.e. application level) → “language of the customer” is not met

Who decides what the right thing is?

QUESTION #2

Page 43: BDD in open source projects - Is it really beneficial?

customer, thus no problemPROJECT

CUSTOMER

PROJECTOPEN-SOURCE developer, thus potential problem

customer === (other) developers (i.e. bundle level) → no problemelsewise (i.e. application level) → “language of the customer” is not met

Who decides what the right thing is?

QUESTION #2

Page 44: BDD in open source projects - Is it really beneficial?

STORYBDD IN DETAIL

implementing something correctly && implementing the right thing

acceptance tests are secondary to the understanding

customer explicitly asks for their production && co-produces them

Page 45: BDD in open source projects - Is it really beneficial?

How to facilitate understanding?

QUESTION #3

Page 46: BDD in open source projects - Is it really beneficial?

face-to-face communication, thus no problemPROJECT

CUSTOMER

How to facilitate understanding?

QUESTION #3

Page 47: BDD in open source projects - Is it really beneficial?

face-to-face communication, thus no problemPROJECT

CUSTOMER

PROJECTOPEN-SOURCE communication mainly via issue tracker. pull requests, Twitter, etc.

→ StoryBDD is impeded

How to facilitate understanding?

QUESTION #3

Page 48: BDD in open source projects - Is it really beneficial?

face-to-face communication, thus no problemPROJECT

CUSTOMER

PROJECTOPEN-SOURCE communication mainly via issue tracker. pull requests, Twitter, etc.

→ StoryBDD is impeded→ but StoryBDD is the solution

How to facilitate understanding?

QUESTION #3

Page 49: BDD in open source projects - Is it really beneficial?

face-to-face communication, thus no problemPROJECT

CUSTOMER

PROJECTOPEN-SOURCE communication mainly via issue tracker. pull requests, Twitter, etc.

→ StoryBDD is impeded→ but StoryBDD is the solution

(watching the execution of the Behat suite live in a browser facilitates your understanding about the features of the open-source project)

How to facilitate understanding?

QUESTION #3

Page 50: BDD in open source projects - Is it really beneficial?

face-to-face communication, thus no problemPROJECT

CUSTOMER

PROJECTOPEN-SOURCE communication mainly via issue tracker. pull requests, Twitter, etc.

→ StoryBDD is impeded→ but StoryBDD is the solution

(watching the execution of the Behat suite live in a browser facilitates your understanding about the features of the open-source project)

How to facilitate understanding?

QUESTION #3

(but browser is emulated so far)

Page 51: BDD in open source projects - Is it really beneficial?

STORYBDD IN DETAIL

implementing something correctly && implementing the right thing

acceptance tests are secondary to the understanding

customer explicitly asks for their production && co-produces them

Page 52: BDD in open source projects - Is it really beneficial?

Who asks for their production?

QUESTION #4

Page 53: BDD in open source projects - Is it really beneficial?

customer, thus no problemPROJECT

CUSTOMER

Who asks for their production?

QUESTION #4

Page 54: BDD in open source projects - Is it really beneficial?

customer, thus no problemPROJECT

CUSTOMER

PROJECTOPEN-SOURCE (some) community developers, thus potential problem

Who asks for their production?

QUESTION #4

Page 55: BDD in open source projects - Is it really beneficial?

customer, thus no problemPROJECT

CUSTOMER

PROJECTOPEN-SOURCE (some) community developers, thus potential problem

StoryBDD might be process overhead → more impediment than benefit

Who asks for their production?

QUESTION #4

Page 56: BDD in open source projects - Is it really beneficial?

customer, thus no problemPROJECT

CUSTOMER

PROJECTOPEN-SOURCE (some) community developers, thus potential problem

StoryBDD might be process overhead → more impediment than benefit

“The code doesn’t get green anymore!”“If the worst comes to the worst, who decides to abandon Behat?”

Who asks for their production?

QUESTION #4

Page 57: BDD in open source projects - Is it really beneficial?

customer, thus no problemPROJECT

CUSTOMER

PROJECTOPEN-SOURCE (some) community developers, thus potential problem

StoryBDD might be process overhead → more impediment than benefit

“The code doesn’t get green anymore!”“If the worst comes to the worst, who decides to abandon Behat?”

Who asks for their production?

QUESTION #4

(at early development stage)

Page 58: BDD in open source projects - Is it really beneficial?

CONCLUSION

Page 59: BDD in open source projects - Is it really beneficial?

CONCLUSION

Page 60: BDD in open source projects - Is it really beneficial?

CONCLUSION

SpecBDD might benefit open-source projects.

Page 61: BDD in open source projects - Is it really beneficial?

CONCLUSION

SpecBDD might benefit open-source projects.

StoryBDD might benefit open-source projects.

Page 62: BDD in open source projects - Is it really beneficial?

CONCLUSION

SpecBDD might benefit open-source projects.

StoryBDD might benefit open-source projects.(even more than customer projects)

Page 63: BDD in open source projects - Is it really beneficial?

CONCLUSION

SpecBDD might benefit open-source projects.

StoryBDD might benefit open-source projects.(even more than customer projects)

StoryBDD might impede open-source projects.

Page 64: BDD in open source projects - Is it really beneficial?

CONCLUSION

SpecBDD might benefit open-source projects.

StoryBDD might benefit open-source projects.(even more than customer projects)

StoryBDD might impede open-source projects.

What to do?

Page 65: BDD in open source projects - Is it really beneficial?

CONCLUSION

SpecBDD might benefit open-source projects.

StoryBDD might benefit open-source projects.(even more than customer projects)

StoryBDD might impede open-source projects.

What to do?

Contribute!

Page 66: BDD in open source projects - Is it really beneficial?

CONCLUSION

SpecBDD might benefit open-source projects.

StoryBDD might benefit open-source projects.(even more than customer projects)

StoryBDD might impede open-source projects.

e.g.

What to do?

Contribute!

Page 67: BDD in open source projects - Is it really beneficial?

QUESTIONS?

Quotes:Slide 06: How to sell BDD to the business by Dan NorthSlide 32: Defining BDD by Dan North

Photo Credits:Slide 01: off to save something by bokeh burgerSlide 04: Alpkäse, Aeschi bei Spiez by Time.CapturedSlide 12: Background image by SyliusSlide 15: Swiss Army by Jim PennucciSlide 58: Vancouver Symphony Orchestra with Bramwell Tovey by Vancouver 125

@head_revision

[email protected]

www.ymc.ch