full stack bdd for symfony2
DESCRIPTION
Many Symfony2 developers have heard about Behat and even use it regularly in their Symfony projects. If you have found value in this tool and the BDD practices it was inspired on, come join us for this talk as we will expand on what other benefits these practices and other BDD tools available can bring. This very illustrative talk will not only present you with the tools but show how to use them together to build beautifully architected, business-oriented Symfony2 applications.TRANSCRIPT
![Page 1: Full stack BDD for Symfony2](https://reader033.vdocuments.us/reader033/viewer/2022051412/54b772f94a7959df648b4595/html5/thumbnails/1.jpg)
Full Stack BDD for Symfony2
Marcello DuarteKonstantin Kudryashov
![Page 2: Full stack BDD for Symfony2](https://reader033.vdocuments.us/reader033/viewer/2022051412/54b772f94a7959df648b4595/html5/thumbnails/2.jpg)
Marcello DuarteHead of Training
Konstantin KudryashovLead Developer
About us
![Page 3: Full stack BDD for Symfony2](https://reader033.vdocuments.us/reader033/viewer/2022051412/54b772f94a7959df648b4595/html5/thumbnails/3.jpg)
• Where are we coming from
• Why BDD
• Behat Best Practices
• Introducing a new tool
This talk
![Page 4: Full stack BDD for Symfony2](https://reader033.vdocuments.us/reader033/viewer/2022051412/54b772f94a7959df648b4595/html5/thumbnails/4.jpg)
fromCucumber to
![Page 5: Full stack BDD for Symfony2](https://reader033.vdocuments.us/reader033/viewer/2022051412/54b772f94a7959df648b4595/html5/thumbnails/5.jpg)
![Page 6: Full stack BDD for Symfony2](https://reader033.vdocuments.us/reader033/viewer/2022051412/54b772f94a7959df648b4595/html5/thumbnails/6.jpg)
Adults don’t think their way into a new
way of acting
![Page 7: Full stack BDD for Symfony2](https://reader033.vdocuments.us/reader033/viewer/2022051412/54b772f94a7959df648b4595/html5/thumbnails/7.jpg)
They act their way into a new way of
thinking
Adults don’t think their way into a new
way of acting
![Page 8: Full stack BDD for Symfony2](https://reader033.vdocuments.us/reader033/viewer/2022051412/54b772f94a7959df648b4595/html5/thumbnails/8.jpg)
Ask Why
![Page 9: Full stack BDD for Symfony2](https://reader033.vdocuments.us/reader033/viewer/2022051412/54b772f94a7959df648b4595/html5/thumbnails/9.jpg)
PHPSpec
from xUnit to xSpec
![Page 10: Full stack BDD for Symfony2](https://reader033.vdocuments.us/reader033/viewer/2022051412/54b772f94a7959df648b4595/html5/thumbnails/10.jpg)
Test
? ???
? ? ?
?
??
?
?
?
?
?
?
? ?
![Page 11: Full stack BDD for Symfony2](https://reader033.vdocuments.us/reader033/viewer/2022051412/54b772f94a7959df648b4595/html5/thumbnails/11.jpg)
xUnit
assert
code coverage
structure
private
database mocking
![Page 12: Full stack BDD for Symfony2](https://reader033.vdocuments.us/reader033/viewer/2022051412/54b772f94a7959df648b4595/html5/thumbnails/12.jpg)
Language matter
![Page 13: Full stack BDD for Symfony2](https://reader033.vdocuments.us/reader033/viewer/2022051412/54b772f94a7959df648b4595/html5/thumbnails/13.jpg)
public function testUpdateWithEqualTypes() { $installer = $this->createInstallerMock(); $manager = new InstallationManager('vendor'); $manager->addInstaller($installer);
$initial = $this->createPackageMock(); $target = $this->createPackageMock(); $operation = new UpdateOperation($initial, $target, 'test');
$initial ->expects($this->once()) ->method('getType') ->will($this->returnValue('library')); $target ->expects($this->once()) ->method('getType') ->will($this->returnValue('library'));
$installer ->expects($this->once()) ->method('supports') ->with('library') ->will($this->returnValue(true));
$installer ->expects($this->once()) ->method('update') ->with($this->repository, $initial, $target);
![Page 14: Full stack BDD for Symfony2](https://reader033.vdocuments.us/reader033/viewer/2022051412/54b772f94a7959df648b4595/html5/thumbnails/14.jpg)
Tools matter
![Page 15: Full stack BDD for Symfony2](https://reader033.vdocuments.us/reader033/viewer/2022051412/54b772f94a7959df648b4595/html5/thumbnails/15.jpg)
Why BDD?
![Page 16: Full stack BDD for Symfony2](https://reader033.vdocuments.us/reader033/viewer/2022051412/54b772f94a7959df648b4595/html5/thumbnails/16.jpg)
[Royce 1970]
Requirements
Analysis
Design
Develop
Test
9 months 3 months 2 months 12 months ...
![Page 17: Full stack BDD for Symfony2](https://reader033.vdocuments.us/reader033/viewer/2022051412/54b772f94a7959df648b4595/html5/thumbnails/17.jpg)
Most of the cost in software development
is infeedback delay
![Page 18: Full stack BDD for Symfony2](https://reader033.vdocuments.us/reader033/viewer/2022051412/54b772f94a7959df648b4595/html5/thumbnails/18.jpg)
Refactoring
Code
Test
Requirements
Acceptance
~20 minutes
[Beck & Cunningham 1996-99]
![Page 19: Full stack BDD for Symfony2](https://reader033.vdocuments.us/reader033/viewer/2022051412/54b772f94a7959df648b4595/html5/thumbnails/19.jpg)
Let’s reduce feedback delay
![Page 20: Full stack BDD for Symfony2](https://reader033.vdocuments.us/reader033/viewer/2022051412/54b772f94a7959df648b4595/html5/thumbnails/20.jpg)
Let’s rename a few things
![Page 21: Full stack BDD for Symfony2](https://reader033.vdocuments.us/reader033/viewer/2022051412/54b772f94a7959df648b4595/html5/thumbnails/21.jpg)
Incremental Design
Implement
Describe Object
Narratives (Why?)
Examples (What do you
mean?)
How!
[North 03]
![Page 22: Full stack BDD for Symfony2](https://reader033.vdocuments.us/reader033/viewer/2022051412/54b772f94a7959df648b4595/html5/thumbnails/22.jpg)
![Page 23: Full stack BDD for Symfony2](https://reader033.vdocuments.us/reader033/viewer/2022051412/54b772f94a7959df648b4595/html5/thumbnails/23.jpg)
Building a simple
Student can enrol on a course
feature
![Page 25: Full stack BDD for Symfony2](https://reader033.vdocuments.us/reader033/viewer/2022051412/54b772f94a7959df648b4595/html5/thumbnails/25.jpg)
• No examples until you have a red step
• No code until you have a red example
• No more code than enough to make it green
• Don’t get carried away!
BDD Rules
![Page 26: Full stack BDD for Symfony2](https://reader033.vdocuments.us/reader033/viewer/2022051412/54b772f94a7959df648b4595/html5/thumbnails/26.jpg)
• Favour MinkAwareInterface over MinkContext
• Extract context per role
• Group features under feature folder
• Use Mink API
• Integrate with framework at config level
Behat tips
![Page 27: Full stack BDD for Symfony2](https://reader033.vdocuments.us/reader033/viewer/2022051412/54b772f94a7959df648b4595/html5/thumbnails/27.jpg)
• Describe classes not configuration
• Concentrate on messages/behaviours
PHPSpec2 tips
![Page 28: Full stack BDD for Symfony2](https://reader033.vdocuments.us/reader033/viewer/2022051412/54b772f94a7959df648b4595/html5/thumbnails/28.jpg)
Questions
? ???
? ? ?
?
??
?
?
?
?
?
?
? ?
![Page 29: Full stack BDD for Symfony2](https://reader033.vdocuments.us/reader033/viewer/2022051412/54b772f94a7959df648b4595/html5/thumbnails/29.jpg)
joind.in/7064
Thanks! :)