SlideShare uma empresa Scribd logo
1 de 43
Baixar para ler offline
ASYOU MEANT IT…


NFluent: the craft you needed 

to boost yourTDD

Brown Bag Lunch - 2014	

!
!
@tpierrain @cyrdup
WHO ARE WE?
use case driven (blog) Many Cores (blog)
UNITTESTS FROMTHE
TRENCHES…
COMMENTS?
IDEAL WORLD
HARD FACT #1	

Tests assertions are needlessly difficult to write
!
HARD FACT #1	

Tests assertions are needlessly difficult to write
!
HARD FACT #1	

Tests assertions are needlessly difficult to write
!
HARD FACT #1	

CONSEQUENCES
error-prone

reluctance to write tests

relevance of tests?
Tests assertions are needlessly difficult to write
!
#1:WE DESERVE NO BRAINER
ASSERTIONS!
HARD FACT #2
Test intentions may be difficult to grasp
HARD FACT #2
CONSEQUENCES
tests are hard to maintain

loss of trust in existing tests

Removal of failing tests?
Test intentions may be difficult to grasp
#2: TESTS INTENTIONS
SHOULD BE OBVIOUS!
HARD FACT #3	

When reliable… error messages are often unhelpful
HARD FACT #3	

CONSEQUENCES
Need to debug the failing test to understand

slowwww… TDD feedback loop

Poor efficiency?!?	

When reliable… error messages are often unhelpful
#3:WE WANTTRUSTWORTHY	

& HELPFUL ERROR MESSAGES!
#3:WE WANTTRUSTWORTHY	

& HELPFUL ERROR MESSAGES!
TDD IS NOT EASY…
TDD IS NOT EASY…



… but NFluent will greatly help you
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
(source: http://www.thefreedictionary.com/fluent)	

UBIQUITOUS LANGUAGE
Fluent [ˈfluːənt]
adj
1. spoken or written with ease: fluent French.	

2. able to speak or write smoothly, easily, or readily: fluent
in three languages.	

3. smooth; easy; graceful: fluent motion	

4. flowing or capable of flowing; fluid	

!
[from Latin: fluere to flow, stream]
#1: NO BRAINER ASSERTIONS!	

NFLUENT’S ANSWERS
#2: OBVIOUSTESTS INTENTIONS!	

#3:TRUSTWORTHY & HELPFUL 

ERROR MESSAGES!
#1: NO BRAINER ASSERTIONS!	

NFLUENT’S ANSWERS
A unique entry point for assertions (Check.That)


IntelliSense guided writing (a.k.a. the super-duper-happy dot xp)
#2: OBVIOUSTESTS INTENTIONS!	

#3:TRUSTWORTHY & HELPFUL 

ERROR MESSAGES!
#1: NO BRAINER ASSERTIONS!	

NFLUENT’S ANSWERS
Natural language assertions
A unique entry point for assertions (Check.That)


IntelliSense guided writing (a.k.a. the super-duper-happy dot xp)
#2: OBVIOUSTESTS INTENTIONS!	

#3:TRUSTWORTHY & HELPFUL 

ERROR MESSAGES!
#1: NO BRAINER ASSERTIONS!	

NFLUENT’S ANSWERS
Natural language assertions
A unique entry point for assertions (Check.That)


IntelliSense guided writing (a.k.a. the super-duper-happy dot xp)
Non ambiguous, contextualized and explicit error messages
#2: OBVIOUSTESTS INTENTIONS!	

#3:TRUSTWORTHY & HELPFUL 

ERROR MESSAGES!
COMBINING THOSE 3 WISHES, 	

WE CAN REACH OUR IDEAL:

EFFICIENT TDD!
!
!
!
!
!
!
!
NFLUENT SAMPLES
DEMO
• NFluent is	

• An OSS .NET library for fluent assertions	

• Independent and compliant with all major .NET test runners	

• Directly inspired by the awesome Java FEST assert library	

• Available on
IN A FEW WORDS
• A fully extensible model
• No need to wait the NFluent team to add your own
assertions on any kind of ‘value’	

• The opportunity to use your own ubiquitous language
(DSL) from within your tests	

!
• Some extra candies	

• Like the Properties extension method for IEnumerable	

• The HasFieldsWithSameValues(anonymous class)
BONUS FEATURES
!
!










	

INTHE WILD
tpierrain malatrhwydupdob
FINAL QUESTION
!
!
!
!
!


Does your test framework dictate the way you work,
or is it the other way around?
FINAL QUESTION
APPLYTDD!
APPLYTDD!
Use NFluent!
APPLYTDD!
Use NFluent!
APPLYTDD!
Use NFluent!
http://www.n-fluent.net
APPENDIX
TDD:A WORKFLOW
(like: FluentAssertion, SharpTests Ex, etc.)

• Their usage of lambda expression predicates hurts the fluent
experience	

	

 	

 new[] { 1, 2, 3 }.Should().Contain(item => item > 3, "at least {0} item should be larger than 3", 1);	

• (Red is dead, but) Should is weak…	

• We aim to be more ambitious in term of fluentness
NFLUENT VS. OTHER
ASSERTION LIBRARIES?
• For NFluent contributors
• No warning (all warn as ERROR)	

• No StyleCop warning (full rules)	

• 100% of test coverage - all test passed of course!
• The entire build lasts less than a minute (including all unit
tests)
DEFINITION OF DONE
!
!
!
!
!
!
!
BYTEST DEVELOPMENT DRIVEN IS?


Use NFluent!
!
!
!
!
WRITEVALUABLETESTS
(NFluent logo © rhwy)	

!
http://www.n-fluent.net
Thank you!

Mais conteúdo relacionado

Mais de Thomas Pierrain

The 9 rules of debugging
The 9 rules of debuggingThe 9 rules of debugging
The 9 rules of debuggingThomas Pierrain
 
Hexagonal architecture vs Functional core / Imperative shell
Hexagonal architecture vs Functional core / Imperative shellHexagonal architecture vs Functional core / Imperative shell
Hexagonal architecture vs Functional core / Imperative shellThomas Pierrain
 
Une nuit dans l'hexagone
Une nuit dans l'hexagoneUne nuit dans l'hexagone
Une nuit dans l'hexagoneThomas Pierrain
 
As time goes by (episode 2)
As time goes by (episode 2)As time goes by (episode 2)
As time goes by (episode 2)Thomas Pierrain
 
Et si on parlait Éthique ?
Et si on parlait Éthique ?Et si on parlait Éthique ?
Et si on parlait Éthique ?Thomas Pierrain
 
Sortir de notre zone de confort
Sortir de notre zone de confortSortir de notre zone de confort
Sortir de notre zone de confortThomas Pierrain
 
L'Agilité a grande échelle : conserver l'esprit, pas la lettre
L'Agilité a grande échelle : conserver l'esprit, pas la lettreL'Agilité a grande échelle : conserver l'esprit, pas la lettre
L'Agilité a grande échelle : conserver l'esprit, pas la lettreThomas Pierrain
 
Legacy club (english version)
Legacy club (english version)Legacy club (english version)
Legacy club (english version)Thomas Pierrain
 
The art of Software Design
The art of Software DesignThe art of Software Design
The art of Software DesignThomas Pierrain
 
CQRS without event sourcing
CQRS without event sourcingCQRS without event sourcing
CQRS without event sourcingThomas Pierrain
 
Decouvrir CQRS (sans Event sourcing) par la pratique
Decouvrir CQRS (sans Event sourcing) par la pratiqueDecouvrir CQRS (sans Event sourcing) par la pratique
Decouvrir CQRS (sans Event sourcing) par la pratiqueThomas Pierrain
 
Decouvrir son sujet grace à l'event storming
Decouvrir son sujet grace à l'event stormingDecouvrir son sujet grace à l'event storming
Decouvrir son sujet grace à l'event stormingThomas Pierrain
 
Ddd reboot (english version)
Ddd reboot (english version)Ddd reboot (english version)
Ddd reboot (english version)Thomas Pierrain
 
Culture craft humantalks
Culture craft humantalksCulture craft humantalks
Culture craft humantalksThomas Pierrain
 
Coder sans peur du changement avec la meme pas mal hexagonal architecture
Coder sans peur du changement avec la meme pas mal hexagonal architectureCoder sans peur du changement avec la meme pas mal hexagonal architecture
Coder sans peur du changement avec la meme pas mal hexagonal architectureThomas Pierrain
 
TDD is dead?!? Let's do an autospy (ncrafts.io)
TDD is dead?!? Let's do an autospy (ncrafts.io)TDD is dead?!? Let's do an autospy (ncrafts.io)
TDD is dead?!? Let's do an autospy (ncrafts.io)Thomas Pierrain
 
Culture Craft Devoxx 2015
Culture Craft Devoxx 2015Culture Craft Devoxx 2015
Culture Craft Devoxx 2015Thomas Pierrain
 
Faible latence, haut debit PerfUG (Septembre 2014)
Faible latence, haut debit PerfUG (Septembre 2014)Faible latence, haut debit PerfUG (Septembre 2014)
Faible latence, haut debit PerfUG (Septembre 2014)Thomas Pierrain
 

Mais de Thomas Pierrain (20)

The 9 rules of debugging
The 9 rules of debuggingThe 9 rules of debugging
The 9 rules of debugging
 
Hexagonal architecture vs Functional core / Imperative shell
Hexagonal architecture vs Functional core / Imperative shellHexagonal architecture vs Functional core / Imperative shell
Hexagonal architecture vs Functional core / Imperative shell
 
Une nuit dans l'hexagone
Une nuit dans l'hexagoneUne nuit dans l'hexagone
Une nuit dans l'hexagone
 
Equiper sa voie
Equiper sa voieEquiper sa voie
Equiper sa voie
 
As time goes by (episode 2)
As time goes by (episode 2)As time goes by (episode 2)
As time goes by (episode 2)
 
Et si on parlait Éthique ?
Et si on parlait Éthique ?Et si on parlait Éthique ?
Et si on parlait Éthique ?
 
Sortir de notre zone de confort
Sortir de notre zone de confortSortir de notre zone de confort
Sortir de notre zone de confort
 
L'Agilité a grande échelle : conserver l'esprit, pas la lettre
L'Agilité a grande échelle : conserver l'esprit, pas la lettreL'Agilité a grande échelle : conserver l'esprit, pas la lettre
L'Agilité a grande échelle : conserver l'esprit, pas la lettre
 
Legacy club (english version)
Legacy club (english version)Legacy club (english version)
Legacy club (english version)
 
The art of Software Design
The art of Software DesignThe art of Software Design
The art of Software Design
 
CQRS without event sourcing
CQRS without event sourcingCQRS without event sourcing
CQRS without event sourcing
 
Async await...oh wait!
Async await...oh wait!Async await...oh wait!
Async await...oh wait!
 
Decouvrir CQRS (sans Event sourcing) par la pratique
Decouvrir CQRS (sans Event sourcing) par la pratiqueDecouvrir CQRS (sans Event sourcing) par la pratique
Decouvrir CQRS (sans Event sourcing) par la pratique
 
Decouvrir son sujet grace à l'event storming
Decouvrir son sujet grace à l'event stormingDecouvrir son sujet grace à l'event storming
Decouvrir son sujet grace à l'event storming
 
Ddd reboot (english version)
Ddd reboot (english version)Ddd reboot (english version)
Ddd reboot (english version)
 
Culture craft humantalks
Culture craft humantalksCulture craft humantalks
Culture craft humantalks
 
Coder sans peur du changement avec la meme pas mal hexagonal architecture
Coder sans peur du changement avec la meme pas mal hexagonal architectureCoder sans peur du changement avec la meme pas mal hexagonal architecture
Coder sans peur du changement avec la meme pas mal hexagonal architecture
 
TDD is dead?!? Let's do an autospy (ncrafts.io)
TDD is dead?!? Let's do an autospy (ncrafts.io)TDD is dead?!? Let's do an autospy (ncrafts.io)
TDD is dead?!? Let's do an autospy (ncrafts.io)
 
Culture Craft Devoxx 2015
Culture Craft Devoxx 2015Culture Craft Devoxx 2015
Culture Craft Devoxx 2015
 
Faible latence, haut debit PerfUG (Septembre 2014)
Faible latence, haut debit PerfUG (Septembre 2014)Faible latence, haut debit PerfUG (Septembre 2014)
Faible latence, haut debit PerfUG (Septembre 2014)
 

Último

Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...SelfMade bd
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfVishalKumarJha10
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...Shane Coughlan
 
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..pdfPearlKirahMaeRagusta1
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...masabamasaba
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisamasabamasaba
 
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-...Steffen Staab
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareJim McKeeth
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionOnePlan Solutions
 
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...Nitya salvi
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplatePresentation.STUDIO
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastPapp Krisztián
 
Generic or specific? Making sensible software design decisions
Generic or specific? Making sensible software design decisionsGeneric or specific? Making sensible software design decisions
Generic or specific? Making sensible software design decisionsBert Jan Schrijver
 
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...panagenda
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
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 GoalsJhone kinadey
 
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfThe Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfayushiqss
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 

Último (20)

Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
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
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
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-...
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
Generic or specific? Making sensible software design decisions
Generic or specific? Making sensible software design decisionsGeneric or specific? Making sensible software design decisions
Generic or specific? Making sensible software design decisions
 
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...
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
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
 
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
 
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfThe Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 

NFluent Brown bag lunch January 2014