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 di...
#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 inte...
#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?!?	

...
#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
F...
#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 writ...
#1: NO BRAINER ASSERTIONS!	

NFLUENT’S ANSWERS
Natural language assertions
A unique entry point for assertions (Check.That...
#1: NO BRAINER ASSERTIONS!	

NFLUENT’S ANSWERS
Natural language assertions
A unique entry point for assertions (Check.That...
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	
...
• A fully extensible model
• No need to wait the NFluent team to add your own
assertions on any kind of ‘value’	

• The op...
!
!










	

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	

	...
• For NFluent contributors
• No warning (all warn as ERROR)	

• No StyleCop warning (full rules)	

• 100% of test coverage...
!
!
!
!
!
!
!
BYTEST DEVELOPMENT DRIVEN IS?


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

!
http://www.n-fluent.net
Thank you!
NFluent Brown bag lunch January 2014
Upcoming SlideShare
Loading in …5
×

NFluent Brown bag lunch January 2014

448 views

Published on

Slides of the Brown Bag Lunch session at SG CIB, dedicated to NFluent.

Video also available here: https://www.youtube.com/watch?v=fJuDLWJiIJc

Published in: Software, Technology, Education
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
448
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
5
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

NFluent Brown bag lunch January 2014

  1. 1. ASYOU MEANT IT… 
 NFluent: the craft you needed 
 to boost yourTDD
 Brown Bag Lunch - 2014 ! ! @tpierrain @cyrdup
  2. 2. WHO ARE WE? use case driven (blog) Many Cores (blog)
  3. 3. UNITTESTS FROMTHE TRENCHES…
  4. 4. COMMENTS?
  5. 5. IDEAL WORLD
  6. 6. HARD FACT #1 Tests assertions are needlessly difficult to write !
  7. 7. HARD FACT #1 Tests assertions are needlessly difficult to write !
  8. 8. HARD FACT #1 Tests assertions are needlessly difficult to write !
  9. 9. HARD FACT #1 CONSEQUENCES error-prone
 reluctance to write tests
 relevance of tests? Tests assertions are needlessly difficult to write !
  10. 10. #1:WE DESERVE NO BRAINER ASSERTIONS!
  11. 11. HARD FACT #2 Test intentions may be difficult to grasp
  12. 12. 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
  13. 13. #2: TESTS INTENTIONS SHOULD BE OBVIOUS!
  14. 14. HARD FACT #3 When reliable… error messages are often unhelpful
  15. 15. 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
  16. 16. #3:WE WANTTRUSTWORTHY & HELPFUL ERROR MESSAGES!
  17. 17. #3:WE WANTTRUSTWORTHY & HELPFUL ERROR MESSAGES!
  18. 18. TDD IS NOT EASY…
  19. 19. TDD IS NOT EASY… 

 … but NFluent will greatly help you
  20. 20. ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! (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]
  21. 21. #1: NO BRAINER ASSERTIONS! NFLUENT’S ANSWERS #2: OBVIOUSTESTS INTENTIONS! #3:TRUSTWORTHY & HELPFUL 
 ERROR MESSAGES!
  22. 22. #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!
  23. 23. #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!
  24. 24. #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!
  25. 25. COMBINING THOSE 3 WISHES, WE CAN REACH OUR IDEAL:
 EFFICIENT TDD!
  26. 26. ! ! ! ! ! ! ! NFLUENT SAMPLES
  27. 27. DEMO
  28. 28. • 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
  29. 29. • 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
  30. 30. ! ! 
 
 
 
 
 INTHE WILD tpierrain malatrhwydupdob
  31. 31. FINAL QUESTION
  32. 32. ! ! ! ! ! 
 Does your test framework dictate the way you work, or is it the other way around? FINAL QUESTION
  33. 33. APPLYTDD!
  34. 34. APPLYTDD! Use NFluent!
  35. 35. APPLYTDD! Use NFluent!
  36. 36. APPLYTDD! Use NFluent! http://www.n-fluent.net
  37. 37. APPENDIX
  38. 38. TDD:A WORKFLOW
  39. 39. (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?
  40. 40. • 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
  41. 41. ! ! ! ! ! ! ! BYTEST DEVELOPMENT DRIVEN IS?
  42. 42. 
 Use NFluent! ! ! ! ! WRITEVALUABLETESTS (NFluent logo © rhwy) ! http://www.n-fluent.net Thank you!

×