SlideShare une entreprise Scribd logo
1  sur  20
Télécharger pour lire hors ligne
SpecBDD with 
phpspec 
Tassi Francesco
A php toolset to drive emergent 
design by specification. 
http://www.phpspec.net/
It helps you with 
boring stuff
New classes… 
boOoOred
Constructor… 
boOoOred
New methods… 
boOoOred
Syntax just make 
sense
Obvious SUT 
You’re testing just one class, 
no need to instantiate it. 
! 
$this is your SUT
Natural language 
The method your testing
Natural language 
What it should be doing 
-> shouldBe 
-> shouldEqual 
-> shouldBeEqualTo 
-> shouldBeLike 
-> shouldThrow
Constructor args 
let our SUT be constructed 
with …
Easy mocking 
All you need to define a mock 
is add it as an argument of 
your spec
Easy mocking 
A method with some 
arguments should be called 
during the test
Easy mocking 
A method will return some 
value.
Easy mocking 
Same instance. Of course, 
they have the same name and 
the same type after all
There’s more 
magic to come
Templates 
Configuration 
Matchers ! 
Formatters
Let’s go see the 
prophet 
https://github.com/phpspec/prophecy
Prophet 
Prophecy is a highly opinionated yet very 
powerful and flexible PHP object mocking 
framework. Though initially it was created to fulfil 
phpspec2 needs, it is flexible enough to be used 
inside any testing framework out there with 
minimal effort. 
Use it !
SpecBDD with phpspec

Contenu connexe

Tendances (6)

How to debugging
How to debuggingHow to debugging
How to debugging
 
Python unit testing
Python unit testingPython unit testing
Python unit testing
 
Software Audit - Premiere Pro
Software Audit - Premiere ProSoftware Audit - Premiere Pro
Software Audit - Premiere Pro
 
Rc2010 tdd
Rc2010 tddRc2010 tdd
Rc2010 tdd
 
Python Testing Fundamentals
Python Testing FundamentalsPython Testing Fundamentals
Python Testing Fundamentals
 
PHPUnit from a developer's perspective
PHPUnit from a developer's perspectivePHPUnit from a developer's perspective
PHPUnit from a developer's perspective
 

En vedette

Company profile
Company profileCompany profile
Company profile
Andrea Pia
 
Hackatron - UIKit Dynamics
Hackatron - UIKit DynamicsHackatron - UIKit Dynamics
Hackatron - UIKit Dynamics
Renzo G. Pretto
 
Tesi Di Laurea Alessi e commerce
Tesi Di Laurea Alessi e commerceTesi Di Laurea Alessi e commerce
Tesi Di Laurea Alessi e commerce
Daniele Pagani
 
Enhanced contextual interactions
Enhanced contextual interactionsEnhanced contextual interactions
Enhanced contextual interactions
Luca Quattrin
 

En vedette (15)

Un anno di startup
Un anno di startupUn anno di startup
Un anno di startup
 
Wavekit light
Wavekit lightWavekit light
Wavekit light
 
homology
homologyhomology
homology
 
Company profile
Company profileCompany profile
Company profile
 
Livello 7 - presentations with a reason
Livello 7 - presentations with a reasonLivello 7 - presentations with a reason
Livello 7 - presentations with a reason
 
Hackatron - UIKit Dynamics
Hackatron - UIKit DynamicsHackatron - UIKit Dynamics
Hackatron - UIKit Dynamics
 
Marco Maggioni Design Portfolio
Marco Maggioni Design PortfolioMarco Maggioni Design Portfolio
Marco Maggioni Design Portfolio
 
FF story - Summer Edition
FF story - Summer EditionFF story - Summer Edition
FF story - Summer Edition
 
Organizzazione e Leadership nella Chiesa di Gesù Cristo dei Santi degli Ultim...
Organizzazione e Leadership nella Chiesa di Gesù Cristo dei Santi degli Ultim...Organizzazione e Leadership nella Chiesa di Gesù Cristo dei Santi degli Ultim...
Organizzazione e Leadership nella Chiesa di Gesù Cristo dei Santi degli Ultim...
 
Tesi Di Laurea Alessi e commerce
Tesi Di Laurea Alessi e commerceTesi Di Laurea Alessi e commerce
Tesi Di Laurea Alessi e commerce
 
The new era of bots, multi-channel messaging solutions, dynamic routing and a...
The new era of bots, multi-channel messaging solutions, dynamic routing and a...The new era of bots, multi-channel messaging solutions, dynamic routing and a...
The new era of bots, multi-channel messaging solutions, dynamic routing and a...
 
Enhanced contextual interactions
Enhanced contextual interactionsEnhanced contextual interactions
Enhanced contextual interactions
 
Como construir un Fab Lab - FEED2015 20.11.2015
Como construir un Fab Lab - FEED2015 20.11.2015Como construir un Fab Lab - FEED2015 20.11.2015
Como construir un Fab Lab - FEED2015 20.11.2015
 
Berlin HackDay '12 Challengin Pitch
Berlin HackDay '12 Challengin PitchBerlin HackDay '12 Challengin Pitch
Berlin HackDay '12 Challengin Pitch
 
RSpec 2 Best practices
RSpec 2 Best practicesRSpec 2 Best practices
RSpec 2 Best practices
 

Similaire à SpecBDD with phpspec

Listen and look at your PHP code
Listen and look at your PHP codeListen and look at your PHP code
Listen and look at your PHP code
Gabriele Santini
 
PowerShell Core Skills (TechMentor Fall 2011)
PowerShell Core Skills (TechMentor Fall 2011)PowerShell Core Skills (TechMentor Fall 2011)
PowerShell Core Skills (TechMentor Fall 2011)
Concentrated Technology
 
Theory and practice – migrating your legacy code into our modern test drive...
Theory and practice – migrating your  legacy code into our modern test  drive...Theory and practice – migrating your  legacy code into our modern test  drive...
Theory and practice – migrating your legacy code into our modern test drive...
Lars Jankowfsky
 

Similaire à SpecBDD with phpspec (20)

Listen and look at your PHP code
Listen and look at your PHP codeListen and look at your PHP code
Listen and look at your PHP code
 
Like SpecFlow
Like SpecFlowLike SpecFlow
Like SpecFlow
 
Test Driven Infrastructure
Test Driven InfrastructureTest Driven Infrastructure
Test Driven Infrastructure
 
PowerShell Core Skills (TechMentor Fall 2011)
PowerShell Core Skills (TechMentor Fall 2011)PowerShell Core Skills (TechMentor Fall 2011)
PowerShell Core Skills (TechMentor Fall 2011)
 
Cursus phpunit
Cursus phpunitCursus phpunit
Cursus phpunit
 
Refactoring - An Introduction
Refactoring - An IntroductionRefactoring - An Introduction
Refactoring - An Introduction
 
Listen afup 2010
Listen afup 2010Listen afup 2010
Listen afup 2010
 
Code Retreat
Code RetreatCode Retreat
Code Retreat
 
Everything you need to know about PowerShell
Everything you need to know about PowerShellEverything you need to know about PowerShell
Everything you need to know about PowerShell
 
It's all about behaviour, also in php - phpspec
It's all about behaviour, also in php - phpspecIt's all about behaviour, also in php - phpspec
It's all about behaviour, also in php - phpspec
 
Tdd is not about testing
Tdd is not about testingTdd is not about testing
Tdd is not about testing
 
Advanced java script essentials v1
Advanced java script essentials v1Advanced java script essentials v1
Advanced java script essentials v1
 
Introduction to Unit Testing
Introduction to Unit TestingIntroduction to Unit Testing
Introduction to Unit Testing
 
TDD, BDD, RSpec
TDD, BDD, RSpecTDD, BDD, RSpec
TDD, BDD, RSpec
 
PHPUnit: from zero to hero
PHPUnit: from zero to heroPHPUnit: from zero to hero
PHPUnit: from zero to hero
 
Testing PHP with Codeception
Testing PHP with CodeceptionTesting PHP with Codeception
Testing PHP with Codeception
 
Programming in Java: Getting Started
Programming in Java: Getting StartedProgramming in Java: Getting Started
Programming in Java: Getting Started
 
Few minutes To better Code - Refactoring
Few minutes To better Code - RefactoringFew minutes To better Code - Refactoring
Few minutes To better Code - Refactoring
 
Theory and practice – migrating your legacy code into our modern test drive...
Theory and practice – migrating your  legacy code into our modern test  drive...Theory and practice – migrating your  legacy code into our modern test  drive...
Theory and practice – migrating your legacy code into our modern test drive...
 
Php test fest
Php test festPhp test fest
Php test fest
 

Dernier

CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 

Dernier (20)

The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 

SpecBDD with phpspec