Upload
fabian-kiss
View
3.628
Download
2
Tags:
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
BDD in open-source projectsIs it really beneficial?
FABIAN KISS
I AM
Fabian Kiss@head_revision
Passionate Behat user, contributor, and blogger
headrevision
I WORK AT
WE ARE HERE@ymc_ch
www.ymc.ch
I WILL
Question BDD!
I WILL
Question BDD!
Dan North: « BDD is a [...] multiple-stakeholder, agile methodology »
I WILL
BDD is beneficial in agile customer projects.
Dan North: « BDD is a [...] multiple-stakeholder, agile methodology »
Question BDD!
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
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
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
PRIME EXAMPLE
USES
PRIME EXAMPLE
BOTH TOOLS
TOOLSBDD IS NOT ABOUT
TOOLSBDD IS NOT ABOUT
METHODOLOGYBDD IS ABOUT
TOOL
TOOL
METHOD SpecBDD StoryBDD
TOOL
SYNTAX
METHOD SpecBDD StoryBDD
Code, Functions/Methods as specifications
TOOL
SYNTAX
METHOD SpecBDD StoryBDD
function it_greets_with_hello_world(){ $this->greet()->shouldReturn( 'Hello World' );}
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' );}
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
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
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
Should you use SpecBDD as substitute for xUnit?
QUESTION #1
Should you use SpecBDD as substitute for xUnit?
phpspec PHPUnit
QUESTION #1
no problem in principalPROJECT
CUSTOMER
Should you use SpecBDD as substitute for xUnit?
phpspec PHPUnit
QUESTION #1
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
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
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
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
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
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
STORYBDD IN DETAIL
STORYBDD IN DETAIL
implementing something correctly && implementing the right thing
STORYBDD IN DETAIL
implementing something correctly && implementing the right thing
acceptance tests are secondary to the understanding
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
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
Who decides what the right thing is?
QUESTION #2
customer, thus no problemPROJECT
CUSTOMER
Who decides what the right thing is?
QUESTION #2
customer, thus no problemPROJECT
CUSTOMER
PROJECTOPEN-SOURCE developer, thus potential problem
Who decides what the right thing is?
QUESTION #2
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
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
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
How to facilitate understanding?
QUESTION #3
face-to-face communication, thus no problemPROJECT
CUSTOMER
How to facilitate understanding?
QUESTION #3
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
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
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
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)
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
Who asks for their production?
QUESTION #4
customer, thus no problemPROJECT
CUSTOMER
Who asks for their production?
QUESTION #4
customer, thus no problemPROJECT
CUSTOMER
PROJECTOPEN-SOURCE (some) community developers, thus potential problem
Who asks for their production?
QUESTION #4
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
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
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)
CONCLUSION
CONCLUSION
CONCLUSION
SpecBDD might benefit open-source projects.
CONCLUSION
SpecBDD might benefit open-source projects.
StoryBDD might benefit open-source projects.
CONCLUSION
SpecBDD might benefit open-source projects.
StoryBDD might benefit open-source projects.(even more than customer projects)
CONCLUSION
SpecBDD might benefit open-source projects.
StoryBDD might benefit open-source projects.(even more than customer projects)
StoryBDD might impede open-source projects.
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?
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!
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!
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
www.ymc.ch