SlideShare una empresa de Scribd logo
1 de 43
Descargar para leer sin conexión
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!

Más contenido relacionado

Más 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
 

Más 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

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 ...OnePlan Solutions
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
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
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
Clustering techniques data mining book ....
Clustering techniques data mining book ....Clustering techniques data mining book ....
Clustering techniques data mining book ....ShaimaaMohamedGalal
 
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 PrecisionSolGuruz
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
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
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
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 ...harshavardhanraghave
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 
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...ICS
 

Último (20)

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
 
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 ...
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
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
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Clustering techniques data mining book ....
Clustering techniques data mining book ....Clustering techniques data mining book ....
Clustering techniques data mining book ....
 
Exploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the ProcessExploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the Process
 
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
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
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-...
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
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 ...
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
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...
 

NFluent Brown bag lunch January 2014